Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 130 additions & 67 deletions Cargo.lock

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,41 +159,41 @@ foundry-linking = { path = "crates/linking" }
# solc & compilation utilities
foundry-block-explorers = { version = "0.5.0", default-features = false }
foundry-compilers = { version = "0.9.0", default-features = false }
foundry-fork-db = "0.1"
foundry-fork-db = "0.2"
solang-parser = "=0.3.3"

## revm
# no default features to avoid c-kzg
revm = { version = "10.0.0", default-features = false }
revm-primitives = { version = "5.0.0", default-features = false }
revm-inspectors = { version = "0.3", features = ["serde"] }
revm = { version = "12.1.0", default-features = false }
revm-primitives = { version = "7.1.0", default-features = false }
revm-inspectors = { version = "0.5", features = ["serde"] }

## ethers
ethers-contract-abigen = { version = "2.0.14", default-features = false }

## alloy
alloy-consensus = { version = "0.1.4", default-features = false }
alloy-contract = { version = "0.1.4", default-features = false }
alloy-eips = { version = "0.1.4", default-features = false }
alloy-genesis = { version = "0.1.4", default-features = false }
alloy-json-rpc = { version = "0.1.4", default-features = false }
alloy-network = { version = "0.1.4", default-features = false }
alloy-node-bindings = { version = "0.1.4", default-features = false }
alloy-provider = { version = "0.1.4", default-features = false }
alloy-pubsub = { version = "0.1.4", default-features = false }
alloy-rpc-client = { version = "0.1.4", default-features = false }
alloy-rpc-types = { version = "0.1.4", default-features = false }
alloy-serde = { version = "0.1.4", default-features = false }
alloy-signer = { version = "0.1.4", default-features = false }
alloy-signer-aws = { version = "0.1.4", default-features = false }
alloy-signer-gcp = { version = "0.1.4", default-features = false }
alloy-signer-ledger = { version = "0.1.4", default-features = false }
alloy-signer-local = { version = "0.1.4", default-features = false }
alloy-signer-trezor = { version = "0.1.4", default-features = false }
alloy-transport = { version = "0.1.4", default-features = false }
alloy-transport-http = { version = "0.1.4", default-features = false }
alloy-transport-ipc = { version = "0.1.4", default-features = false }
alloy-transport-ws = { version = "0.1.4", default-features = false }
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-dyn-abi = "0.7.7"
alloy-json-abi = "0.7.7"
Expand Down
13 changes: 10 additions & 3 deletions crates/anvil/core/src/eth/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ pub fn to_alloy_transaction_with_hash_and_sender(
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
other: Default::default(),
authorization_list: None,
},
TypedTransaction::EIP2930(t) => RpcTransaction {
hash,
Expand Down Expand Up @@ -323,6 +324,7 @@ pub fn to_alloy_transaction_with_hash_and_sender(
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
other: Default::default(),
authorization_list: None,
},
TypedTransaction::EIP1559(t) => RpcTransaction {
hash,
Expand Down Expand Up @@ -350,6 +352,7 @@ pub fn to_alloy_transaction_with_hash_and_sender(
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
other: Default::default(),
authorization_list: None,
},
TypedTransaction::EIP4844(t) => RpcTransaction {
hash,
Expand Down Expand Up @@ -377,6 +380,7 @@ pub fn to_alloy_transaction_with_hash_and_sender(
max_fee_per_blob_gas: Some(t.tx().tx().max_fee_per_blob_gas),
blob_versioned_hashes: Some(t.tx().tx().blob_versioned_hashes.clone()),
other: Default::default(),
authorization_list: None,
},
TypedTransaction::Deposit(t) => RpcTransaction {
hash,
Expand All @@ -399,6 +403,7 @@ pub fn to_alloy_transaction_with_hash_and_sender(
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
other: Default::default(),
authorization_list: None,
},
}
}
Expand Down Expand Up @@ -494,7 +499,7 @@ impl PendingTransaction {
gas_price: U256::from(*gas_price),
gas_priority_fee: None,
gas_limit: *gas_limit as u64,
access_list: access_list.flattened(),
access_list: access_list.clone().into(),
..Default::default()
}
}
Expand All @@ -521,7 +526,7 @@ impl PendingTransaction {
gas_price: U256::from(*max_fee_per_gas),
gas_priority_fee: Some(U256::from(*max_priority_fee_per_gas)),
gas_limit: *gas_limit as u64,
access_list: access_list.flattened(),
access_list: access_list.clone().into(),
..Default::default()
}
}
Expand Down Expand Up @@ -552,7 +557,7 @@ impl PendingTransaction {
max_fee_per_blob_gas: Some(U256::from(*max_fee_per_blob_gas)),
blob_hashes: blob_versioned_hashes.clone(),
gas_limit: *gas_limit as u64,
access_list: access_list.flattened(),
access_list: access_list.clone().into(),
..Default::default()
}
}
Expand Down Expand Up @@ -1463,6 +1468,7 @@ pub fn convert_to_anvil_receipt(receipt: AnyTransactionReceipt) -> Option<Receip
blob_gas_used,
state_root,
inner: AnyReceiptEnvelope { inner: receipt_with_bloom, r#type },
authorization_list,
},
other,
} = receipt;
Expand All @@ -1480,6 +1486,7 @@ pub fn convert_to_anvil_receipt(receipt: AnyTransactionReceipt) -> Option<Receip
blob_gas_price,
blob_gas_used,
state_root,
authorization_list,
inner: match r#type {
0x00 => TypedReceipt::Legacy(receipt_with_bloom),
0x01 => TypedReceipt::EIP2930(receipt_with_bloom),
Expand Down
4 changes: 3 additions & 1 deletion crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2743,7 +2743,9 @@ impl TryFrom<Result<(InstructionResult, Option<Output>, u128, State)>> for GasEs
InstructionResult::OpcodeNotFound |
InstructionResult::CallNotAllowedInsideStatic |
InstructionResult::StateChangeDuringStaticCall |
InstructionResult::InvalidEFOpcode |
InstructionResult::InvalidExtDelegateCallTarget |
InstructionResult::InvalidEXTCALLTarget |
InstructionResult::InvalidFEOpcode |
InstructionResult::InvalidJump |
InstructionResult::NotActivated |
InstructionResult::StackUnderflow |
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/eth/backend/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ impl DatabaseRef for StateDb {
self.0.storage_ref(address, index)
}

