Skip to content

Commit 7779ed8

Browse files
authored
feat: bump revm (paradigmxyz#18999)
1 parent fd4597e commit 7779ed8

40 files changed

Lines changed: 380 additions & 432 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -468,31 +468,31 @@ reth-ress-protocol = { path = "crates/ress/protocol" }
468468
reth-ress-provider = { path = "crates/ress/provider" }
469469

470470
# revm
471-
revm = { version = "29.0.1", default-features = false }
472-
revm-bytecode = { version = "6.2.2", default-features = false }
473-
revm-database = { version = "7.0.5", default-features = false }
474-
revm-state = { version = "7.0.5", default-features = false }
475-
revm-primitives = { version = "20.2.1", default-features = false }
476-
revm-interpreter = { version = "25.0.3", default-features = false }
477-
revm-inspector = { version = "10.0.1", default-features = false }
478-
revm-context = { version = "9.1.0", default-features = false }
479-
revm-context-interface = { version = "10.2.0", default-features = false }
480-
revm-database-interface = { version = "7.0.5", default-features = false }
481-
op-revm = { version = "10.1.0", default-features = false }
482-
revm-inspectors = "0.30.0"
471+
revm = { version = "30.1.1", default-features = false }
472+
revm-bytecode = { version = "7.0.2", default-features = false }
473+
revm-database = { version = "9.0.0", default-features = false }
474+
revm-state = { version = "8.0.0", default-features = false }
475+
revm-primitives = { version = "21.0.0", default-features = false }
476+
revm-interpreter = { version = "27.0.0", default-features = false }
477+
revm-inspector = { version = "11.1.0", default-features = false }
478+
revm-context = { version = "10.1.0", default-features = false }
479+
revm-context-interface = { version = "11.1.0", default-features = false }
480+
revm-database-interface = { version = "8.0.1", default-features = false }
481+
op-revm = { version = "11.1.0", default-features = false }
482+
revm-inspectors = "0.31.0"
483483

484484
# eth
485485
alloy-chains = { version = "0.2.5", default-features = false }
486486
alloy-dyn-abi = "1.4.1"
487487
alloy-eip2124 = { version = "0.2.0", default-features = false }
488-
alloy-evm = { version = "0.21.2", default-features = false }
488+
alloy-evm = { version = "0.22.0", default-features = false }
489489
alloy-primitives = { version = "1.4.1", default-features = false, features = ["map-foldhash"] }
490490
alloy-rlp = { version = "0.3.10", default-features = false, features = ["core-net"] }
491491
alloy-sol-macro = "1.4.1"
492492
alloy-sol-types = { version = "1.4.1", default-features = false }
493493
alloy-trie = { version = "0.9.1", default-features = false }
494494

495-
alloy-hardforks = "0.3.5"
495+
alloy-hardforks = "0.4.0"
496496

497497
alloy-consensus = { version = "1.0.37", default-features = false }
498498
alloy-contract = { version = "1.0.37", default-features = false }
@@ -523,8 +523,8 @@ alloy-transport-ipc = { version = "1.0.37", default-features = false }
523523
alloy-transport-ws = { version = "1.0.37", default-features = false }
524524

525525
# op
526-
alloy-op-evm = { version = "0.21.2", default-features = false }
527-
alloy-op-hardforks = "0.3.5"
526+
alloy-op-evm = { version = "0.22.0", default-features = false }
527+
alloy-op-hardforks = "0.4.0"
528528
op-alloy-rpc-types = { version = "0.20.0", default-features = false }
529529
op-alloy-rpc-types-engine = { version = "0.20.0", default-features = false }
530530
op-alloy-network = { version = "0.20.0", default-features = false }

crates/chainspec/src/spec.rs

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use alloy_evm::eth::spec::EthExecutorSpec;
33

44
use crate::{
55
constants::{MAINNET_DEPOSIT_CONTRACT, MAINNET_PRUNE_DELETE_LIMIT},
6-
holesky, hoodi, mainnet, sepolia, EthChainSpec,
6+
holesky, hoodi, sepolia, EthChainSpec,
77
};
88
use alloc::{boxed::Box, sync::Arc, vec::Vec};
99
use alloy_chains::{Chain, NamedChain};
@@ -108,10 +108,7 @@ pub static MAINNET: LazyLock<Arc<ChainSpec>> = LazyLock::new(|| {
108108
deposit_contract: Some(MAINNET_DEPOSIT_CONTRACT),
109109
base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
110110
prune_delete_limit: MAINNET_PRUNE_DELETE_LIMIT,
111-
blob_params: BlobScheduleBlobParams::default().with_scheduled([
112-
(mainnet::MAINNET_BPO1_TIMESTAMP, BlobParams::bpo1()),
113-
(mainnet::MAINNET_BPO2_TIMESTAMP, BlobParams::bpo2()),
114-
]),
111+
blob_params: BlobScheduleBlobParams::default(),
115112
};
116113
spec.genesis.config.dao_fork_support = true;
117114
spec.into()
@@ -1129,10 +1126,7 @@ Merge hard forks:
11291126
Post-merge hard forks (timestamp based):
11301127
- Shanghai @1681338455
11311128
- Cancun @1710338135
1132-
- Prague @1746612311
1133-
- Osaka @1764798551
1134-
- Bpo1 @1765978199
1135-
- Bpo2 @1767747671"
1129+
- Prague @1746612311"
11361130
);
11371131
}
11381132

