Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] feat: integrate new revm #14115

Draft
wants to merge 7 commits into
base: klkvr/alloy-evm
Choose a base branch
from
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
329 changes: 273 additions & 56 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 17 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -420,15 +420,24 @@ reth-trie-sparse = { path = "crates/trie/sparse" }
reth-zstd-compressors = { path = "crates/storage/zstd-compressors", default-features = false }

# revm
revm = { version = "19.4.0", default-features = false }
revm-primitives = { version = "15.1.0", default-features = false }
revm-interpreter = { version = "15.0.0", default-features = false }
revm-inspectors = "0.14.1"
revm = { git = "https://github.com/bluealloy/revm", rev = "1d95779" }
revm-bytecode = { git = "https://github.com/bluealloy/revm", rev = "1d95779" }
revm-database = { git = "https://github.com/bluealloy/revm", rev = "1d95779" }
revm-state = { git = "https://github.com/bluealloy/revm", rev = "1d95779" }
revm-primitives = { git = "https://github.com/bluealloy/revm", rev = "1d95779" }
revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "1d95779" }
revm-inspector = { git = "https://github.com/bluealloy/revm", rev = "1d95779" }
revm-context = { git = "https://github.com/bluealloy/revm", rev = "1d95779" }
revm-context-interface = { git = "https://github.com/bluealloy/revm", rev = "1d95779" }
revm-database-interface = { git = "https://github.com/bluealloy/revm", rev = "1d95779" }
revm-specification = { git = "https://github.com/bluealloy/revm", rev = "1d95779" }
revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "2b1a434" }

# eth
alloy-chains = { version = "0.1.32", default-features = false }
alloy-dyn-abi = "0.8.15"
alloy-eip2124 = { version = "0.1.0", default-features = false }
alloy-evm = { path = "../evm/crates/evm" }
alloy-primitives = { version = "0.8.15", default-features = false, features = ["map-foldhash"] }
alloy-rlp = { version = "0.3.10", default-features = false }
alloy-sol-types = "0.8.15"
Expand Down Expand Up @@ -464,6 +473,7 @@ alloy-transport-ipc = { version = "0.9.2", default-features = false }
alloy-transport-ws = { version = "0.9.2", default-features = false }

# op
alloy-op-evm = { path = "../evm/crates/op-evm", default-features = false }
op-alloy-rpc-types = { version = "0.9.6", default-features = false }
op-alloy-rpc-types-engine = { version = "0.9.6", default-features = false }
op-alloy-network = { version = "0.9.6", default-features = false }
Expand Down Expand Up @@ -602,7 +612,9 @@ snmalloc-rs = { version = "0.3.7", features = ["build_cc"] }
# See: https://github.com/eira-fransham/crunchy/issues/13
crunchy = "=0.2.2"

# [patch.crates-io]
[patch.'https://github.com/paradigmxyz/revm-inspectors']
revm-inspectors = { git = "https://github.com/klkvr/evm-inspectors", rev = "fde5bf3" }

# alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
Expand Down
3 changes: 2 additions & 1 deletion bin/reth/src/commands/debug_cmd/build_block.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Command for debugging block building.
use crate::primitives::kzg::KzgSettings;
use alloy_consensus::{BlockHeader, TxEip4844};
use alloy_eips::{
eip2718::Encodable2718,
Expand Down Expand Up @@ -34,7 +35,7 @@ use reth_provider::{
BlockHashReader, BlockReader, BlockWriter, ChainSpecProvider, ProviderFactory,
StageCheckpointReader, StateProviderFactory,
};
use reth_revm::{cached::CachedReads, database::StateProviderDatabase, primitives::KzgSettings};
use reth_revm::{cached::CachedReads, database::StateProviderDatabase};
use reth_stages::StageId;
use reth_transaction_pool::{
blobstore::InMemoryBlobStore, BlobStore, EthPooledTransaction, PoolConfig, TransactionOrigin,
Expand Down
5 changes: 3 additions & 2 deletions crates/chain-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ reth-trie.workspace = true
alloy-eips.workspace = true
alloy-primitives.workspace = true
alloy-consensus.workspace = true
revm.workspace = true
revm-database.workspace = true
revm-state = { workspace = true, optional = true }

# async
tokio = { workspace = true, default-features = false, features = ["sync", "macros"] }
Expand Down Expand Up @@ -59,9 +60,9 @@ test-utils = [
"alloy-signer",
"alloy-signer-local",
"rand",
"revm-state",
"reth-chainspec/test-utils",
"reth-primitives/test-utils",
"reth-primitives-traits/test-utils",
"reth-trie/test-utils",
"revm/test-utils",
]
2 changes: 1 addition & 1 deletion crates/chain-state/src/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ mod tests {
}

impl HashedPostStateProvider for MockStateProvider {
fn hashed_post_state(&self, _bundle_state: &revm::db::BundleState) -> HashedPostState {
fn hashed_post_state(&self, _bundle_state: &revm_database::BundleState) -> HashedPostState {
HashedPostState::default()
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/chain-state/src/memory_overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use reth_trie::{
updates::TrieUpdates, AccountProof, HashedPostState, HashedStorage, MultiProof,
MultiProofTargets, StorageMultiProof, TrieInput,
};
use revm::db::BundleState;
use revm_database::BundleState;
use std::sync::OnceLock;

/// A state provider that stores references to in-memory blocks along with their state as well as a
Expand Down
3 changes: 2 additions & 1 deletion crates/chain-state/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ use reth_primitives_traits::{
};
use reth_storage_api::NodePrimitivesProvider;
use reth_trie::{root::state_root_unhashed, updates::TrieUpdates, HashedPostState};
use revm::{db::BundleState, primitives::AccountInfo};
use revm_database::BundleState;
use revm_state::AccountInfo;
use std::{
collections::HashMap,
ops::Range,
Expand Down
3 changes: 2 additions & 1 deletion crates/engine/invalid-block-hooks/src/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions crates/engine/tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions crates/engine/tree/benches/channel_perf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions crates/engine/tree/benches/state_root_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)]
Expand Down
9 changes: 5 additions & 4 deletions crates/engine/tree/src/tree/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use reth_provider::{
providers::ConsistentDbView, BlockReader, DBProvider, DatabaseProviderFactory,
StateCommitmentProvider,
};
use reth_revm::state::EvmState;
use reth_trie::{
hashed_cursor::HashedPostStateCursorFactory,
prefix_set::TriePrefixSetsMut,
Expand All @@ -25,7 +26,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::{
Expand Down Expand Up @@ -928,9 +929,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;

Expand Down
3 changes: 2 additions & 1 deletion crates/engine/util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -53,5 +54,5 @@ tracing.workspace = true

[features]
optimism = [
"revm-primitives/optimism",
"reth-provider/optimism",
]
7 changes: 1 addition & 6 deletions crates/ethereum/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@ reth-ethereum-consensus.workspace = true
reth-consensus.workspace = true

# Ethereum
revm-primitives.workspace = true
reth-primitives-traits.workspace = true

# Alloy
alloy-primitives.workspace = true
alloy-eips.workspace = true
alloy-evm.workspace = true
alloy-sol-types.workspace = true
alloy-consensus.workspace = true

# Misc
derive_more.workspace = true

[dev-dependencies]
reth-testing-utils.workspace = true
reth-evm = { workspace = true, features = ["test-utils"] }
Expand All @@ -53,11 +50,9 @@ std = [
"alloy-eips/std",
"alloy-genesis/std",
"alloy-primitives/std",
"revm-primitives/std",
"secp256k1/std",
"reth-ethereum-forks/std",
"serde_json/std",
"reth-primitives-traits/std",
"reth-chainspec/std",
"derive_more/std",
]
Loading
Loading