mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: remove reth-revm optimism (#8141)
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -5387,7 +5387,7 @@ version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b"
|
||||
dependencies = [
|
||||
"proc-macro-crate 3.1.0",
|
||||
"proc-macro-crate 2.0.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.60",
|
||||
@ -7653,13 +7653,11 @@ name = "reth-revm"
|
||||
version = "0.2.0-beta.6"
|
||||
dependencies = [
|
||||
"reth-consensus-common",
|
||||
"reth-evm",
|
||||
"reth-interfaces",
|
||||
"reth-primitives",
|
||||
"reth-provider",
|
||||
"reth-trie",
|
||||
"revm",
|
||||
"revm-inspectors",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
||||
@ -133,7 +133,6 @@ min-trace-logs = ["tracing/release_max_level_trace"]
|
||||
|
||||
optimism = [
|
||||
"reth-primitives/optimism",
|
||||
"reth-revm/optimism",
|
||||
"reth-interfaces/optimism",
|
||||
"reth-rpc/optimism",
|
||||
"reth-provider/optimism",
|
||||
|
||||
@ -50,4 +50,4 @@ assert_matches.workspace = true
|
||||
|
||||
[features]
|
||||
test-utils = []
|
||||
optimism = ["reth-primitives/optimism", "reth-interfaces/optimism", "reth-provider/optimism", "reth-revm/optimism"]
|
||||
optimism = ["reth-primitives/optimism", "reth-interfaces/optimism", "reth-provider/optimism"]
|
||||
|
||||
@ -71,6 +71,5 @@ optimism = [
|
||||
"reth-provider/optimism",
|
||||
"reth-blockchain-tree/optimism",
|
||||
"reth-beacon-consensus-core/optimism",
|
||||
"reth-revm/optimism",
|
||||
"reth-rpc/optimism"
|
||||
]
|
||||
|
||||
@ -33,7 +33,6 @@ reth-revm = { workspace = true, features = ["test-utils"] }
|
||||
optimism = [
|
||||
"reth-primitives/optimism",
|
||||
"reth-provider/optimism",
|
||||
"reth-revm/optimism",
|
||||
"reth-interfaces/optimism",
|
||||
"revm-primitives/optimism",
|
||||
]
|
||||
|
||||
@ -64,7 +64,6 @@ optimism = [
|
||||
"reth-provider/optimism",
|
||||
"reth-rpc-types-compat/optimism",
|
||||
"reth-rpc/optimism",
|
||||
"reth-revm/optimism",
|
||||
"reth-evm-optimism/optimism",
|
||||
"reth-optimism-payload-builder/optimism",
|
||||
"reth-beacon-consensus/optimism",
|
||||
|
||||
@ -37,7 +37,6 @@ sha2.workspace = true
|
||||
[features]
|
||||
optimism = [
|
||||
"reth-primitives/optimism",
|
||||
"reth-revm/optimism",
|
||||
"reth-provider/optimism",
|
||||
"reth-rpc-types-compat/optimism",
|
||||
"reth-evm-optimism/optimism",
|
||||
|
||||
@ -17,26 +17,16 @@ reth-primitives.workspace = true
|
||||
reth-interfaces.workspace = true
|
||||
reth-provider.workspace = true
|
||||
reth-consensus-common.workspace = true
|
||||
reth-evm = { workspace = true, optional = true }
|
||||
reth-trie = { workspace = true, optional = true }
|
||||
|
||||
# revm
|
||||
revm.workspace = true
|
||||
revm-inspectors.workspace = true
|
||||
|
||||
# common
|
||||
tracing.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
reth-evm.workspace = true
|
||||
reth-trie.workspace = true
|
||||
|
||||
[features]
|
||||
test-utils = ["dep:reth-trie", "dep:reth-evm"]
|
||||
optimism = [
|
||||
"revm/optimism",
|
||||
"reth-primitives/optimism",
|
||||
"reth-provider/optimism",
|
||||
"reth-interfaces/optimism",
|
||||
]
|
||||
js-tracer = ["revm-inspectors/js-tracer"]
|
||||
test-utils = ["dep:reth-trie"]
|
||||
|
||||
@ -22,4 +22,3 @@ pub mod test_utils;
|
||||
|
||||
// Convenience re-exports.
|
||||
pub use revm::{self, *};
|
||||
pub use revm_inspectors::*;
|
||||
|
||||
@ -1,31 +1,13 @@
|
||||
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
|
||||
use reth_interfaces::provider::ProviderResult;
|
||||
use reth_primitives::{
|
||||
keccak256, revm::config::revm_spec, trie::AccountProof, Account, Address, BlockNumber,
|
||||
Bytecode, Bytes, ChainSpec, Head, Header, StorageKey, TransactionSigned, B256, U256,
|
||||
keccak256, trie::AccountProof, Account, Address, BlockNumber, Bytecode, Bytes, StorageKey,
|
||||
B256, U256,
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "optimism"))]
|
||||
use reth_primitives::revm::env::fill_tx_env;
|
||||
use reth_provider::{AccountReader, BlockHashReader, StateProvider, StateRootProvider};
|
||||
use reth_trie::updates::TrieUpdates;
|
||||
use revm::{
|
||||
db::BundleState,
|
||||
primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv},
|
||||
};
|
||||
use revm::db::BundleState;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[cfg(feature = "optimism")]
|
||||
use {
|
||||
reth_primitives::revm::env::fill_op_tx_env,
|
||||
revm::{inspector_handle_register, GetInspector},
|
||||
};
|
||||
|
||||
use revm::{
|
||||
primitives::{HandlerCfg, SpecId},
|
||||
Database, Evm, EvmBuilder,
|
||||
};
|
||||
|
||||
/// Mock state for testing
|
||||
#[derive(Debug, Default, Clone, Eq, PartialEq)]
|
||||
pub struct StateProviderTest {
|
||||
@ -107,77 +89,3 @@ impl StateProvider for StateProviderTest {
|
||||
unimplemented!("proof generation is not supported")
|
||||
}
|
||||
}
|
||||
|
||||
/// Test EVM configuration.
|
||||
#[derive(Debug, Default, Clone, Copy)]
|
||||
#[non_exhaustive]
|
||||
pub struct TestEvmConfig;
|
||||
|
||||
impl ConfigureEvmEnv for TestEvmConfig {
|
||||
#[allow(unused_variables)]
|
||||
fn fill_tx_env(tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
|
||||
#[cfg(not(feature = "optimism"))]
|
||||
fill_tx_env(tx_env, transaction, sender);
|
||||
|
||||
#[cfg(feature = "optimism")]
|
||||
{
|
||||
let mut buf = Vec::with_capacity(transaction.length_without_header());
|
||||
transaction.encode_enveloped(&mut buf);
|
||||
fill_op_tx_env(tx_env, transaction, sender, buf.into());
|
||||
}
|
||||
}
|
||||
|
||||
fn fill_cfg_env(
|
||||
cfg_env: &mut CfgEnvWithHandlerCfg,
|
||||
chain_spec: &ChainSpec,
|
||||
header: &Header,
|
||||
total_difficulty: U256,
|
||||
) {
|
||||
let spec_id = revm_spec(
|
||||
chain_spec,
|
||||
Head {
|
||||
number: header.number,
|
||||
timestamp: header.timestamp,
|
||||
difficulty: header.difficulty,
|
||||
total_difficulty,
|
||||
hash: Default::default(),
|
||||
},
|
||||
);
|
||||
|
||||
cfg_env.chain_id = chain_spec.chain().id();
|
||||
cfg_env.perf_analyse_created_bytecodes = AnalysisKind::Analyse;
|
||||
|
||||
cfg_env.handler_cfg.spec_id = spec_id;
|
||||
#[cfg(feature = "optimism")]
|
||||
{
|
||||
cfg_env.handler_cfg.is_optimism = chain_spec.is_optimism();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ConfigureEvm for TestEvmConfig {
|
||||
type DefaultExternalContext<'a> = ();
|
||||
|
||||
fn evm<'a, DB: Database + 'a>(&self, db: DB) -> Evm<'a, (), DB> {
|
||||
#[cfg(feature = "optimism")]
|
||||
let handler_cfg = HandlerCfg { spec_id: SpecId::LATEST, is_optimism: true };
|
||||
#[cfg(not(feature = "optimism"))]
|
||||
let handler_cfg = HandlerCfg { spec_id: SpecId::LATEST };
|
||||
EvmBuilder::default().with_db(db).with_handler_cfg(handler_cfg).build()
|
||||
}
|
||||
|
||||
#[cfg(feature = "optimism")]
|
||||
fn evm_with_inspector<'a, DB, I>(&self, db: DB, inspector: I) -> Evm<'a, I, DB>
|
||||
where
|
||||
DB: Database + 'a,
|
||||
I: GetInspector<DB>,
|
||||
{
|
||||
let handler_cfg = HandlerCfg { spec_id: SpecId::LATEST, is_optimism: true };
|
||||
EvmBuilder::default()
|
||||
.with_db(db)
|
||||
.with_external_context(inspector)
|
||||
.with_handler_cfg(handler_cfg)
|
||||
.append_handler_register(inspector_handle_register)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,11 +21,11 @@ reth-provider = { workspace = true, features = ["test-utils"] }
|
||||
reth-transaction-pool = { workspace = true, features = ["test-utils"] }
|
||||
reth-network-api.workspace = true
|
||||
reth-rpc-engine-api.workspace = true
|
||||
reth-revm = { workspace = true, features = ["js-tracer"] }
|
||||
reth-revm.workspace = true
|
||||
reth-tasks = { workspace = true, features = ["rayon"] }
|
||||
reth-consensus-common.workspace = true
|
||||
reth-rpc-types-compat.workspace = true
|
||||
revm-inspectors.workspace = true
|
||||
revm-inspectors = { workspace = true, features = ["js-tracer"] }
|
||||
reth-evm.workspace = true
|
||||
reth-network-types.workspace = true
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ use reth_primitives::{revm::env::tx_env_with_recovered, BlockId, Bytes, TxKind,
|
||||
use reth_provider::{
|
||||
BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, StateProvider, StateProviderFactory,
|
||||
};
|
||||
use reth_revm::{access_list::AccessListInspector, database::StateProviderDatabase};
|
||||
use reth_revm::database::StateProviderDatabase;
|
||||
use reth_rpc_types::{
|
||||
state::StateOverride, AccessListWithGasUsed, Bundle, EthCallResponse, StateContext,
|
||||
TransactionRequest,
|
||||
@ -31,6 +31,7 @@ use revm::{
|
||||
},
|
||||
DatabaseCommit,
|
||||
};
|
||||
use revm_inspectors::access_list::AccessListInspector;
|
||||
use tracing::trace;
|
||||
|
||||
// Gas per transaction not creating a contract.
|
||||
|
||||
@ -24,10 +24,7 @@ use reth_primitives::{
|
||||
use reth_provider::{
|
||||
BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, StateProviderBox, StateProviderFactory,
|
||||
};
|
||||
use reth_revm::{
|
||||
database::StateProviderDatabase,
|
||||
tracing::{TracingInspector, TracingInspectorConfig},
|
||||
};
|
||||
use reth_revm::database::StateProviderDatabase;
|
||||
use reth_rpc_types::{
|
||||
transaction::{
|
||||
EIP1559TransactionRequest, EIP2930TransactionRequest, EIP4844TransactionRequest,
|
||||
@ -47,6 +44,7 @@ use revm::{
|
||||
},
|
||||
GetInspector, Inspector,
|
||||
};
|
||||
use revm_inspectors::tracing::{TracingInspector, TracingInspectorConfig};
|
||||
use std::future::Future;
|
||||
|
||||
use crate::eth::revm_utils::FillableTransaction;
|
||||
|
||||
@ -5,7 +5,6 @@ use alloy_sol_types::decode_revert_reason;
|
||||
use jsonrpsee::types::{error::CALL_EXECUTION_FAILED_CODE, ErrorObject};
|
||||
use reth_interfaces::RethError;
|
||||
use reth_primitives::{revm_primitives::InvalidHeader, Address, Bytes, U256};
|
||||
use reth_revm::tracing::{js::JsInspectorError, MuxError};
|
||||
use reth_rpc_types::{
|
||||
error::EthRpcErrorCode, request::TransactionInputError, BlockError, ToRpcError,
|
||||
};
|
||||
@ -14,6 +13,7 @@ use reth_transaction_pool::error::{
|
||||
PoolTransactionError,
|
||||
};
|
||||
use revm::primitives::{EVMError, ExecutionResult, HaltReason, OutOfGasError};
|
||||
use revm_inspectors::tracing::{js::JsInspectorError, MuxError};
|
||||
use std::time::Duration;
|
||||
|
||||
/// Result alias
|
||||
|
||||
@ -11,10 +11,7 @@ use reth_primitives::{
|
||||
revm::env::tx_env_with_recovered, BlockId, BlockNumberOrTag, Bytes, SealedHeader, B256, U256,
|
||||
};
|
||||
use reth_provider::{BlockReader, ChainSpecProvider, EvmEnvProvider, StateProviderFactory};
|
||||
use reth_revm::{
|
||||
database::StateProviderDatabase,
|
||||
tracing::{parity::populate_state_diff, TracingInspector, TracingInspectorConfig},
|
||||
};
|
||||
use reth_revm::database::StateProviderDatabase;
|
||||
use reth_rpc_api::TraceApiServer;
|
||||
use reth_rpc_types::{
|
||||
state::StateOverride,
|
||||
@ -31,7 +28,10 @@ use revm::{
|
||||
db::{CacheDB, DatabaseCommit},
|
||||
primitives::EnvWithHandlerCfg,
|
||||
};
|
||||
use revm_inspectors::opcode::OpcodeGasInspector;
|
||||
use revm_inspectors::{
|
||||
opcode::OpcodeGasInspector,
|
||||
tracing::{parity::populate_state_diff, TracingInspector, TracingInspectorConfig},
|
||||
};
|
||||
use std::{collections::HashSet, sync::Arc};
|
||||
use tokio::sync::{AcquireError, OwnedSemaphorePermit};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user