@@ -1376,10 +1370,7 @@ Post-merge hard forks (timestamp based):
13761370
),
13771371
(
13781372
EthereumHardfork::Prague,
1379-
ForkId {
1380-
hash: ForkHash([0xc3, 0x76, 0xcf, 0x8b]),
1381-
next: mainnet::MAINNET_OSAKA_TIMESTAMP,
1382-
},
1373+
ForkId { hash: ForkHash([0xc3, 0x76, 0xcf, 0x8b]), next: 0 },
13831374
),
13841375
],
13851376
);
@@ -1523,22 +1514,12 @@ Post-merge hard forks (timestamp based):
15231514
// First Prague block
15241515
(
15251516
Head { number: 20000002, timestamp: 1746612311, ..Default::default() },
1526-
ForkId {
1527-
hash: ForkHash([0xc3, 0x76, 0xcf, 0x8b]),
1528-
next: mainnet::MAINNET_OSAKA_TIMESTAMP,
1529-
},
1517+
ForkId { hash: ForkHash([0xc3, 0x76, 0xcf, 0x8b]), next: 0 },
15301518
),
1531-
// Osaka block
1519+
// Future Prague block
15321520
(
1533-
Head {
1534-
number: 20000002,
1535-
timestamp: mainnet::MAINNET_OSAKA_TIMESTAMP,
1536-
..Default::default()
1537-
},
1538-
ForkId {
1539-
hash: ForkHash(hex!("0x5167e2a6")),
1540-
next: mainnet::MAINNET_BPO1_TIMESTAMP,
1541-
},
1521+
Head { number: 20000002, timestamp: 2000000000, ..Default::default() },
1522+
ForkId { hash: ForkHash([0xc3, 0x76, 0xcf, 0x8b]), next: 0 },
15421523
),
15431524
],
15441525
);
@@ -1847,22 +1828,11 @@ Post-merge hard forks (timestamp based):
18471828
), // First Prague block
18481829
(
18491830
Head { number: 20000004, timestamp: 1746612311, ..Default::default() },
1850-
ForkId {
1851-
hash: ForkHash([0xc3, 0x76, 0xcf, 0x8b]),
1852-
next: mainnet::MAINNET_OSAKA_TIMESTAMP,
1853-
},
1854-
),
1855-
// Osaka block
1831+
ForkId { hash: ForkHash([0xc3, 0x76, 0xcf, 0x8b]), next: 0 },
1832+
), // Future Prague block
18561833
(
1857-
Head {
1858-
number: 20000004,
1859-
timestamp: mainnet::MAINNET_OSAKA_TIMESTAMP,
1860-
..Default::default()
1861-
},
1862-
ForkId {
1863-
hash: ForkHash(hex!("0x5167e2a6")),
1864-
next: mainnet::MAINNET_BPO1_TIMESTAMP,
1865-
},
1834+
Head { number: 20000004, timestamp: 2000000000, ..Default::default() },
1835+
ForkId { hash: ForkHash([0xc3, 0x76, 0xcf, 0x8b]), next: 0 },
18661836
),
18671837
],
18681838
);
@@ -2519,8 +2489,10 @@ Post-merge hard forks (timestamp based):
25192489

