feat: alloy-evm and new revm integration (#14021)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: rakita <rakita@users.noreply.github.com>
This commit is contained in:
Arsenii Kulikov
2025-02-17 23:59:23 +04:00
committed by GitHub
parent bb6dec7ceb
commit 336c3d1fac
142 changed files with 1841 additions and 1929 deletions

View File

@ -11,7 +11,8 @@ use reth_primitives::{NodePrimitives, RecoveredBlock, SealedHeader};
use reth_primitives_traits::{BlockBody, SignedTransaction};
use reth_provider::{BlockExecutionOutput, ChainSpecProvider, StateProviderFactory};
use reth_revm::{
database::StateProviderDatabase, db::states::bundle_state::BundleRetention, StateBuilder,
database::StateProviderDatabase,
db::{states::bundle_state::BundleRetention, StateBuilder},
};
use reth_rpc_api::DebugApiClient;
use reth_tracing::tracing::warn;

View File

@ -50,4 +50,5 @@ op = [
"dep:op-alloy-rpc-types-engine",
"dep:reth-optimism-chainspec",
"reth-payload-primitives/op",
"reth-evm/op",
]

View File

@ -86,6 +86,7 @@ reth-trie-db.workspace = true
# alloy
alloy-rlp.workspace = true
revm-state.workspace = true
assert_matches.workspace = true
criterion.workspace = true

View File

@ -2,13 +2,12 @@
#![allow(missing_docs)]
use alloy_primitives::{B256, U256};
use criterion::{criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion};
use proptest::test_runner::TestRunner;
use rand::Rng;
use revm_primitives::{
Account, AccountInfo, AccountStatus, Address, EvmState, EvmStorage, EvmStorageSlot, HashMap,
B256, U256,
};
use revm_primitives::{Address, HashMap};
use revm_state::{Account, AccountInfo, AccountStatus, EvmState, EvmStorage, EvmStorageSlot};
use std::{hint::black_box, thread};
/// Creates a mock state with the specified number of accounts for benchmarking

View File

@ -3,6 +3,8 @@
#![allow(missing_docs)]
use alloy_consensus::constants::KECCAK_EMPTY;
use alloy_primitives::{Address, B256};
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use proptest::test_runner::TestRunner;
use rand::Rng;
@ -15,10 +17,8 @@ use reth_provider::{
AccountReader, HashingWriter, ProviderFactory,
};
use reth_trie::TrieInput;
use revm_primitives::{
Account as RevmAccount, AccountInfo, AccountStatus, Address, EvmState, EvmStorageSlot, HashMap,
B256, KECCAK_EMPTY, U256,
};
use revm_primitives::{HashMap, U256};
use revm_state::{Account as RevmAccount, AccountInfo, AccountStatus, EvmState, EvmStorageSlot};
use std::{hint::black_box, sync::Arc};
#[derive(Debug, Clone)]

View File

@ -37,7 +37,7 @@ use reth_ethereum_primitives::EthPrimitives;
use reth_evm::{
execute::BlockExecutorProvider,
system_calls::{NoopHook, OnStateHook},
ConfigureEvm, Evm, TransactionEnv,
ConfigureEvm, Evm,
};
use reth_payload_builder::PayloadBuilderHandle;
use reth_payload_primitives::{EngineApiMessageVersion, PayloadBuilderAttributes};
@ -2764,12 +2764,15 @@ where
let state_provider = StateProviderDatabase::new(&state_provider);
let mut evm_env = evm_config.evm_env(&block);
evm_env.cfg_env.disable_nonce_check = true;
// create a new executor and disable nonce checks in the env
let mut evm = evm_config.evm_for_block(state_provider, &block);
let mut evm = evm_config.evm_with_env(state_provider, evm_env);
// create the tx env and reset nonce
let mut tx_env = evm_config.tx_env(&tx, tx.signer());
tx_env.unset_nonce();
let tx_env = evm_config.tx_env(&tx, tx.signer());
// exit early if execution is done
if cancel_execution.is_cancelled() {

View File

@ -11,6 +11,7 @@ use reth_provider::{
providers::ConsistentDbView, BlockReader, DBProvider, DatabaseProviderFactory,
StateCommitmentProvider,
};
use reth_revm::state::EvmState;
use reth_trie::{
hashed_cursor::HashedPostStateCursorFactory,
prefix_set::TriePrefixSetsMut,
@ -27,7 +28,7 @@ use reth_trie_sparse::{
errors::{SparseStateTrieResult, SparseTrieErrorKind},
SparseStateTrie,
};
use revm_primitives::{keccak256, EvmState, B256};
use revm_primitives::{keccak256, B256};
use std::{
collections::{BTreeMap, VecDeque},
sync::{
@ -1190,9 +1191,9 @@ mod tests {
};
use reth_testing_utils::generators::{self, Rng};
use reth_trie::{test_utils::state_root, TrieInput};
use revm_primitives::{
Account as RevmAccount, AccountInfo, AccountStatus, Address, EvmState, EvmStorageSlot,
HashMap, B256, KECCAK_EMPTY, U256,
use revm_primitives::{Address, HashMap, B256, KECCAK_EMPTY, U256};
use revm_state::{
Account as RevmAccount, AccountInfo, AccountStatus, EvmState, EvmStorageSlot,
};
use std::sync::Arc;

View File

@ -25,6 +25,7 @@ reth-revm.workspace = true
reth-provider.workspace = true
reth-ethereum-forks.workspace = true
revm-primitives.workspace = true
revm-database.workspace = true
reth-trie.workspace = true
reth-payload-primitives.workspace = true
@ -53,5 +54,5 @@ tracing.workspace = true
[features]
optimism = [
"revm-primitives/optimism",
"reth-provider/optimism",
]