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

feat: avoid zstd dependency in reth-evm, reth-evm-ethereum and reth-optimism-evm #14356

Merged
merged 3 commits into from
Feb 10, 2025
Merged
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
5 changes: 2 additions & 3 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions crates/ethereum/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ workspace = true
reth-chainspec.workspace = true
reth-ethereum-forks.workspace = true
reth-evm.workspace = true
reth-primitives = { workspace = true, features = ["reth-codec"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this change sufficient to remove zstd from the dep graph?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately no, we still have this:

➜  cargo tree -i zstd
zstd v0.13.2
├── reth-nippy-jar v1.1.5 (/home/aurel/dev/reth/crates/storage/nippy-jar)
│   └── reth-db v1.1.5 (/home/aurel/dev/reth/crates/storage/db)
│       ├── reth-storage-api v1.1.5 (/home/aurel/dev/reth/crates/storage/storage-api)
│       │   └── reth-revm v1.1.5 (/home/aurel/dev/reth/crates/revm)
│       │       ├── reth-evm v1.1.5 (/home/aurel/dev/reth/crates/evm)
│       │       │   ├── reth-evm-ethereum v1.1.5 (/home/aurel/dev/reth/crates/ethereum/evm)
│       │       │   │   ├── rsp-client-eth v0.0.0 (/home/aurel/dev/rsp/bin/client-eth)
│       │       │   │   └── rsp-client-executor v0.1.0 (/home/aurel/dev/rsp/crates/executor/client)
│       │       │   │       └── rsp-client-eth v0.0.0 (/home/aurel/dev/rsp/bin/client-eth)
│       │       │   ├── reth-optimism-evm v1.1.5 (/home/aurel/dev/reth/crates/optimism/evm)
│       │       │   │   └── rsp-client-executor v0.1.0 (/home/aurel/dev/rsp/crates/executor/client) (*)
│       │       │   └── rsp-client-executor v0.1.0 (/home/aurel/dev/rsp/crates/executor/client) (*)
│       │       ├── reth-evm-ethereum v1.1.5 (/home/aurel/dev/reth/crates/ethereum/evm) (*)
│       │       └── reth-optimism-evm v1.1.5 (/home/aurel/dev/reth/crates/optimism/evm) (*)
│       └── reth-trie-db v1.1.5 (/home/aurel/dev/reth/crates/trie/db)
│           └── reth-storage-api v1.1.5 (/home/aurel/dev/reth/crates/storage/storage-api) (*)
└── reth-zstd-compressors v1.1.5 (/home/aurel/dev/reth/crates/storage/zstd-compressors)
    └── reth-ethereum-primitives v1.1.5 (/home/aurel/dev/reth/crates/ethereum/primitives)
        ├── reth-primitives v1.1.5 (/home/aurel/dev/reth/crates/primitives)
        │   ├── reth-db v1.1.5 (/home/aurel/dev/reth/crates/storage/db) (*)
        │   ├── reth-db-api v1.1.5 (/home/aurel/dev/reth/crates/storage/db-api)
        │   │   ├── reth-db v1.1.5 (/home/aurel/dev/reth/crates/storage/db) (*)
        │   │   ├── reth-storage-api v1.1.5 (/home/aurel/dev/reth/crates/storage/storage-api) (*)
        │   │   └── reth-trie-db v1.1.5 (/home/aurel/dev/reth/crates/trie/db) (*)
        │   ├── reth-ethereum-consensus v1.1.5 (/home/aurel/dev/reth/crates/ethereum/consensus)
        │   │   ├── reth-evm-ethereum v1.1.5 (/home/aurel/dev/reth/crates/ethereum/evm) (*)
        │   │   └── rsp-client-executor v0.1.0 (/home/aurel/dev/rsp/crates/executor/client) (*)
        │   ├── reth-evm v1.1.5 (/home/aurel/dev/reth/crates/evm) (*)
        │   ├── reth-evm-ethereum v1.1.5 (/home/aurel/dev/reth/crates/ethereum/evm) (*)
        │   ├── reth-execution-types v1.1.5 (/home/aurel/dev/reth/crates/evm/execution-types)
        │   │   ├── reth-evm v1.1.5 (/home/aurel/dev/reth/crates/evm) (*)
        │   │   ├── reth-optimism-evm v1.1.5 (/home/aurel/dev/reth/crates/optimism/evm) (*)
        │   │   ├── reth-storage-api v1.1.5 (/home/aurel/dev/reth/crates/storage/storage-api) (*)
        │   │   ├── rsp-client-executor v0.1.0 (/home/aurel/dev/rsp/crates/executor/client) (*)
        │   │   └── rsp-mpt v0.1.0 (/home/aurel/dev/rsp/crates/mpt)
        │   │       └── rsp-client-executor v0.1.0 (/home/aurel/dev/rsp/crates/executor/client) (*)
        │   ├── reth-optimism-consensus v1.1.5 (/home/aurel/dev/reth/crates/optimism/consensus)
        │   │   ├── reth-optimism-evm v1.1.5 (/home/aurel/dev/reth/crates/optimism/evm) (*)
        │   │   └── rsp-client-executor v0.1.0 (/home/aurel/dev/rsp/crates/executor/client) (*)
        │   ├── reth-optimism-evm v1.1.5 (/home/aurel/dev/reth/crates/optimism/evm) (*)
        │   ├── reth-storage-api v1.1.5 (/home/aurel/dev/reth/crates/storage/storage-api) (*)
        │   ├── rsp-client-eth v0.0.0 (/home/aurel/dev/rsp/bin/client-eth)
        │   ├── rsp-client-executor v0.1.0 (/home/aurel/dev/rsp/crates/executor/client) (*)
        │   ├── rsp-mpt v0.1.0 (/home/aurel/dev/rsp/crates/mpt) (*)
        │   ├── rsp-primitives v0.1.0 (/home/aurel/dev/rsp/crates/primitives)
        │   │   ├── rsp-client-eth v0.0.0 (/home/aurel/dev/rsp/bin/client-eth)
        │   │   ├── rsp-mpt v0.1.0 (/home/aurel/dev/rsp/crates/mpt) (*)
        │   │   └── rsp-witness-db v0.1.0 (/home/aurel/dev/rsp/crates/storage/witness-db)
        │   │       └── rsp-client-executor v0.1.0 (/home/aurel/dev/rsp/crates/executor/client) (*)
        │   └── rsp-witness-db v0.1.0 (/home/aurel/dev/rsp/crates/storage/witness-db) (*)
        ├── reth-revm v1.1.5 (/home/aurel/dev/reth/crates/revm) (*)
        └── rsp-client-executor v0.1.0 (/home/aurel/dev/rsp/crates/executor/client) (*)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah that's annyoing, the storage-api depends on trie-db which pulls in the entire db stuff...

will work on that separately

reth-revm.workspace = true
reth-primitives.workspace = true
reth-ethereum-consensus.workspace = true
reth-consensus.workspace = true
revm.workspace = true

# Ethereum
revm-primitives.workspace = true
Expand Down Expand Up @@ -53,6 +53,7 @@ std = [
"alloy-eips/std",
"alloy-genesis/std",
"alloy-primitives/std",
"revm/std",
"revm-primitives/std",
"secp256k1/std",
"reth-ethereum-forks/std",
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use reth_evm::{
};
use reth_primitives::{EthPrimitives, Receipt, RecoveredBlock};
use reth_primitives_traits::{BlockBody, SignedTransaction};
use reth_revm::db::State;
use revm::db::State;
use revm_primitives::{db::DatabaseCommit, ResultAndState};

/// Factory for [`EthExecutionStrategy`].
Expand Down
8 changes: 4 additions & 4 deletions crates/ethereum/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use reth_chainspec::{ChainSpec, EthChainSpec, MAINNET};
use reth_evm::{env::EvmEnv, ConfigureEvm, ConfigureEvmEnv, Database, Evm, NextBlockEnvAttributes};
use reth_primitives::TransactionSigned;
use reth_primitives_traits::transaction::execute::FillTxEnv;
use reth_revm::{inspector_handle_register, EvmBuilder};
use revm::{inspector_handle_register, EvmBuilder};
use revm_primitives::{
AnalysisKind, BlobExcessGasAndPrice, BlockEnv, Bytes, CfgEnv, CfgEnvWithHandlerCfg, EVMError,
HaltReason, HandlerCfg, ResultAndState, SpecId, TxEnv, TxKind,
Expand All @@ -47,7 +47,7 @@ pub mod eip6110;
/// Ethereum EVM implementation.
#[derive(derive_more::Debug, derive_more::Deref, derive_more::DerefMut, derive_more::From)]
#[debug(bound(DB::Error: Debug))]
pub struct EthEvm<'a, EXT, DB: Database>(reth_revm::Evm<'a, EXT, DB>);
pub struct EthEvm<'a, EXT, DB: Database>(revm::Evm<'a, EXT, DB>);

impl<EXT, DB: Database> Evm for EthEvm<'_, EXT, DB> {
type DB = DB;
Expand Down Expand Up @@ -267,7 +267,7 @@ impl ConfigureEvm for EthEvmConfig {
) -> Self::Evm<'_, DB, I>
where
DB: Database,
I: reth_revm::GetInspector<DB>,
I: revm::GetInspector<DB>,
{
let cfg_env_with_handler_cfg = CfgEnvWithHandlerCfg {
cfg_env: evm_env.cfg_env,
Expand All @@ -293,7 +293,7 @@ mod tests {
use alloy_primitives::U256;
use reth_chainspec::{Chain, ChainSpec, MAINNET};
use reth_evm::{env::EvmEnv, execute::ProviderError};
use reth_revm::{
use revm::{
db::{CacheDB, EmptyDBTyped},
inspectors::NoOpInspector,
primitives::{BlockEnv, CfgEnv, SpecId},
Expand Down
6 changes: 3 additions & 3 deletions crates/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ reth-execution-errors.workspace = true
reth-execution-types.workspace = true
reth-metrics = { workspace = true, optional = true }
reth-primitives.workspace = true
reth-ethereum-primitives.workspace = true
reth-primitives-traits.workspace = true
reth-revm.workspace = true
reth-storage-errors.workspace = true

revm.workspace = true
Expand Down Expand Up @@ -50,22 +50,22 @@ std = [
"reth-consensus/std",
"reth-primitives/std",
"reth-primitives-traits/std",
"reth-revm/std",
"alloy-eips/std",
"alloy-primitives/std",
"alloy-consensus/std",
"revm-primitives/std",
"revm/std",
"reth-ethereum-forks/std",
"reth-ethereum-primitives/std",
"reth-chainspec/std",
"reth-consensus-common/std",
]
test-utils = [
"dep:parking_lot",
"reth-chainspec/test-utils",
"reth-consensus/test-utils",
"reth-ethereum-primitives/test-utils",
"reth-primitives/test-utils",
"reth-primitives-traits/test-utils",
"reth-revm/test-utils",
"revm/test-utils",
]
File renamed without changes.
3 changes: 1 addition & 2 deletions crates/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use reth_execution_errors::{
pub use reth_execution_types::{BlockExecutionOutput, ExecutionOutcome};
pub use reth_storage_errors::provider::ProviderError;

use crate::{system_calls::OnStateHook, Database};
use crate::{batch::BlockBatchRecord, system_calls::OnStateHook, Database};
use alloc::{boxed::Box, vec::Vec};
use alloy_eips::eip7685::Requests;
use alloy_primitives::{
Expand All @@ -17,7 +17,6 @@ use alloy_primitives::{
};
use reth_consensus::ConsensusError;
use reth_primitives::{NodePrimitives, Receipt, RecoveredBlock};
use reth_revm::batch::BlockBatchRecord;
use revm::{
db::{states::bundle_state::BundleRetention, BundleState},
State,
Expand Down
1 change: 1 addition & 0 deletions crates/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use reth_primitives_traits::{BlockHeader, SignedTransaction};
use revm::{DatabaseCommit, GetInspector};
use revm_primitives::{BlockEnv, ResultAndState, TxEnv, TxKind};

pub mod batch;
pub mod either;
/// EVM environment configuration.
pub mod env;
Expand Down
1 change: 0 additions & 1 deletion crates/optimism/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ reth-ethereum-forks.workspace = true
reth-evm.workspace = true
reth-primitives.workspace = true
reth-primitives-traits.workspace = true
reth-revm.workspace = true
reth-execution-errors.workspace = true
reth-execution-types.workspace = true
reth-prune-types.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use reth_optimism_forks::OpHardforks;
use reth_optimism_primitives::{transaction::signed::OpTransaction, DepositReceipt, OpPrimitives};
use reth_primitives::{NodePrimitives, RecoveredBlock};
use reth_primitives_traits::{BlockBody, SignedTransaction};
use reth_revm::State;
use revm::State;
use revm_primitives::{db::DatabaseCommit, ResultAndState};
use tracing::trace;

Expand Down
6 changes: 3 additions & 3 deletions crates/optimism/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use reth_optimism_consensus::next_block_base_fee;
use reth_optimism_forks::OpHardforks;
use reth_optimism_primitives::OpTransactionSigned;
use reth_primitives_traits::FillTxEnv;
use reth_revm::{
use revm::{
inspector_handle_register,
primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv},
EvmBuilder, GetInspector,
Expand All @@ -49,7 +49,7 @@ use revm_primitives::{
/// OP EVM implementation.
#[derive(derive_more::Debug, derive_more::Deref, derive_more::DerefMut, derive_more::From)]
#[debug(bound(DB::Error: Debug))]
pub struct OpEvm<'a, EXT, DB: Database>(reth_revm::Evm<'a, EXT, DB>);
pub struct OpEvm<'a, EXT, DB: Database>(revm::Evm<'a, EXT, DB>);

impl<EXT, DB: Database> Evm for OpEvm<'_, EXT, DB> {
type DB = DB;
Expand Down Expand Up @@ -297,7 +297,7 @@ mod tests {
use reth_optimism_chainspec::BASE_MAINNET;
use reth_optimism_primitives::{OpBlock, OpPrimitives, OpReceipt};
use reth_primitives::{Account, Log, RecoveredBlock};
use reth_revm::{
use revm::{
db::{BundleState, CacheDB, EmptyDBTyped},
inspectors::NoOpInspector,
primitives::{AccountInfo, BlockEnv, CfgEnv, SpecId},
Expand Down
6 changes: 0 additions & 6 deletions crates/revm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ workspace = true
[dependencies]
# reth
reth-primitives-traits.workspace = true
reth-ethereum-primitives.workspace = true
reth-storage-errors.workspace = true
reth-storage-api.workspace = true
reth-trie = { workspace = true, optional = true }

# alloy
alloy-eips.workspace = true
alloy-primitives.workspace = true

# revm
Expand All @@ -38,22 +36,18 @@ std = [
"reth-primitives-traits/std",
"alloy-primitives/std",
"revm/std",
"alloy-eips/std",
"alloy-consensus/std",
"reth-ethereum-forks/std",
"reth-ethereum-primitives/std",
]
witness = ["dep:reth-trie"]
test-utils = [
"dep:reth-trie",
"reth-primitives-traits/test-utils",
"reth-trie?/test-utils",
"revm/test-utils",
"reth-ethereum-primitives/test-utils",
]
serde = [
"revm/serde",
"alloy-eips/serde",
"alloy-primitives/serde",
"alloy-consensus/serde",
"reth-trie?/serde",
Expand Down
2 changes: 0 additions & 2 deletions crates/revm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

extern crate alloc;

pub mod batch;

/// Cache database that reads from an underlying [`DatabaseRef`].
/// Database adapters for payload building.
pub mod cached;
Expand Down
Loading