Skip to content

Commit 432cb01

Browse files
committed
chore: update reth 2.3
Update reth to v2.3 and add e2e fork tests
1 parent 0e613d1 commit 432cb01

13 files changed

Lines changed: 1619 additions & 989 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -23,100 +23,100 @@ repository = "https://github.com/evstack/ev-reth"
2323
authors = ["Evolve Stack Contributors"]
2424

2525
[workspace.dependencies]
26-
# Reth dependencies - Using v2.2.0 stable
27-
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
28-
reth-cli = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
29-
reth-cli-util = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
30-
reth-rpc-eth-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
31-
reth-tracing-otlp = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
32-
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
33-
reth-node-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
34-
reth-errors = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
35-
reth-trie-db = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
36-
reth-trie-common = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
37-
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
38-
reth-primitives-traits = { version = "0.3.0", default-features = false }
39-
reth-provider = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
40-
reth-storage-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
41-
reth-tracing = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
42-
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", default-features = false }
43-
reth-network = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
44-
reth-network-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
45-
reth-chain-state = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
46-
reth-db-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
47-
reth-ethereum = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
48-
reth-ethereum-cli = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
49-
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
50-
reth-engine-local = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
51-
reth-engine-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
52-
reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
53-
reth-ethereum-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", features = ["serde", "reth-codec"] }
54-
reth-e2e-test-utils = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", default-features = false }
55-
reth-evm = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.2.0" }
56-
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.2.0" }
57-
reth-execution-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
58-
reth-node-core = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
59-
reth-node-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
60-
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
61-
reth-payload-builder-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
62-
reth-payload-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
63-
reth-ethereum-forks = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
64-
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.2.0" }
65-
reth-rpc-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
66-
reth-rpc-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
67-
reth-rpc-engine-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
68-
reth-rpc = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
69-
reth-rpc-convert = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
70-
reth-codecs = { version = "0.3.1", default-features = false }
26+
# Reth dependencies - Using v2.3.0 stable
27+
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
28+
reth-cli = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
29+
reth-cli-util = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
30+
reth-rpc-eth-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
31+
reth-tracing-otlp = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
32+
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
33+
reth-node-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
34+
reth-errors = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
35+
reth-trie-db = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
36+
reth-trie-common = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
37+
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
38+
reth-primitives-traits = { version = "0.4.1", default-features = false }
39+
reth-provider = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
40+
reth-storage-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
41+
reth-tracing = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
42+
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", default-features = false }
43+
reth-network = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
44+
reth-network-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
45+
reth-chain-state = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
46+
reth-db-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
47+
reth-ethereum = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
48+
reth-ethereum-cli = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
49+
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
50+
reth-engine-local = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
51+
reth-engine-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
52+
reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
53+
reth-ethereum-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", features = ["serde", "reth-codec"] }
54+
reth-e2e-test-utils = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", default-features = false }
55+
reth-evm = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.3.0" }
56+
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.3.0" }
57+
reth-execution-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
58+
reth-node-core = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
59+
reth-node-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
60+
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
61+
reth-payload-builder-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
62+
reth-payload-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
63+
reth-ethereum-forks = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
64+
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.3.0" }
65+
reth-rpc-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
66+
reth-rpc-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
67+
reth-rpc-engine-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
68+
reth-rpc = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
69+
reth-rpc-convert = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
70+
reth-codecs = { version = "0.4.1", default-features = false }
7171

7272
ev-revm = { path = "crates/ev-revm" }
7373
ev-primitives = { path = "crates/ev-primitives" }
7474

7575

7676
# Consensus dependencies
77-
reth-consensus = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", default-features = false }
78-
reth-consensus-common = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", default-features = false }
79-
reth-ethereum-consensus = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", default-features = false }
77+
reth-consensus = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", default-features = false }
78+
reth-consensus-common = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", default-features = false }
79+
reth-ethereum-consensus = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", default-features = false }
8080