25202490
#[test]
25212491
fn latest_eth_mainnet_fork_id() {
2522-
// BPO2
2523-
assert_eq!(ForkId { hash: ForkHash(hex!("0xfd414558")), next: 0 }, MAINNET.latest_fork_id())
2492+
assert_eq!(
2493+
ForkId { hash: ForkHash([0xc3, 0x76, 0xcf, 0x8b]), next: 0 },
2494+
MAINNET.latest_fork_id()
2495+
)
25242496
}
25252497

25262498
#[test]

crates/cli/commands/src/test_vectors/compact.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ pub fn type_name<T>() -> String {
283283
// With alloy type transition <https://github.com/paradigmxyz/reth/pull/15768> the types are renamed, we map them here to the original name so that test vector files remain consistent
284284
let name = std::any::type_name::<T>();
285285
match name {
286-
"alloy_consensus::transaction::typed::EthereumTypedTransaction<alloy_consensus::transaction::eip4844::TxEip4844>" => "Transaction".to_string(),
286+
"alloy_consensus::transaction::envelope::EthereumTypedTransaction<alloy_consensus::transaction::eip4844::TxEip4844>" => "Transaction".to_string(),
287287
"alloy_consensus::transaction::envelope::EthereumTxEnvelope<alloy_consensus::transaction::eip4844::TxEip4844>" => "TransactionSigned".to_string(),
288288
name => {
289289
name.split("::").last().unwrap_or(std::any::type_name::<T>()).to_string()

crates/engine/invalid-block-hooks/src/witness.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,7 @@ mod tests {
839839
receipts: vec![],
840840
requests: Requests::default(),
841841
gas_used: 0,
842+
blob_gas_used: 0,
842843
},
843844
};
844845

crates/engine/tree/src/tree/metrics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ mod tests {
314314
receipts: vec![],
315315
requests: Requests::default(),
316316
gas_used: 1000,
317+
blob_gas_used: 0,
317318
},
318319
))
319320
}

crates/engine/tree/src/tree/payload_validator.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ use reth_revm::db::State;
4343
use reth_trie::{updates::TrieUpdates, HashedPostState, KeccakKeyHasher, TrieInput};
4444
use reth_trie_db::DatabaseHashedPostState;
4545
use reth_trie_parallel::root::{ParallelStateRoot, ParallelStateRootError};
46+
use revm::context::Block;
4647
use std::{collections::HashMap, sync::Arc, time::Instant};
4748
use tracing::{debug, debug_span, error, info, trace, warn};
4849

@@ -642,7 +643,7 @@ where
642643
T: PayloadTypes<BuiltPayload: BuiltPayload<Primitives = N>>,
643644
Evm: ConfigureEngineEvm<T::ExecutionData, Primitives = N>,
644645
{
645-
let num_hash = NumHash::new(env.evm_env.block_env.number.to(), env.hash);
646+
let num_hash = NumHash::new(env.evm_env.block_env.number().to(), env.hash);
646647

647648
let span = debug_span!(target: "engine::tree", "execute_block", num = ?num_hash.number, hash = ?num_hash.hash);
648649
let _enter = span.enter();

crates/ethereum/evm/src/build.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use alloc::{sync::Arc, vec::Vec};
22
use alloy_consensus::{
33
proofs::{self, calculate_receipt_root},
4-
Block, BlockBody, BlockHeader, Header, Transaction, TxReceipt, EMPTY_OMMER_ROOT_HASH,
4+
Block, BlockBody, BlockHeader, Header, TxReceipt, EMPTY_OMMER_ROOT_HASH,
55
};
66
use alloy_eips::merge::BEACON_NONCE;
77
use alloy_evm::{block::BlockExecutorFactory, eth::EthBlockExecutionCtx};
@@ -10,6 +10,7 @@ use reth_chainspec::{EthChainSpec, EthereumHardforks};
1010
use reth_evm::execute::{BlockAssembler, BlockAssemblerInput, BlockExecutionError};
1111
use reth_execution_types::BlockExecutionResult;
1212
use reth_primitives_traits::{logs_bloom, Receipt, SignedTransaction};
13+
use revm::context::Block as _;
1314

1415
/// Block builder for Ethereum.
1516
#[derive(Debug, Clone)]
@@ -47,12 +48,12 @@ where
4748
execution_ctx: ctx,
4849
parent,
4950
transactions,
50-
output: BlockExecutionResult { receipts, requests, gas_used },
51+
output: BlockExecutionResult { receipts, requests, gas_used, blob_gas_used },
5152
state_root,
5253
..
5354
} = input;
5455

