Skip to content

Commit 65b3cb0

Browse files
rakitaklkvr
andauthored
feat(EOF): enable EOF inspector (#8305)
* feat(EOF): enable EOF inspector * fmt nightly * bump inspectors * update revm * fix test * rm compilers patch * bump alloy and revm (#8460) * bump alloy and revm * fix test * rm patch * update lock --------- Co-authored-by: Arsenii Kulikov <[email protected]>
1 parent cb9dfae commit 65b3cb0

File tree

27 files changed

+288
-193
lines changed

27 files changed

+288
-193
lines changed

Cargo.lock

Lines changed: 130 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -159,41 +159,41 @@ foundry-linking = { path = "crates/linking" }
159159
# solc & compilation utilities
160160
foundry-block-explorers = { version = "0.5.0", default-features = false }
161161
foundry-compilers = { version = "0.9.0", default-features = false }
162-
foundry-fork-db = "0.1"
162+
foundry-fork-db = "0.2"
163163
solang-parser = "=0.3.3"
164164

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

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

174174
## alloy
175-
alloy-consensus = { version = "0.1.4", default-features = false }
176-
alloy-contract = { version = "0.1.4", default-features = false }
177-
alloy-eips = { version = "0.1.4", default-features = false }
178-
alloy-genesis = { version = "0.1.4", default-features = false }
179-
alloy-json-rpc = { version = "0.1.4", default-features = false }
180-
alloy-network = { version = "0.1.4", default-features = false }
181-
alloy-node-bindings = { version = "0.1.4", default-features = false }
182-
alloy-provider = { version = "0.1.4", default-features = false }
183-
alloy-pubsub = { version = "0.1.4", default-features = false }
184-
alloy-rpc-client = { version = "0.1.4", default-features = false }
185-
alloy-rpc-types = { version = "0.1.4", default-features = false }
186-
alloy-serde = { version = "0.1.4", default-features = false }
187-
alloy-signer = { version = "0.1.4", default-features = false }
188-
alloy-signer-aws = { version = "0.1.4", default-features = false }
189-
alloy-signer-gcp = { version = "0.1.4", default-features = false }
190-
alloy-signer-ledger = { version = "0.1.4", default-features = false }
191-
alloy-signer-local = { version = "0.1.4", default-features = false }
192-
alloy-signer-trezor = { version = "0.1.4", default-features = false }
193-
alloy-transport = { version = "0.1.4", default-features = false }
194-
alloy-transport-http = { version = "0.1.4", default-features = false }
195-
alloy-transport-ipc = { version = "0.1.4", default-features = false }
196-
alloy-transport-ws = { version = "0.1.4", default-features = false }
175+
alloy-consensus = { version = "0.2.0", default-features = false }
176+
alloy-contract = { version = "0.2.0", default-features = false }
177+
alloy-eips = { version = "0.2.0", default-features = false }
178+
alloy-genesis = { version = "0.2.0", default-features = false }
179+
alloy-json-rpc = { version = "0.2.0", default-features = false }
180+
alloy-network = { version = "0.2.0", default-features = false }
181+
alloy-node-bindings = { version = "0.2.0", default-features = false }
182+
alloy-provider = { version = "0.2.0", default-features = false }
183+
alloy-pubsub = { version = "0.2.0", default-features = false }
184+
alloy-rpc-client = { version = "0.2.0", default-features = false }
185+
alloy-rpc-types = { version = "0.2.0", default-features = false }
186+
alloy-serde = { version = "0.2.0", default-features = false }
187+
alloy-signer = { version = "0.2.0", default-features = false }
188+
alloy-signer-aws = { version = "0.2.0", default-features = false }
189+
alloy-signer-gcp = { version = "0.2.0", default-features = false }
190+
alloy-signer-ledger = { version = "0.2.0", default-features = false }
191+
alloy-signer-local = { version = "0.2.0", default-features = false }
192+
alloy-signer-trezor = { version = "0.2.0", default-features = false }
193+
alloy-transport = { version = "0.2.0", default-features = false }
194+
alloy-transport-http = { version = "0.2.0", default-features = false }
195+
alloy-transport-ipc = { version = "0.2.0", default-features = false }
196+
alloy-transport-ws = { version = "0.2.0", default-features = false }
197197

198198
alloy-dyn-abi = "0.7.7"
199199
alloy-json-abi = "0.7.7"

crates/anvil/core/src/eth/transaction/mod.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ pub fn to_alloy_transaction_with_hash_and_sender(
298298
max_fee_per_blob_gas: None,
299299
blob_versioned_hashes: None,
300300
other: Default::default(),
301+
authorization_list: None,
301302
},
302303
TypedTransaction::EIP2930(t) => RpcTransaction {
303304
hash,
@@ -325,6 +326,7 @@ pub fn to_alloy_transaction_with_hash_and_sender(
325326
max_fee_per_blob_gas: None,
326327
blob_versioned_hashes: None,
327328
other: Default::default(),
329+
authorization_list: None,
328330
},
329331
TypedTransaction::EIP1559(t) => RpcTransaction {
330332
hash,
@@ -352,6 +354,7 @@ pub fn to_alloy_transaction_with_hash_and_sender(
352354
max_fee_per_blob_gas: None,
353355
blob_versioned_hashes: None,
354356
other: Default::default(),
357+
authorization_list: None,
355358
},
356359
TypedTransaction::EIP4844(t) => RpcTransaction {
357360
hash,
@@ -379,6 +382,7 @@ pub fn to_alloy_transaction_with_hash_and_sender(
379382
max_fee_per_blob_gas: Some(t.tx().tx().max_fee_per_blob_gas),
380383
blob_versioned_hashes: Some(t.tx().tx().blob_versioned_hashes.clone()),
381384
other: Default::default(),
385+
authorization_list: None,
382386
},
383387
TypedTransaction::Deposit(t) => RpcTransaction {
384388
hash,
@@ -401,6 +405,7 @@ pub fn to_alloy_transaction_with_hash_and_sender(
401405
max_fee_per_blob_gas: None,
402406
blob_versioned_hashes: None,
403407
other: Default::default(),
408+
authorization_list: None,
404409
},
405410
}
406411
}
@@ -496,7 +501,7 @@ impl PendingTransaction {
496501
gas_price: U256::from(*gas_price),
497502
gas_priority_fee: None,
498503
gas_limit: *gas_limit as u64,
499-
access_list: access_list.flattened(),
504+
access_list: access_list.clone().into(),
500505
..Default::default()
501506
}
502507
}
@@ -523,7 +528,7 @@ impl PendingTransaction {
523528
gas_price: U256::from(*max_fee_per_gas),
524529
gas_priority_fee: Some(U256::from(*max_priority_fee_per_gas)),
525530
gas_limit: *gas_limit as u64,
526-
access_list: access_list.flattened(),
531+
access_list: access_list.clone().into(),
527532
..Default::default()
528533
}
529534
}
@@ -554,7 +559,7 @@ impl PendingTransaction {
554559
max_fee_per_blob_gas: Some(U256::from(*max_fee_per_blob_gas)),
555560
blob_hashes: blob_versioned_hashes.clone(),
556561
gas_limit: *gas_limit as u64,
557-
access_list: access_list.flattened(),
562+
access_list: access_list.clone().into(),
558563
..Default::default()
559564
}
560565
}
@@ -1459,6 +1464,7 @@ pub fn convert_to_anvil_receipt(receipt: AnyTransactionReceipt) -> Option<Receip
14591464
blob_gas_used,
14601465
state_root,
14611466
inner: AnyReceiptEnvelope { inner: receipt_with_bloom, r#type },
1467+
authorization_list,
14621468
},
14631469
other,
14641470
} = receipt;
@@ -1476,6 +1482,7 @@ pub fn convert_to_anvil_receipt(receipt: AnyTransactionReceipt) -> Option<Receip
14761482
blob_gas_price,
14771483
blob_gas_used,
14781484
state_root,
1485+
authorization_list,
14791486
inner: match r#type {
14801487
0x00 => TypedReceipt::Legacy(receipt_with_bloom),
14811488
0x01 => TypedReceipt::EIP2930(receipt_with_bloom),