8181
# Test dependencies
82-
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", default-features = false }
83-
reth-db = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", default-features = false }
84-
reth-tasks = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", default-features = false }
82+
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", default-features = false }
83+
reth-db = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", default-features = false }
84+
reth-tasks = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", default-features = false }
8585

86-
revm = { version = "38.0.0", default-features = false }
86+
revm = { version = "40.0.3", default-features = false }
8787

88-
# Alloy dependencies (aligned to reth v2.2.0)
88+
# Alloy dependencies (aligned to reth v2.3.0)
8989
alloy = { version = "2.0.5", features = [
9090
"contract",
9191
"providers",
9292
"provider-http",
9393
"signers",
9494
"reqwest-rustls-tls",
9595
], default-features = false }
96-
alloy-evm = { version = "0.34.0", default-features = false }
97-
alloy-eips = { version = "2.0.4", default-features = false }
98-
alloy-network = { version = "2.0.4", default-features = false }
99-
alloy-provider = { version = "2.0.4", default-features = false }
100-
alloy-rpc-client = { version = "2.0.4", default-features = false }
101-
alloy-rpc-types = { version = "2.0.4", default-features = false }
102-
alloy-json-rpc = { version = "2.0.4", default-features = false }
103-
alloy-rpc-types-eth = { version = "2.0.4", default-features = false }
104-
alloy-rpc-types-engine = { version = "2.0.4", default-features = false }
105-
alloy-signer = { version = "2.0.4", default-features = false }
106-
alloy-signer-local = { version = "2.0.4", features = ["mnemonic"] }
107-
alloy-serde = { version = "2.0.4", default-features = false }
96+
alloy-evm = { version = "0.36.0", default-features = false }
97+
alloy-eips = { version = "2.0.5", default-features = false }
98+
alloy-network = { version = "2.0.5", default-features = false }
99+
alloy-provider = { version = "2.0.5", default-features = false }
100+
alloy-rpc-client = { version = "2.0.5", default-features = false }
101+
alloy-rpc-types = { version = "2.0.5", default-features = false }
102+
alloy-json-rpc = { version = "2.0.5", default-features = false }
103+
alloy-rpc-types-eth = { version = "2.0.5", default-features = false }
104+
alloy-rpc-types-engine = { version = "2.0.5", default-features = false }
105+
alloy-signer = { version = "2.0.5", default-features = false }
106+
alloy-signer-local = { version = "2.0.5", features = ["mnemonic"] }
107+
alloy-serde = { version = "2.0.5", default-features = false }
108108
alloy-primitives = { version = "1.6.0", default-features = false }
109-
alloy-consensus = { version = "2.0.4", default-features = false }
110-
alloy-consensus-any = { version = "2.0.4", default-features = false }
109+
alloy-consensus = { version = "2.0.5", default-features = false }
110+
alloy-consensus-any = { version = "2.0.5", default-features = false }
111111
alloy-rlp = { version = "0.3.13", default-features = false }
112-
alloy-genesis = { version = "2.0.4", default-features = false }
113-
alloy-rpc-types-txpool = { version = "2.0.4", default-features = false }
112+
alloy-genesis = { version = "2.0.5", default-features = false }
113+
alloy-rpc-types-txpool = { version = "2.0.5", default-features = false }
114114
alloy-sol-types = { version = "1.6.0", default-features = false }
115115

116116
# Utility dependencies
117117
bytes = "1.10.1"
118118

119-
revm-inspectors = "0.39.0"
119+
revm-inspectors = "0.40.1"
120120

121121
# force newer nybbles for const push_unchecked (needed for Rust 1.92+)
122122
nybbles = "0.4.8"

