Skip to content

Commit

Permalink
chore: bump alloy 0.2.1 (foundry-rs#8586)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Aug 2, 2024
1 parent 626221f commit d856669
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 171 deletions.
280 changes: 158 additions & 122 deletions Cargo.lock

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,28 +172,28 @@ revm-inspectors = { version = "0.5", features = ["serde"] }
ethers-contract-abigen = { version = "2.0.14", default-features = false }

## alloy
alloy-consensus = { version = "0.2.0", default-features = false }
alloy-contract = { version = "0.2.0", default-features = false }
alloy-eips = { version = "0.2.0", default-features = false }
alloy-genesis = { version = "0.2.0", default-features = false }
alloy-json-rpc = { version = "0.2.0", default-features = false }
alloy-network = { version = "0.2.0", default-features = false }
alloy-node-bindings = { version = "0.2.0", default-features = false }
alloy-provider = { version = "0.2.0", default-features = false }
alloy-pubsub = { version = "0.2.0", default-features = false }
alloy-rpc-client = { version = "0.2.0", default-features = false }
alloy-rpc-types = { version = "0.2.0", default-features = false }
alloy-serde = { version = "0.2.0", default-features = false }
alloy-signer = { version = "0.2.0", default-features = false }
alloy-signer-aws = { version = "0.2.0", default-features = false }
alloy-signer-gcp = { version = "0.2.0", default-features = false }
alloy-signer-ledger = { version = "0.2.0", default-features = false }
alloy-signer-local = { version = "0.2.0", default-features = false }
alloy-signer-trezor = { version = "0.2.0", default-features = false }
alloy-transport = { version = "0.2.0", default-features = false }
alloy-transport-http = { version = "0.2.0", default-features = false }
alloy-transport-ipc = { version = "0.2.0", default-features = false }
alloy-transport-ws = { version = "0.2.0", default-features = false }
alloy-consensus = { version = "0.2.1", default-features = false }
alloy-contract = { version = "0.2.1", default-features = false }
alloy-eips = { version = "0.2.1", default-features = false }
alloy-genesis = { version = "0.2.1", default-features = false }
alloy-json-rpc = { version = "0.2.1", default-features = false }
alloy-network = { version = "0.2.1", default-features = false }
alloy-node-bindings = { version = "0.2.1", default-features = false }
alloy-provider = { version = "0.2.1", default-features = false }
alloy-pubsub = { version = "0.2.1", default-features = false }
alloy-rpc-client = { version = "0.2.1", default-features = false }
alloy-rpc-types = { version = "0.2.1", default-features = false }
alloy-serde = { version = "0.2.1", default-features = false }
alloy-signer = { version = "0.2.1", default-features = false }
alloy-signer-aws = { version = "0.2.1", default-features = false }
alloy-signer-gcp = { version = "0.2.1", default-features = false }
alloy-signer-ledger = { version = "0.2.1", default-features = false }
alloy-signer-local = { version = "0.2.1", default-features = false }
alloy-signer-trezor = { version = "0.2.1", default-features = false }
alloy-transport = { version = "0.2.1", default-features = false }
alloy-transport-http = { version = "0.2.1", default-features = false }
alloy-transport-ipc = { version = "0.2.1", default-features = false }
alloy-transport-ws = { version = "0.2.1", default-features = false }

alloy-dyn-abi = "0.7.7"
alloy-json-abi = "0.7.7"
Expand Down
7 changes: 4 additions & 3 deletions crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use alloy_rpc_types::{
parity::LocalizedTransactionTrace,
},
txpool::{TxpoolContent, TxpoolInspect, TxpoolInspectSummary, TxpoolStatus},
AccessList, AccessListWithGasUsed, Block, BlockId, BlockNumberOrTag as BlockNumber,
AccessList, AccessListResult, Block, BlockId, BlockNumberOrTag as BlockNumber,
BlockTransactions, EIP1186AccountProofResponse, FeeHistory, Filter, FilteredParams, Index, Log,
Transaction,
};
Expand Down Expand Up @@ -1084,7 +1084,7 @@ impl EthApi {
&self,
mut request: WithOtherFields<TransactionRequest>,
block_number: Option<BlockId>,
) -> Result<AccessListWithGasUsed> {
) -> Result<AccessListResult> {
node_info!("eth_createAccessList");
let block_request = self.block_request(block_number).await?;
// check if the number predates the fork, if in fork mode
Expand Down Expand Up @@ -1117,9 +1117,10 @@ impl EthApi {
)?;
ensure_return_ok(exit, &out)?;

Ok(AccessListWithGasUsed {
Ok(AccessListResult {
access_list: AccessList(access_list.0),
gas_used: U256::from(gas_used),
error: None,
})
})
.await?
Expand Down
9 changes: 5 additions & 4 deletions crates/anvil/src/eth/backend/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use crate::eth::{backend::db::Db, error::BlockchainError, pool::transactions::PoolTransaction};
use alloy_consensus::Account;
use alloy_eips::eip2930::AccessListResult;
use alloy_primitives::{Address, Bytes, StorageValue, B256, U256};
use alloy_provider::{
ext::{DebugApi, TraceApi},
Expand All @@ -13,7 +14,7 @@ use alloy_rpc_types::{
geth::{GethDebugTracingOptions, GethTrace},
parity::LocalizedTransactionTrace as Trace,
},
AccessListWithGasUsed, Block, BlockId, BlockNumberOrTag as BlockNumber, BlockTransactions,
Block, BlockId, BlockNumberOrTag as BlockNumber, BlockTransactions,
EIP1186AccountProofResponse, FeeHistory, Filter, Log, Transaction,
};
use alloy_serde::WithOtherFields;
Expand Down Expand Up @@ -205,7 +206,7 @@ impl ClientFork {
&self,
request: &WithOtherFields<TransactionRequest>,
block: Option<BlockNumber>,
) -> Result<AccessListWithGasUsed, TransportError> {
) -> Result<AccessListResult, TransportError> {
self.provider().create_access_list(request).block_id(block.unwrap_or_default().into()).await
}

Expand Down Expand Up @@ -273,7 +274,7 @@ impl ClientFork {
blocknumber: u64,
) -> Result<Account, TransportError> {
trace!(target: "backend::fork", "get_account={:?}", address);
self.provider().get_account(address).await.block_id(blocknumber.into()).await
self.provider().get_account(address).block_id(blocknumber.into()).await
}

pub async fn transaction_by_block_number_and_index(
Expand Down Expand Up @@ -577,7 +578,7 @@ impl ClientFork {
};
let mut transactions = Vec::with_capacity(block_txs_len);
for tx in block.transactions.hashes() {
if let Some(tx) = storage.transactions.get(tx).cloned() {
if let Some(tx) = storage.transactions.get(&tx).cloned() {
transactions.push(tx.inner);
}
}
Expand Down
16 changes: 3 additions & 13 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ use alloy_rpc_types::{
GethDebugBuiltInTracerType, GethDebugTracerType, GethDebugTracingCallOptions,
GethDebugTracingOptions, GethTrace, NoopFrame,
},
parity::{
Action::{Call, Create, Reward, Selfdestruct},
LocalizedTransactionTrace,
},
parity::LocalizedTransactionTrace,
},
AccessList, Block as AlloyBlock, BlockId, BlockNumberOrTag as BlockNumber,
EIP1186AccountProofResponse as AccountProof, EIP1186StorageProof as StorageProof, Filter,
Expand Down Expand Up @@ -2095,14 +2092,7 @@ impl Backend {
// Execute tasks and filter traces
let traces = futures::future::try_join_all(trace_tasks).await?;
let filtered_traces =
traces.into_iter().flatten().filter(|trace| match &trace.trace.action {
Call(call) => matcher.matches(call.from, Some(call.to)),
Create(create) => matcher.matches(create.from, None),
Selfdestruct(self_destruct) => {
matcher.matches(self_destruct.address, Some(self_destruct.refund_address))
}
Reward(reward) => matcher.matches(reward.author, None),
});
traces.into_iter().flatten().filter(|trace| matcher.matches(&trace.trace));

// Apply after and count
let filtered_traces: Vec<_> = if let Some(after) = filter.after {
Expand All @@ -2126,7 +2116,7 @@ impl Backend {
let mut receipts = Vec::new();
let storage = self.blockchain.storage.read();
for tx in block.transactions.hashes() {
let receipt = storage.transactions.get(tx)?.receipt.clone();
let receipt = storage.transactions.get(&tx)?.receipt.clone();
receipts.push(receipt);
}
Some(receipts)
Expand Down
8 changes: 5 additions & 3 deletions crates/anvil/src/eth/otterscan/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,10 @@ impl EthApi {
if block.transactions.is_uncle() {
return Err(BlockchainError::DataUnavailable);
}
let receipts_futs =
block.transactions.hashes().map(|hash| async { self.transaction_receipt(*hash).await });
let receipts_futs = block
.transactions
.hashes()
.map(|hash| async move { self.transaction_receipt(hash).await });

// fetch all receipts
let receipts = join_all(receipts_futs)
Expand Down Expand Up @@ -398,7 +400,7 @@ impl EthApi {
BlockTransactions::Uncle => unreachable!(),
};

let receipt_futs = block.transactions.hashes().map(|hash| self.transaction_receipt(*hash));
let receipt_futs = block.transactions.hashes().map(|hash| self.transaction_receipt(hash));

let receipts = join_all(receipt_futs)
.await
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/tests/it/otterscan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ async fn ots_get_block_transactions() {
result.receipts.iter().enumerate().for_each(|(i, receipt)| {
let expected = hashes.pop_front();
assert_eq!(expected, Some(receipt.receipt.transaction_hash));
assert_eq!(expected, result.fullblock.block.transactions.hashes().nth(i).copied());
assert_eq!(expected, result.fullblock.block.transactions.hashes().nth(i));
});
}

Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/tests/it/traces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ async fn test_trace_filter() {
}

let traces = api.trace_filter(tracer).await.unwrap();
assert_eq!(traces.len(), 3);
assert_eq!(traces.len(), 8);

// Test Range Error
let latest = provider.get_block_number().await.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/tests/it/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,6 @@ async fn can_mine_multiple_in_block() {

let block = api.block_by_number(BlockNumberOrTag::Latest).await.unwrap().unwrap();

let txs = block.transactions.hashes().copied().collect::<Vec<_>>();
let txs = block.transactions.hashes().collect::<Vec<_>>();
assert_eq!(txs, vec![first, second]);
}
2 changes: 1 addition & 1 deletion crates/common/fmt/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ transactions: {}",
}
}

impl UIfmt for BlockTransactions {
impl<T: UIfmt> UIfmt for BlockTransactions<T> {
fn pretty(&self) -> String {
match self {
Self::Hashes(hashes) => hashes.pretty(),
Expand Down

0 comments on commit d856669

Please sign in to comment.