crates/anvil/src/eth/api.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2766,7 +2766,9 @@ impl TryFrom<Result<(InstructionResult, Option<Output>, u128, State)>> for GasEs
27662766
InstructionResult::OpcodeNotFound |
27672767
InstructionResult::CallNotAllowedInsideStatic |
27682768
InstructionResult::StateChangeDuringStaticCall |
2769-
InstructionResult::InvalidEFOpcode |
2769+
InstructionResult::InvalidExtDelegateCallTarget |
2770+
InstructionResult::InvalidEXTCALLTarget |
2771+
InstructionResult::InvalidFEOpcode |
27702772
InstructionResult::InvalidJump |
27712773
InstructionResult::NotActivated |
27722774
InstructionResult::StackUnderflow |

crates/anvil/src/eth/backend/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ impl DatabaseRef for StateDb {
291291
self.0.storage_ref(address, index)
292292
}
293293

294-
fn block_hash_ref(&self, number: U256) -> DatabaseResult<B256> {
294+
fn block_hash_ref(&self, number: u64) -> DatabaseResult<B256> {
295295
self.0.block_hash_ref(number)
296296
}
297297
}

crates/anvil/src/eth/backend/mem/inspector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ impl<DB: Database> revm::Inspector<DB> for Inspector {
7878
});
7979
}
8080

