Skip to content
Draft
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
1,889 changes: 1,058 additions & 831 deletions Cargo.lock

Large diffs are not rendered by default.

140 changes: 70 additions & 70 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,100 +23,100 @@ repository = "https://github.com/evstack/ev-reth"
authors = ["Evolve Stack Contributors"]

[workspace.dependencies]
# Reth dependencies - Using v2.2.0 stable
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-cli = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-rpc-eth-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-tracing-otlp = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-errors = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-trie-db = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-trie-common = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-primitives-traits = { version = "0.3.0", default-features = false }
reth-provider = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-tracing = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", default-features = false }
reth-network = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-network-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-db-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-ethereum = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-ethereum-cli = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-engine-local = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-engine-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-ethereum-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", features = ["serde", "reth-codec"] }
reth-e2e-test-utils = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0", default-features = false }
reth-evm = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.2.0" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.2.0" }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-node-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-payload-builder-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-payload-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-ethereum-forks = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.2.0" }
reth-rpc-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-rpc-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-rpc-engine-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-rpc = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-rpc-convert = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.2.0" }
reth-codecs = { version = "0.3.1", default-features = false }
# Reth dependencies - Using v2.3.0 stable
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-cli = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-rpc-eth-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-tracing-otlp = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-errors = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-trie-db = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-trie-common = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-primitives-traits = { version = "0.4.1", default-features = false }
reth-provider = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-tracing = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", default-features = false }
reth-network = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-network-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-db-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-ethereum = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-ethereum-cli = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-engine-local = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-engine-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-ethereum-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", features = ["serde", "reth-codec"] }
reth-e2e-test-utils = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0", default-features = false }
reth-evm = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.3.0" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.3.0" }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-node-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-payload-builder-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-payload-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-ethereum-forks = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", default-features = false, tag = "v2.3.0" }
reth-rpc-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-rpc-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-rpc-engine-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-rpc = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-rpc-convert = { git = "https://github.com/paradigmxyz/reth.git", tag = "v2.3.0" }
reth-codecs = { version = "0.4.1", default-features = false }

ev-revm = { path = "crates/ev-revm" }
ev-primitives = { path = "crates/ev-primitives" }


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

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

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

# Alloy dependencies (aligned to reth v2.2.0)
# Alloy dependencies (aligned to reth v2.3.0)
alloy = { version = "2.0.5", features = [
"contract",
"providers",
"provider-http",
"signers",
"reqwest-rustls-tls",
], default-features = false }
alloy-evm = { version = "0.34.0", default-features = false }
alloy-eips = { version = "2.0.4", default-features = false }
alloy-network = { version = "2.0.4", default-features = false }
alloy-provider = { version = "2.0.4", default-features = false }
alloy-rpc-client = { version = "2.0.4", default-features = false }
alloy-rpc-types = { version = "2.0.4", default-features = false }
alloy-json-rpc = { version = "2.0.4", default-features = false }
alloy-rpc-types-eth = { version = "2.0.4", default-features = false }
alloy-rpc-types-engine = { version = "2.0.4", default-features = false }
alloy-signer = { version = "2.0.4", default-features = false }
alloy-signer-local = { version = "2.0.4", features = ["mnemonic"] }
alloy-serde = { version = "2.0.4", default-features = false }
alloy-evm = { version = "0.36.0", default-features = false }
alloy-eips = { version = "2.0.5", default-features = false }
alloy-network = { version = "2.0.5", default-features = false }
alloy-provider = { version = "2.0.5", default-features = false }
alloy-rpc-client = { version = "2.0.5", default-features = false }
alloy-rpc-types = { version = "2.0.5", default-features = false }
alloy-json-rpc = { version = "2.0.5", default-features = false }
alloy-rpc-types-eth = { version = "2.0.5", default-features = false }
alloy-rpc-types-engine = { version = "2.0.5", default-features = false }
alloy-signer = { version = "2.0.5", default-features = false }
alloy-signer-local = { version = "2.0.5", features = ["mnemonic"] }
alloy-serde = { version = "2.0.5", default-features = false }
alloy-primitives = { version = "1.6.0", default-features = false }
alloy-consensus = { version = "2.0.4", default-features = false }
alloy-consensus-any = { version = "2.0.4", default-features = false }
alloy-consensus = { version = "2.0.5", default-features = false }
alloy-consensus-any = { version = "2.0.5", default-features = false }
alloy-rlp = { version = "0.3.13", default-features = false }
alloy-genesis = { version = "2.0.4", default-features = false }
alloy-rpc-types-txpool = { version = "2.0.4", default-features = false }
alloy-genesis = { version = "2.0.5", default-features = false }
alloy-rpc-types-txpool = { version = "2.0.5", default-features = false }
alloy-sol-types = { version = "1.6.0", default-features = false }