55-
let timestamp = evm_env.block_env.timestamp.saturating_to();
56+
let timestamp = evm_env.block_env.timestamp().saturating_to();
5657

5758
let transactions_root = proofs::calculate_transaction_root(&transactions);
5859
let receipts_root = calculate_receipt_root(
@@ -73,12 +74,11 @@ where
7374
.then(|| requests.requests_hash());
7475

7576
let mut excess_blob_gas = None;
76-
let mut blob_gas_used = None;
77+
let mut block_blob_gas_used = None;
7778

7879
// only determine cancun fields when active
7980
if self.chain_spec.is_cancun_active_at_timestamp(timestamp) {
80-
blob_gas_used =
81-
Some(transactions.iter().map(|tx| tx.blob_gas_used().unwrap_or_default()).sum());
81+
block_blob_gas_used = Some(*blob_gas_used);
8282
excess_blob_gas = if self.chain_spec.is_cancun_active_at_timestamp(parent.timestamp) {
8383
parent.maybe_next_block_excess_blob_gas(
8484
self.chain_spec.blob_params_at_timestamp(timestamp),
@@ -96,23 +96,23 @@ where
9696
let header = Header {
9797
parent_hash: ctx.parent_hash,
9898
ommers_hash: EMPTY_OMMER_ROOT_HASH,
99-
beneficiary: evm_env.block_env.beneficiary,
99+
beneficiary: evm_env.block_env.beneficiary(),
100100
state_root,
101101
transactions_root,
102102
receipts_root,
103103
withdrawals_root,
104104
logs_bloom,
105105
timestamp,
106-
mix_hash: evm_env.block_env.prevrandao.unwrap_or_default(),
106+
mix_hash: evm_env.block_env.prevrandao().unwrap_or_default(),
107107
nonce: BEACON_NONCE.into(),
108-
base_fee_per_gas: Some(evm_env.block_env.basefee),
109-
number: evm_env.block_env.number.saturating_to(),
110-
gas_limit: evm_env.block_env.gas_limit,
111-
difficulty: evm_env.block_env.difficulty,
108+
base_fee_per_gas: Some(evm_env.block_env.basefee()),
109+
number: evm_env.block_env.number().saturating_to(),
110+
gas_limit: evm_env.block_env.gas_limit(),
111+
difficulty: evm_env.block_env.difficulty(),
112112
gas_used: *gas_used,
113113
extra_data: self.extra_data.clone(),
114114
parent_beacon_block_root: ctx.parent_beacon_block_root,
115-
blob_gas_used,
115+
blob_gas_used: block_blob_gas_used,
116116
excess_blob_gas,
117117
requests_hash,
118118
};

crates/ethereum/evm/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ where
132132
+ FromRecoveredTx<TransactionSigned>
133133
+ FromTxWithEncoded<TransactionSigned>,
134134
Spec = SpecId,
135+
BlockEnv = BlockEnv,
135136
Precompiles = PrecompilesMap,
136137
> + Clone
137138
+ Debug
@@ -154,7 +155,7 @@ where
154155
&self.block_assembler
155156
}
156157

157-
fn evm_env(&self, header: &Header) -> Result<EvmEnv, Self::Error> {
158+
fn evm_env(&self, header: &Header) -> Result<EvmEnv<SpecId>, Self::Error> {
158159
Ok(EvmEnv::for_eth_block(
159160
header,
160161
self.chain_spec(),
@@ -217,6 +218,7 @@ where
217218
+ FromRecoveredTx<TransactionSigned>
218219
+ FromTxWithEncoded<TransactionSigned>,
219220
Spec = SpecId,
221+
BlockEnv = BlockEnv,
220222
Precompiles = PrecompilesMap,
221223
> + Clone
222224
+ Debug

crates/ethereum/evm/src/test_utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ impl<'a, DB: Database, I: Inspector<EthEvmContext<&'a mut State<DB>>>> BlockExec
125125
reqs
126126
}),
127127
gas_used: 0,
128+
blob_gas_used: 0,
128129
};
129130

130131
evm.db_mut().bundle_state = bundle;

0 commit comments

Comments
 (0)