81-
fn log(&mut self, ecx: &mut EvmContext<DB>, log: &Log) {
81+
fn log(&mut self, interp: &mut Interpreter, ecx: &mut EvmContext<DB>, log: &Log) {
8282
call_inspectors!([&mut self.tracer, &mut self.log_collector], |inspector| {
83-
inspector.log(ecx, log);
83+
inspector.log(interp, ecx, log);
8484
});
8585
}
8686

crates/anvil/src/eth/backend/mem/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,9 +1156,10 @@ impl Backend {
11561156
data: input.into_input().unwrap_or_default(),
11571157
chain_id: None,
11581158
nonce,
1159-
access_list: access_list.unwrap_or_default().flattened(),
1159+
access_list: access_list.unwrap_or_default().into(),
11601160
blob_hashes: blob_versioned_hashes.unwrap_or_default(),
11611161
optimism: OptimismFields { enveloped_tx: Some(Bytes::new()), ..Default::default() },
1162+
authorization_list: None,
11621163
};
11631164

11641165
if env.block.basefee.is_zero() {
@@ -2110,6 +2111,7 @@ impl Backend {
21102111
state_root: Some(block.header.state_root),
21112112
blob_gas_price: Some(blob_gas_price),
21122113
blob_gas_used,
2114+
authorization_list: None,
21132115
};
21142116

21152117
Some(MinedTransactionReceipt { inner, out: info.out.map(|o| o.0.into()) })
@@ -2261,7 +2263,7 @@ impl Backend {
22612263
let account_proof = AccountProof {
22622264
address,
22632265
balance: account.info.balance,
2264-
nonce: U64::from(account.info.nonce),
2266+
nonce: account.info.nonce,
22652267
code_hash: account.info.code_hash,
22662268
storage_hash: storage_root(&account.storage),
22672269
account_proof: proof,

crates/anvil/src/eth/backend/mem/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ where
8383
let mut account_info = cache_db.basic_ref(*account)?.unwrap_or_default();
8484

8585
if let Some(nonce) = account_overrides.nonce {
86-
account_info.nonce = nonce.to::<u64>();
86+
account_info.nonce = nonce;
8787
}
8888
if let Some(code) = &account_overrides.code {
8989
account_info.code = Some(Bytecode::new_raw(code.to_vec().into()));

crates/anvil/tests/it/optimism.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use crate::utils::http_provider_with_signer;
44
use alloy_eips::eip2718::Encodable2718;
55
use alloy_network::{EthereumWallet, TransactionBuilder};
6-
use alloy_primitives::{b256, U128, U256};
6+
use alloy_primitives::{b256, U256};
77
use alloy_provider::Provider;
88
use alloy_rpc_types::{optimism::OptimismTransactionFields, TransactionRequest};
99
use alloy_serde::WithOtherFields;
@@ -29,7 +29,7 @@ async fn test_deposits_not_supported_if_optimism_disabled() {
2929
source_hash: Some(b256!(
3030
"0000000000000000000000000000000000000000000000000000000000000000"
3131
)),
32-
mint: Some(U128::from(0)),
32+
mint: Some(0),
3333
is_system_tx: Some(true),
3434
}
3535
.into(),
@@ -67,7 +67,7 @@ async fn test_send_value_deposit_transaction() {
6767
source_hash: Some(b256!(
6868
"0000000000000000000000000000000000000000000000000000000000000000"
6969
)),
70-
mint: Some(U128::from(0)),
70+
mint: Some(0),
7171
is_system_tx: Some(true),
7272
}
7373
.into(),
@@ -119,7 +119,7 @@ async fn test_send_value_raw_deposit_transaction() {
119119
source_hash: Some(b256!(
120120
"0000000000000000000000000000000000000000000000000000000000000000"
121121
)),
122-
mint: Some(U128::from(0)),
122+
mint: Some(0),
123123
is_system_tx: Some(true),
124124
}
125125
.into(),

crates/anvil/tests/it/otterscan.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use alloy_primitives::{address, Address, Bytes, U256};
55
use alloy_provider::Provider;
66
use alloy_rpc_types::{
77
trace::otterscan::{InternalOperation, OperationType, TraceEntry},
8-
BlockNumberOrTag, BlockTransactions, TransactionRequest,
8+
BlockNumberOrTag, TransactionRequest,
99
};
1010
use alloy_serde::WithOtherFields;
1111
use alloy_sol_types::{sol, SolCall, SolError, SolValue};
@@ -331,13 +331,11 @@ async fn ots_get_block_details() {
331331

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

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

338338
assert_eq!(result.block.transaction_count, 1);
339-
let hash = result.block.block.transactions.hashes().next().unwrap();
340-
assert_eq!(*hash, receipt.transaction_hash);
341339
}
342340

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

355353
assert_eq!(result.block.transaction_count, 1);
356-
let hash = match result.block.block.transactions {
357-
BlockTransactions::Full(txs) => txs[0].hash,
358-
BlockTransactions::Hashes(hashes) => hashes[0],
359-
BlockTransactions::Uncle => unreachable!(),
360-
};
361-
assert_eq!(hash, receipt.transaction_hash);
362354
}
363355

364356
#[tokio::test(flavor = "multi_thread")]

0 commit comments

Comments
 (0)