# Utility dependencies
bytes = "1.10.1"

revm-inspectors = "0.39.0"
revm-inspectors = "0.40.1"

# force newer nybbles for const push_unchecked (needed for Rust 1.92+)
nybbles = "0.4.8"
Expand Down
7 changes: 3 additions & 4 deletions crates/ev-revm/src/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
use alloy_evm::{
eth::{EthBlockExecutorFactory, EthEvmContext, EthEvmFactory},
precompiles::{DynPrecompile, Precompile, PrecompilesMap},
revm::context::DBErrorMarker,
Database, EvmEnv, EvmFactory,
};
use alloy_primitives::{Address, U256};
Expand Down Expand Up @@ -177,8 +178,7 @@ impl EvmFactory for EvEvmFactory<EthEvmFactory> {
EvEvm<EthEvmContext<DB>, I, PrecompilesMap>;
type Context<DB: Database> = EthEvmContext<DB>;
type Tx = TxEnv;
type Error<DBError: std::error::Error + Send + Sync + 'static> =
EVMError<DBError, InvalidTransaction>;
type Error<DBError: DBErrorMarker> = EVMError<DBError, InvalidTransaction>;
type HaltReason = HaltReason;
type Spec = SpecId;
type BlockEnv = BlockEnv;
Expand Down Expand Up @@ -351,8 +351,7 @@ impl EvmFactory for EvTxEvmFactory {
EvEvm<EvEvmContext<DB>, I, PrecompilesMap>;
type Context<DB: Database> = EvEvmContext<DB>;
type Tx = EvTxEnv;
type Error<DBError: std::error::Error + Send + Sync + 'static> =
EVMError<DBError, InvalidTransaction>;
type Error<DBError: DBErrorMarker> = EVMError<DBError, InvalidTransaction>;
type HaltReason = HaltReason;
type Spec = SpecId;
type BlockEnv = BlockEnv;
Expand Down
38 changes: 19 additions & 19 deletions crates/ev-revm/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,11 @@ where

let base_tx = evm.ctx().tx().clone();
let tx_gas_limit = base_tx.gas_limit();
let (mut remaining_gas, mut reservoir) = init_and_floor_gas.initial_gas_and_reservoir(
tx_gas_limit,
evm.ctx().cfg().tx_gas_limit_cap(),
evm.ctx().cfg().is_amsterdam_eip8037_enabled(),
);
let (mut remaining_gas, mut reservoir) = init_and_floor_gas
.initial_gas_and_reservoir(tx_gas_limit, evm.ctx().cfg().tx_gas_limit_cap());
let checkpoint = evm.ctx_mut().journal_mut().checkpoint();
let mut total_refunded: i64 = 0;
let mut total_state_gas_spent: u64 = 0;
let mut total_state_gas_spent: i64 = 0;
let mut last_result: Option<FrameResult> = None;

// Execute each call in the batch sequentially.
Expand Down Expand Up @@ -323,9 +320,11 @@ where
fn last_frame_result(
&mut self,
evm: &mut Self::Evm,
original_reservoir: u64,
frame_result: &mut <FRAME as FrameTr>::FrameResult,
) -> Result<(), Self::Error> {
self.inner.last_frame_result(evm, frame_result)
self.inner
.last_frame_result(evm, original_reservoir, frame_result)
}

fn run_exec_loop(
Expand Down Expand Up @@ -520,7 +519,7 @@ fn validate_batch_initial_tx_gas<Tx: Transaction>(
for call in calls {
let call_gas =
calculate_initial_tx_gas(spec, call.input.as_ref(), call.to.is_create(), 0, 0, 0);
initial_total_gas = initial_total_gas.saturating_add(call_gas.initial_total_gas);
initial_total_gas = initial_total_gas.saturating_add(call_gas.initial_total_gas());
initial_state_gas = initial_state_gas.saturating_add(call_gas.initial_state_gas);
floor_gas = floor_gas.saturating_add(call_gas.floor_gas);
}
Expand Down Expand Up @@ -586,22 +585,23 @@ fn validate_batch_initial_tx_gas<Tx: Transaction>(
}
}

let mut gas =
InitialAndFloorGas::new_with_state_gas(initial_total_gas, initial_state_gas, floor_gas);
gas.eip7702_reservoir_refund = 0;
Ok(gas)
Ok(InitialAndFloorGas::new_with_state_gas(
initial_total_gas,
initial_state_gas,
floor_gas,
))
}

fn finalize_batch_gas(
frame_result: &mut FrameResult,
tx_gas_limit: u64,
remaining_gas: u64,
reservoir: u64,
state_gas_spent: u64,
state_gas_spent: i64,
refund: i64,
) {
let instruction_result = frame_result.interpreter_result().result;
let mut gas = Gas::new_spent(tx_gas_limit);
let mut gas = Gas::new_spent_with_reservoir(tx_gas_limit, reservoir);
if instruction_result.is_ok_or_revert() {
gas.erase_cost(remaining_gas);
}
Expand All @@ -611,7 +611,7 @@ fn finalize_batch_gas(
gas.set_reservoir(reservoir);
} else {
gas.set_state_gas_spent(0);
gas.set_reservoir(reservoir.saturating_add(state_gas_spent));
gas.set_reservoir(reservoir.saturating_add_signed(state_gas_spent));
}
*frame_result.gas_mut() = gas;
}
Expand Down Expand Up @@ -872,12 +872,12 @@ mod tests {
.expect("batch gas should validate");

let expected_initial = gas_call_1
.initial_total_gas
.saturating_add(gas_call_2.initial_total_gas)
.initial_total_gas()
.saturating_add(gas_call_2.initial_total_gas())
.saturating_add(access_list_cost);
let expected_floor = gas_call_1.floor_gas.saturating_add(gas_call_2.floor_gas);

assert_eq!(result.initial_total_gas, expected_initial);
assert_eq!(result.initial_total_gas(), expected_initial);
assert_eq!(result.floor_gas, expected_floor);
}

Expand Down Expand Up @@ -1538,7 +1538,7 @@ mod tests {
}

fn make_call_frame(gas_used: u64) -> FrameResult {
let gas = Gas::new_spent(gas_used);
let gas = Gas::new_spent_with_reservoir(gas_used, 0);
let interpreter_result =
InterpreterResult::new(InstructionResult::Return, Bytes::new(), gas);
FrameResult::Call(CallOutcome::new(interpreter_result, 0..0))
Expand Down
10 changes: 9 additions & 1 deletion crates/evolve/src/consensus.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Evolve custom consensus implementation that allows same timestamps across blocks.

use alloy_primitives::B256;
use ev_primitives::{Block, BlockBody, EvPrimitives, Receipt};
use reth_chainspec::ChainSpec;
use reth_consensus::{Consensus, ConsensusError, FullConsensus, HeaderValidator, ReceiptRootBloom};
Expand Down Expand Up @@ -120,7 +121,14 @@ impl FullConsensus<EvPrimitives> for EvolveConsensus {
block: &RecoveredBlock<Block>,
result: &BlockExecutionResult<Receipt>,
receipt_root_bloom: Option<ReceiptRootBloom>,
block_access_list_hash: Option<B256>,
) -> Result<(), ConsensusError> {
<EthBeaconConsensus<ChainSpec> as FullConsensus<EvPrimitives>>::validate_block_post_execution(&self.inner, block, result, receipt_root_bloom)
<EthBeaconConsensus<ChainSpec> as FullConsensus<EvPrimitives>>::validate_block_post_execution(
&self.inner,
block,
result,
receipt_root_bloom,
block_access_list_hash,
)
}
}
1 change: 1 addition & 0 deletions crates/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ alloy-consensus-any.workspace = true
alloy-evm.workspace = true
alloy-genesis.workspace = true
alloy-network.workspace = true
alloy-rlp.workspace = true
c-kzg = "2.1.6"

# Core dependencies
Expand Down
Loading
Loading