fn block_hash_ref(&self, number: U256) -> DatabaseResult<B256> {
fn block_hash_ref(&self, number: u64) -> DatabaseResult<B256> {
self.0.block_hash_ref(number)
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/anvil/src/eth/backend/mem/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ impl<DB: Database> revm::Inspector<DB> for Inspector {
});
}

fn log(&mut self, ecx: &mut EvmContext<DB>, log: &Log) {
fn log(&mut self, interp: &mut Interpreter, ecx: &mut EvmContext<DB>, log: &Log) {
call_inspectors!([&mut self.tracer, &mut self.log_collector], |inspector| {
inspector.log(ecx, log);
inspector.log(interp, ecx, log);
});
}

Expand Down
6 changes: 4 additions & 2 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,9 +1156,10 @@ impl Backend {
data: input.into_input().unwrap_or_default(),
chain_id: None,
nonce,
access_list: access_list.unwrap_or_default().flattened(),
access_list: access_list.unwrap_or_default().into(),
blob_hashes: blob_versioned_hashes.unwrap_or_default(),
optimism: OptimismFields { enveloped_tx: Some(Bytes::new()), ..Default::default() },
authorization_list: None,
};

if env.block.basefee.is_zero() {
Expand Down Expand Up @@ -2110,6 +2111,7 @@ impl Backend {
state_root: Some(block.header.state_root),
blob_gas_price: Some(blob_gas_price),
blob_gas_used,
authorization_list: None,
};

Some(MinedTransactionReceipt { inner, out: info.out.map(|o| o.0.into()) })
Expand Down Expand Up @@ -2261,7 +2263,7 @@ impl Backend {
let account_proof = AccountProof {
address,
balance: account.info.balance,
nonce: U64::from(account.info.nonce),
nonce: account.info.nonce,
code_hash: account.info.code_hash,
storage_hash: storage_root(&account.storage),
account_proof: proof,
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/eth/backend/mem/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ where
let mut account_info = cache_db.basic_ref(*account)?.unwrap_or_default();

if let Some(nonce) = account_overrides.nonce {
account_info.nonce = nonce.to::<u64>();
account_info.nonce = nonce;
}
if let Some(code) = &account_overrides.code {
account_info.code = Some(Bytecode::new_raw(code.to_vec().into()));
Expand Down
8 changes: 4 additions & 4 deletions crates/anvil/tests/it/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::utils::http_provider_with_signer;
use alloy_eips::eip2718::Encodable2718;
use alloy_network::{EthereumWallet, TransactionBuilder};
use alloy_primitives::{b256, U128, U256};
use alloy_primitives::{b256, U256};
use alloy_provider::Provider;
use alloy_rpc_types::{optimism::OptimismTransactionFields, TransactionRequest};
use alloy_serde::WithOtherFields;
Expand All @@ -29,7 +29,7 @@ async fn test_deposits_not_supported_if_optimism_disabled() {
source_hash: Some(b256!(
"0000000000000000000000000000000000000000000000000000000000000000"
)),
mint: Some(U128::from(0)),
mint: Some(0),
is_system_tx: Some(true),
}
.into(),
Expand Down Expand Up @@ -67,7 +67,7 @@ async fn test_send_value_deposit_transaction() {
source_hash: Some(b256!(
"0000000000000000000000000000000000000000000000000000000000000000"
)),
mint: Some(U128::from(0)),
mint: Some(0),
is_system_tx: Some(true),
}
.into(),
Expand Down Expand Up @@ -119,7 +119,7 @@ async fn test_send_value_raw_deposit_transaction() {
source_hash: Some(b256!(
"0000000000000000000000000000000000000000000000000000000000000000"
)),
mint: Some(U128::from(0)),
mint: Some(0),
is_system_tx: Some(true),
}
.into(),
Expand Down
12 changes: 2 additions & 10 deletions crates/anvil/tests/it/otterscan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use alloy_primitives::{address, Address, Bytes, U256};
use alloy_provider::Provider;
use alloy_rpc_types::{
trace::otterscan::{InternalOperation, OperationType, TraceEntry},
BlockNumberOrTag, BlockTransactions, TransactionRequest,
BlockNumberOrTag, TransactionRequest,
};
use alloy_serde::WithOtherFields;
use alloy_sol_types::{sol, SolCall, SolError, SolValue};
Expand Down Expand Up @@ -331,13 +331,11 @@ async fn ots_get_block_details() {

let tx = TransactionRequest::default().to(Address::random()).value(U256::from(100));
let tx = WithOtherFields::new(tx);
let receipt = provider.send_transaction(tx).await.unwrap().get_receipt().await.unwrap();
provider.send_transaction(tx).await.unwrap().get_receipt().await.unwrap();

let result = api.ots_get_block_details(1.into()).await.unwrap();

assert_eq!(result.block.transaction_count, 1);
let hash = result.block.block.transactions.hashes().next().unwrap();
assert_eq!(*hash, receipt.transaction_hash);
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -353,12 +351,6 @@ async fn ots_get_block_details_by_hash() {
let result = api.ots_get_block_details_by_hash(block_hash).await.unwrap();

assert_eq!(result.block.transaction_count, 1);
let hash = match result.block.block.transactions {
BlockTransactions::Full(txs) => txs[0].hash,
BlockTransactions::Hashes(hashes) => hashes[0],
BlockTransactions::Uncle => unreachable!(),
};
assert_eq!(hash, receipt.transaction_hash);
}

#[tokio::test(flavor = "multi_thread")]
Expand Down
1 change: 0 additions & 1 deletion crates/cheatcodes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ foundry-compilers.workspace = true
foundry-config.workspace = true
foundry-evm-core.workspace = true
foundry-wallets.workspace = true
foundry-evm-abi.workspace = true

alloy-dyn-abi.workspace = true
alloy-json-abi.workspace = true
Expand Down
Loading