Skip to content

Commit

Permalink
move revm "patching" to workspace level
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Edison <[email protected]>
  • Loading branch information
greged93 committed Nov 25, 2024
1 parent 5efd244 commit dc00745
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 61 deletions.
26 changes: 12 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ reth-trie-db = { path = "crates/trie/db" }
reth-trie-parallel = { path = "crates/trie/parallel" }

# revm
revm = { version = "18.0.0", features = ["std"], default-features = false }
revm = { package = "reth-scroll-revm", path = "crates/scroll/revm", default-features = false }
revm-inspectors = "0.11.0"
revm-primitives = { version = "14.0.0", features = [
"std",
Expand Down
2 changes: 1 addition & 1 deletion crates/blockchain-tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ parking_lot.workspace = true
assert_matches.workspace = true
alloy-genesis.workspace = true
alloy-consensus.workspace = true
revm = { package = "reth-scroll-revm", path = "../scroll/revm" }
revm.workspace = true

[features]
test-utils = [
Expand Down
4 changes: 2 additions & 2 deletions crates/chain-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ pin-project.workspace = true
alloy-signer = { workspace = true, optional = true }
alloy-signer-local = { workspace = true, optional = true }
rand = { workspace = true, optional = true }
revm = { package = "reth-scroll-revm", path = "../scroll/revm", optional = true }
revm = { workspace = true, optional = true }

[dev-dependencies]
reth-testing-utils.workspace = true
alloy-signer.workspace = true
alloy-signer-local.workspace = true
alloy-consensus.workspace = true
rand.workspace = true
revm = { package = "reth-scroll-revm", path = "../scroll/revm" }
revm.workspace = true

[features]
test-utils = [
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ reth-storage-errors.workspace = true
revm-primitives.workspace = true

# scroll
revm = { package = "reth-scroll-revm", path = "../scroll/revm" }
revm.workspace = true
reth-scroll-execution.workspace = true

# alloy
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/execution-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ reth-trie.workspace = true
reth-primitives-traits.workspace = true

# scroll
revm = { package = "reth-scroll-revm", path = "../../scroll/revm" }
revm.workspace = true

# alloy
alloy-primitives.workspace = true
Expand Down
8 changes: 1 addition & 7 deletions crates/revm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ reth-trie = { workspace = true, optional = true }
reth-primitives-traits.workspace = true

# scroll
reth-scroll-revm = { workspace = true, optional = true }
reth-scroll-execution.workspace = true

# alloy
Expand Down Expand Up @@ -56,7 +55,6 @@ test-utils = [
"revm/test-utils",
"reth-prune-types/test-utils",
"reth-primitives-traits/test-utils",
"reth-scroll-revm?/test-utils",
"reth-scroll-execution/test-utils"
]
serde = [
Expand All @@ -65,9 +63,5 @@ serde = [
"alloy-eips/serde",
"alloy-primitives/serde",
"alloy-consensus/serde",
"reth-scroll-revm?/serde"
]
scroll = [
"reth-primitives/scroll",
"reth-scroll-revm/scroll"
]
scroll = ["reth-primitives/scroll"]
9 changes: 6 additions & 3 deletions crates/revm/src/cached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ use alloy_primitives::{
Address, B256, U256,
};
use core::cell::RefCell;
use revm::primitives::{
db::{Database, DatabaseRef},
AccountInfo, Bytecode,
use revm::{
primitives::{
db::{Database, DatabaseRef},
Bytecode,
},
shared::AccountInfo,
};

/// A container type that caches reads from an underlying [`DatabaseRef`].
Expand Down
6 changes: 1 addition & 5 deletions crates/revm/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ use alloy_primitives::{Address, B256, U256};
use core::ops::{Deref, DerefMut};
use reth_primitives::Account;
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use revm::{
db::DatabaseRef,
primitives::{AccountInfo, Bytecode},
Database,
};
use revm::{db::DatabaseRef, primitives::Bytecode, shared::AccountInfo, Database};

/// A helper trait responsible for providing state necessary for EVM execution.
///
Expand Down
5 changes: 1 addition & 4 deletions crates/revm/src/either.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use alloy_primitives::{Address, B256, U256};
use revm::{
primitives::{AccountInfo, Bytecode},
Database,
};
use revm::{primitives::Bytecode, shared::AccountInfo, Database};

/// An enum type that can hold either of two different [`Database`] implementations.
///
Expand Down
6 changes: 1 addition & 5 deletions crates/revm/src/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ impl ExecutionWitnessRecord {
let hashed_address = keccak256(address);
#[cfg(feature = "scroll")]
let hashed_account = account.account.as_ref().map(|a| {
Into::<reth_scroll_revm::AccountInfo>::into((
a.info.clone(),
statedb.database.context(),
))
.into()
Into::<revm::AccountInfo>::into((a.info.clone(), statedb.database.context())).into()
});
#[cfg(not(feature = "scroll"))]
let hashed_account = account.account.as_ref().map(|a| a.info.clone().into());
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ revm-primitives = { workspace = true, features = ["dev"] }
alloy-eips.workspace = true

# scroll
revm = { package = "reth-scroll-revm", path = "../../scroll/revm" }
revm.workspace = true
reth-scroll-storage = { workspace = true, optional = true }

# rpc
Expand Down
8 changes: 2 additions & 6 deletions crates/scroll/execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@ revm.workspace = true

# scroll
reth-scroll-primitives = { workspace = true, optional = true }
reth-scroll-revm.workspace = true

# misc
auto_impl.workspace = true

[features]
scroll = [
"reth-scroll-primitives",
"reth-scroll-revm/scroll",
]
test-utils = [
"reth-scroll-revm/test-utils",
"revm/test-utils"
"revm/scroll",
]
test-utils = ["revm/test-utils"]
10 changes: 4 additions & 6 deletions crates/scroll/execution/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ pub trait FinalizeExecution<Output> {
fn finalize(&mut self) -> Output;
}

impl<DB: Database + ContextFul> FinalizeExecution<reth_scroll_revm::states::ScrollBundleState>
for State<DB>
{
fn finalize(&mut self) -> reth_scroll_revm::states::ScrollBundleState {
impl<DB: Database + ContextFul> FinalizeExecution<revm::states::ScrollBundleState> for State<DB> {
fn finalize(&mut self) -> revm::states::ScrollBundleState {
let bundle = self.take_bundle();
(bundle, self.database.context()).into()
}
}

impl<DB: Database> FinalizeExecution<reth_scroll_revm::shared::BundleState> for State<DB> {
fn finalize(&mut self) -> reth_scroll_revm::shared::BundleState {
impl<DB: Database> FinalizeExecution<revm::shared::BundleState> for State<DB> {
fn finalize(&mut self) -> revm::shared::BundleState {
self.take_bundle()
}
}
Expand Down
9 changes: 8 additions & 1 deletion crates/scroll/revm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ workspace = true

[dependencies]
# revm
revm.workspace = true
revm = { version = "18.0.0", features = ["std"], default-features = false }

# scroll
reth-scroll-primitives.workspace = true
Expand All @@ -23,6 +23,7 @@ serde = { workspace = true, optional = true }

[features]
default = ["std"]
dev = ["revm/dev"]
arbitrary = [
"revm/arbitrary",
"reth-scroll-primitives/arbitrary"
Expand All @@ -40,3 +41,9 @@ std = [
"revm/std",
"serde/std"
]

blst = ["revm/blst"]
optional_block_gas_limit = ["revm/optional_block_gas_limit"]
optional_eip3607 = ["revm/optional_eip3607"]
optional_no_base_fee = ["revm/optional_no_base_fee"]
secp256k1 = ["revm/secp256k1"]
2 changes: 1 addition & 1 deletion crates/storage/provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ alloy-rpc-types-engine.workspace = true
alloy-consensus.workspace = true

# scroll
revm = { package = "reth-scroll-revm", path = "../../scroll/revm" }
revm.workspace = true
reth-scroll-primitives = { workspace = true, optional = true }

# optimism
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ reth-storage-errors.workspace = true
reth-trie-common.workspace = true
reth-trie.workspace = true

revm = { package = "reth-scroll-revm", path = "../../scroll/revm" }
revm.workspace = true

# alloy
alloy-rlp.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ reth-trie-common.workspace = true

# revm re-export scroll
reth-primitives-traits.workspace = true
revm = { package = "reth-scroll-revm", path = "../../scroll/revm" }
revm.workspace = true

# alloy
alloy-rlp.workspace = true
Expand Down

0 comments on commit dc00745

Please sign in to comment.