crates/ev-revm/src/factory.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::{
66
use alloy_evm::{
77
eth::{EthBlockExecutorFactory, EthEvmContext, EthEvmFactory},
88
precompiles::{DynPrecompile, Precompile, PrecompilesMap},
9+
revm::context::DBErrorMarker,
910
Database, EvmEnv, EvmFactory,
1011
};
1112
use alloy_primitives::{Address, U256};
@@ -177,8 +178,7 @@ impl EvmFactory for EvEvmFactory<EthEvmFactory> {
177178
EvEvm<EthEvmContext<DB>, I, PrecompilesMap>;
178179
type Context<DB: Database> = EthEvmContext<DB>;
179180
type Tx = TxEnv;
180-
type Error<DBError: std::error::Error + Send + Sync + 'static> =
181-
EVMError<DBError, InvalidTransaction>;
181+
type Error<DBError: DBErrorMarker> = EVMError<DBError, InvalidTransaction>;
182182
type HaltReason = HaltReason;
183183
type Spec = SpecId;
184184
type BlockEnv = BlockEnv;
@@ -351,8 +351,7 @@ impl EvmFactory for EvTxEvmFactory {
351351
EvEvm<EvEvmContext<DB>, I, PrecompilesMap>;
352352
type Context<DB: Database> = EvEvmContext<DB>;
353353
type Tx = EvTxEnv;
354-
type Error<DBError: std::error::Error + Send + Sync + 'static> =
355-
EVMError<DBError, InvalidTransaction>;
354+
type Error<DBError: DBErrorMarker> = EVMError<DBError, InvalidTransaction>;
356355
type HaltReason = HaltReason;
357356
type Spec = SpecId;
358357
type BlockEnv = BlockEnv;

crates/ev-revm/src/handler.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,11 @@ where
244244

245245
let base_tx = evm.ctx().tx().clone();
246246
let tx_gas_limit = base_tx.gas_limit();
247-
let (mut remaining_gas, mut reservoir) = init_and_floor_gas.initial_gas_and_reservoir(
248-
tx_gas_limit,
249-
evm.ctx().cfg().tx_gas_limit_cap(),
250-
evm.ctx().cfg().is_amsterdam_eip8037_enabled(),
251-
);
247+
let (mut remaining_gas, mut reservoir) = init_and_floor_gas
248+
.initial_gas_and_reservoir(tx_gas_limit, evm.ctx().cfg().tx_gas_limit_cap());
252249
let checkpoint = evm.ctx_mut().journal_mut().checkpoint();
253250
let mut total_refunded: i64 = 0;
254-
let mut total_state_gas_spent: u64 = 0;
251+
let mut total_state_gas_spent: i64 = 0;
255252
let mut last_result: Option<FrameResult> = None;
256253

257254
// Execute each call in the batch sequentially.
@@ -323,9 +320,11 @@ where
323320
fn last_frame_result(
324321
&mut self,
325322
evm: &mut Self::Evm,
323+
original_reservoir: u64,
326324
frame_result: &mut <FRAME as FrameTr>::FrameResult,
327325
) -> Result<(), Self::Error> {
328-
self.inner.last_frame_result(evm, frame_result)
326+
self.inner
327+
.last_frame_result(evm, original_reservoir, frame_result)
329328
}
330329

331330
fn run_exec_loop(
@@ -520,7 +519,7 @@ fn validate_batch_initial_tx_gas<Tx: Transaction>(
520519
for call in calls {
521520
let call_gas =
522521
calculate_initial_tx_gas(spec, call.input.as_ref(), call.to.is_create(), 0, 0, 0);
523-
initial_total_gas = initial_total_gas.saturating_add(call_gas.initial_total_gas);
522+
initial_total_gas = initial_total_gas.saturating_add(call_gas.initial_total_gas());
524523
initial_state_gas = initial_state_gas.saturating_add(call_gas.initial_state_gas);
525524
floor_gas = floor_gas.saturating_add(call_gas.floor_gas);
526525
}
@@ -586,22 +585,23 @@ fn validate_batch_initial_tx_gas<Tx: Transaction>(
586585
}
587586
}
588587

589-
let mut gas =
590-
InitialAndFloorGas::new_with_state_gas(initial_total_gas, initial_state_gas, floor_gas);
591-
gas.eip7702_reservoir_refund = 0;
592-
Ok(gas)
588+
Ok(InitialAndFloorGas::new_with_state_gas(
589+
initial_total_gas,
590+
initial_state_gas,
591+
floor_gas,
592+
))
593593
}
594594

595595
fn finalize_batch_gas(
596596
frame_result: &mut FrameResult,
597597
tx_gas_limit: u64,
598598
remaining_gas: u64,
599599
reservoir: u64,
600-
state_gas_spent: u64,
600+
state_gas_spent: i64,
601601
refund: i64,
602602
) {
603603
let instruction_result = frame_result.interpreter_result().result;
604-
let mut gas = Gas::new_spent(tx_gas_limit);
604+
let mut gas = Gas::new_spent_with_reservoir(tx_gas_limit, reservoir);
605605
if instruction_result.is_ok_or_revert() {
606606
gas.erase_cost(remaining_gas);
607607
}
@@ -611,7 +611,7 @@ fn finalize_batch_gas(
611611
gas.set_reservoir(reservoir);
612612
} else {
613613
gas.set_state_gas_spent(0);
614-
gas.set_reservoir(reservoir.saturating_add(state_gas_spent));
614+
gas.set_reservoir(reservoir.saturating_add_signed(state_gas_spent));
615615
}
616616
*frame_result.gas_mut() = gas;
617617
}
@@ -872,12 +872,12 @@ mod tests {
872872
.expect("batch gas should validate");
873873

874874
let expected_initial = gas_call_1
875-
.initial_total_gas
876-
.saturating_add(gas_call_2.initial_total_gas)
875+
.initial_total_gas()
876+
.saturating_add(gas_call_2.initial_total_gas())
877877
.saturating_add(access_list_cost);
878878
let expected_floor = gas_call_1.floor_gas.saturating_add(gas_call_2.floor_gas);
879879

880-
assert_eq!(result.initial_total_gas, expected_initial);
880+
assert_eq!(result.initial_total_gas(), expected_initial);
881881
assert_eq!(result.floor_gas, expected_floor);
882882
}
883883

@@ -1538,7 +1538,7 @@ mod tests {
15381538
}
15391539

15401540
fn make_call_frame(gas_used: u64) -> FrameResult {
1541-
let gas = Gas::new_spent(gas_used);
1541+
let gas = Gas::new_spent_with_reservoir(gas_used, 0);
15421542
let interpreter_result =
15431543
InterpreterResult::new(InstructionResult::Return, Bytes::new(), gas);
15441544
FrameResult::Call(CallOutcome::new(interpreter_result, 0..0))

crates/evolve/src/consensus.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Evolve custom consensus implementation that allows same timestamps across blocks.
22
3+
use alloy_primitives::B256;
34
use ev_primitives::{Block, BlockBody, EvPrimitives, Receipt};
45
use reth_chainspec::ChainSpec;
56
use reth_consensus::{Consensus, ConsensusError, FullConsensus, HeaderValidator, ReceiptRootBloom};
@@ -120,7 +121,14 @@ impl FullConsensus<EvPrimitives> for EvolveConsensus {
120121
block: &RecoveredBlock<Block>,
121122
result: &BlockExecutionResult<Receipt>,
122123
receipt_root_bloom: Option<ReceiptRootBloom>,
124+
block_access_list_hash: Option<B256>,
123125
) -> Result<(), ConsensusError> {
124-
<EthBeaconConsensus<ChainSpec> as FullConsensus<EvPrimitives>>::validate_block_post_execution(&self.inner, block, result, receipt_root_bloom)
126+
<EthBeaconConsensus<ChainSpec> as FullConsensus<EvPrimitives>>::validate_block_post_execution(
127+
&self.inner,
128+
block,
129+
result,
130+
receipt_root_bloom,
131+
block_access_list_hash,
132+
)
125133
}
126134
}

crates/node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ alloy-consensus-any.workspace = true
6464
alloy-evm.workspace = true
6565
alloy-genesis.workspace = true
6666
alloy-network.workspace = true
67+
alloy-rlp.workspace = true
6768
c-kzg = "2.1.6"
6869

6970
# Core dependencies

0 commit comments

Comments
 (0)