chore: reduce revm scope in txpool (#13274)

This commit is contained in:
Matthias Seitz
2024-12-11 08:35:11 +01:00
committed by GitHub
parent 9be5a78146
commit b424ad36dc
8 changed files with 22 additions and 22 deletions

5
Cargo.lock generated
View File

@ -8118,6 +8118,7 @@ dependencies = [
name = "reth-node-builder" name = "reth-node-builder"
version = "1.1.3" version = "1.1.3"
dependencies = [ dependencies = [
"alloy-eips",
"alloy-primitives", "alloy-primitives",
"alloy-rpc-types", "alloy-rpc-types",
"aquamarine", "aquamarine",
@ -8170,7 +8171,6 @@ dependencies = [
"reth-tokio-util", "reth-tokio-util",
"reth-tracing", "reth-tracing",
"reth-transaction-pool", "reth-transaction-pool",
"revm-primitives",
"secp256k1", "secp256k1",
"tempfile", "tempfile",
"tokio", "tokio",
@ -9497,7 +9497,8 @@ dependencies = [
"reth-storage-api", "reth-storage-api",
"reth-tasks", "reth-tasks",
"reth-tracing", "reth-tracing",
"revm", "revm-interpreter",
"revm-primitives",
"rustc-hash 2.1.0", "rustc-hash 2.1.0",
"schnellru", "schnellru",
"serde", "serde",

View File

@ -429,6 +429,7 @@ reth-zstd-compressors = { path = "crates/storage/zstd-compressors", default-feat
revm = { version = "18.0.0", features = ["std"], default-features = false } revm = { version = "18.0.0", features = ["std"], default-features = false }
revm-inspectors = "0.13.0" revm-inspectors = "0.13.0"
revm-primitives = { version = "14.0.0", default-features = false } revm-primitives = { version = "14.0.0", default-features = false }
revm-interpreter = { version = "14.0.0", default-features = false }
# eth # eth
alloy-chains = { version = "0.1.32", default-features = false } alloy-chains = { version = "0.1.32", default-features = false }

View File

@ -68,7 +68,7 @@ reth-engine-util.workspace = true
reth-prune.workspace = true reth-prune.workspace = true
# crypto # crypto
alloy-eips.workspace = true alloy-eips = { workspace = true, features = ["kzg"] }
alloy-rlp.workspace = true alloy-rlp.workspace = true
alloy-rpc-types = { workspace = true, features = ["engine"] } alloy-rpc-types = { workspace = true, features = ["engine"] }
alloy-consensus.workspace = true alloy-consensus.workspace = true

View File

@ -1,6 +1,9 @@
//! Command for debugging block building. //! Command for debugging block building.
use alloy_consensus::TxEip4844; use alloy_consensus::TxEip4844;
use alloy_eips::{eip2718::Encodable2718, eip4844::BlobTransactionSidecar}; use alloy_eips::{
eip2718::Encodable2718,
eip4844::{env_settings::EnvKzgSettings, BlobTransactionSidecar},
};
use alloy_primitives::{Address, Bytes, B256, U256}; use alloy_primitives::{Address, Bytes, B256, U256};
use alloy_rlp::Decodable; use alloy_rlp::Decodable;
use alloy_rpc_types::engine::{BlobsBundleV1, PayloadAttributes}; use alloy_rpc_types::engine::{BlobsBundleV1, PayloadAttributes};
@ -33,11 +36,7 @@ use reth_provider::{
BlockHashReader, BlockReader, BlockWriter, ChainSpecProvider, ProviderFactory, BlockHashReader, BlockReader, BlockWriter, ChainSpecProvider, ProviderFactory,
StageCheckpointReader, StateProviderFactory, StageCheckpointReader, StateProviderFactory,
}; };
use reth_revm::{ use reth_revm::{cached::CachedReads, database::StateProviderDatabase, primitives::KzgSettings};
cached::CachedReads,
database::StateProviderDatabase,
primitives::{EnvKzgSettings, KzgSettings},
};
use reth_stages::StageId; use reth_stages::StageId;
use reth_transaction_pool::{ use reth_transaction_pool::{
blobstore::InMemoryBlobStore, BlobStore, EthPooledTransaction, PoolConfig, TransactionOrigin, blobstore::InMemoryBlobStore, BlobStore, EthPooledTransaction, PoolConfig, TransactionOrigin,

View File

@ -61,7 +61,7 @@ reth-transaction-pool.workspace = true
## ethereum ## ethereum
alloy-primitives.workspace = true alloy-primitives.workspace = true
alloy-rpc-types = { workspace = true, features = ["engine"] } alloy-rpc-types = { workspace = true, features = ["engine"] }
revm-primitives.workspace = true alloy-eips = { workspace = true, features = ["kzg"] }
## async ## async
futures.workspace = true futures.workspace = true

View File

@ -9,6 +9,7 @@ use crate::{
rpc::{RethRpcAddOns, RethRpcServerHandles, RpcContext}, rpc::{RethRpcAddOns, RethRpcServerHandles, RpcContext},
DefaultNodeLauncher, LaunchNode, Node, NodeHandle, DefaultNodeLauncher, LaunchNode, Node, NodeHandle,
}; };
use alloy_eips::eip4844::env_settings::EnvKzgSettings;
use futures::Future; use futures::Future;
use reth_blockchain_tree::externals::NodeTypesForTree; use reth_blockchain_tree::externals::NodeTypesForTree;
use reth_chainspec::{EthChainSpec, EthereumHardforks, Hardforks}; use reth_chainspec::{EthChainSpec, EthereumHardforks, Hardforks};
@ -38,7 +39,6 @@ use reth_provider::{
}; };
use reth_tasks::TaskExecutor; use reth_tasks::TaskExecutor;
use reth_transaction_pool::{PoolConfig, PoolTransaction, TransactionPool}; use reth_transaction_pool::{PoolConfig, PoolTransaction, TransactionPool};
use revm_primitives::EnvKzgSettings;
use secp256k1::SecretKey; use secp256k1::SecretKey;
use std::sync::Arc; use std::sync::Arc;
use tracing::{info, trace, warn}; use tracing::{info, trace, warn};

View File

@ -23,10 +23,11 @@ reth-execution-types.workspace = true
reth-fs-util.workspace = true reth-fs-util.workspace = true
reth-storage-api.workspace = true reth-storage-api.workspace = true
reth-tasks.workspace = true reth-tasks.workspace = true
revm.workspace = true revm-primitives.workspace = true
revm-interpreter.workspace = true
# ethereum # ethereum
alloy-eips.workspace = true alloy-eips = { workspace = true, features = ["kzg"] }
alloy-primitives.workspace = true alloy-primitives.workspace = true
alloy-rlp.workspace = true alloy-rlp.workspace = true
alloy-consensus.workspace = true alloy-consensus.workspace = true
@ -85,9 +86,10 @@ serde = [
"bitflags/serde", "bitflags/serde",
"parking_lot/serde", "parking_lot/serde",
"rand?/serde", "rand?/serde",
"revm/serde",
"smallvec/serde", "smallvec/serde",
"reth-primitives-traits/serde", "reth-primitives-traits/serde",
"revm-interpreter/serde",
"revm-primitives/serde"
] ]
test-utils = [ test-utils = [
"rand", "rand",
@ -97,7 +99,6 @@ test-utils = [
"reth-chainspec/test-utils", "reth-chainspec/test-utils",
"reth-primitives/test-utils", "reth-primitives/test-utils",
"reth-provider/test-utils", "reth-provider/test-utils",
"revm/test-utils",
"reth-primitives-traits/test-utils", "reth-primitives-traits/test-utils",
] ]
arbitrary = [ arbitrary = [
@ -110,9 +111,10 @@ arbitrary = [
"alloy-eips/arbitrary", "alloy-eips/arbitrary",
"alloy-primitives/arbitrary", "alloy-primitives/arbitrary",
"bitflags/arbitrary", "bitflags/arbitrary",
"revm/arbitrary",
"reth-primitives-traits/arbitrary", "reth-primitives-traits/arbitrary",
"smallvec/arbitrary", "smallvec/arbitrary",
"revm-interpreter/arbitrary",
"revm-primitives/arbitrary"
] ]
[[bench]] [[bench]]

View File

@ -18,16 +18,12 @@ use alloy_consensus::{
}, },
BlockHeader, BlockHeader,
}; };
use alloy_eips::eip4844::MAX_BLOBS_PER_BLOCK; use alloy_eips::eip4844::{env_settings::EnvKzgSettings, MAX_BLOBS_PER_BLOCK};
use reth_chainspec::{ChainSpec, EthereumHardforks}; use reth_chainspec::{ChainSpec, EthereumHardforks};
use reth_primitives::{InvalidTransactionError, SealedBlock}; use reth_primitives::{InvalidTransactionError, SealedBlock};
use reth_primitives_traits::GotExpected; use reth_primitives_traits::GotExpected;
use reth_storage_api::{AccountReader, StateProviderFactory}; use reth_storage_api::{AccountReader, StateProviderFactory};
use reth_tasks::TaskSpawner; use reth_tasks::TaskSpawner;
use revm::{
interpreter::gas::validate_initial_tx_gas,
primitives::{EnvKzgSettings, SpecId},
};
use std::{ use std::{
marker::PhantomData, marker::PhantomData,
sync::{atomic::AtomicBool, Arc}, sync::{atomic::AtomicBool, Arc},
@ -807,6 +803,7 @@ pub fn ensure_intrinsic_gas<T: EthPoolTransaction>(
transaction: &T, transaction: &T,
fork_tracker: &ForkTracker, fork_tracker: &ForkTracker,
) -> Result<(), InvalidPoolTransactionError> { ) -> Result<(), InvalidPoolTransactionError> {
use revm_primitives::SpecId;
let spec_id = if fork_tracker.is_prague_activated() { let spec_id = if fork_tracker.is_prague_activated() {
SpecId::PRAGUE SpecId::PRAGUE
} else if fork_tracker.is_shanghai_activated() { } else if fork_tracker.is_shanghai_activated() {
@ -815,7 +812,7 @@ pub fn ensure_intrinsic_gas<T: EthPoolTransaction>(
SpecId::MERGE SpecId::MERGE
}; };
let gas_after_merge = validate_initial_tx_gas( let gas_after_merge = revm_interpreter::gas::validate_initial_tx_gas(
spec_id, spec_id,
transaction.input(), transaction.input(),
transaction.is_create(), transaction.is_create(),