Skip to content

Commit

Permalink
Revert "Merge remote-tracking branch 'origin/main' into joshie/dyn-fo…
Browse files Browse the repository at this point in the history
…rks"

This reverts commit 151c4c1, reversing
changes made to 96574f3.
  • Loading branch information
joshieDo committed Jun 27, 2024
1 parent 151c4c1 commit ae309c6
Show file tree
Hide file tree
Showing 116 changed files with 4,501 additions and 5,513 deletions.
116 changes: 24 additions & 92 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ members = [
"crates/rpc/rpc-api/",
"crates/rpc/rpc-builder/",
"crates/rpc/rpc-engine-api/",
"crates/rpc/rpc-eth-api/",
"crates/rpc/rpc-layer",
"crates/rpc/rpc-testing-util/",
"crates/rpc/rpc-types-compat/",
Expand Down Expand Up @@ -340,7 +339,6 @@ reth-rpc-api = { path = "crates/rpc/rpc-api" }
reth-rpc-api-testing-util = { path = "crates/rpc/rpc-testing-util" }
reth-rpc-builder = { path = "crates/rpc/rpc-builder" }
reth-rpc-engine-api = { path = "crates/rpc/rpc-engine-api" }
reth-rpc-eth-api = { path = "crates/rpc/rpc-eth-api" }
reth-rpc-layer = { path = "crates/rpc/rpc-layer" }
reth-rpc-server-types = { path = "crates/rpc/rpc-server-types" }
reth-rpc-types = { path = "crates/rpc/rpc-types" }
Expand Down Expand Up @@ -416,7 +414,6 @@ aquamarine = "0.5"
bytes = "1.5"
bitflags = "2.4"
clap = "4"
const_format = { version = "0.2.32", features = ["rust_1_64"] }
dashmap = "5.5"
derive_more = "0.99.17"
fdlimit = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/e2e-test-utils/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use alloy_consensus::TxEnvelope;
use alloy_network::eip2718::Decodable2718;
use reth::{api::FullNodeComponents, builder::rpc::RpcRegistry, rpc::api::DebugApiServer};
use reth_primitives::{Bytes, B256};
use reth_rpc::eth::{servers::EthTransactions, EthResult};
use reth_rpc::eth::{error::EthResult, EthTransactions};

pub struct RpcTestContext<Node: FullNodeComponents> {
pub inner: RpcRegistry<Node>,
Expand Down
13 changes: 9 additions & 4 deletions crates/ethereum-forks/src/hardfork/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub use optimism::OptimismHardfork;
mod dev;
pub use dev::DEV_HARDFORKS;

use auto_impl;
use core::{
any::Any,
hash::{Hash, Hasher},
Expand All @@ -20,13 +19,19 @@ use dyn_clone::DynClone;
use alloc::{format, string::String};

/// Generic hardfork trait.
#[auto_impl::auto_impl(&, dyn, Box, Clone)]
pub trait Hardfork: Any + Send + Sync + 'static {
pub trait Hardfork: Any + DynClone + Send + Sync + 'static {
/// Fork name.
fn name(&self) -> &'static str;
}

// dyn_clone::clone_trait_object!(Hardfork);
dyn_clone::clone_trait_object!(Hardfork);

impl Hardfork for Box<dyn Hardfork> {
/// Name of an hardfork.
fn name(&self) -> &'static str {
(**self).name()
}
}

impl core::fmt::Debug for dyn Hardfork + 'static {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
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 @@ -177,7 +177,7 @@ where
.into())
}

self.evm_config.fill_tx_env(evm.tx_mut(), transaction, *sender);
EvmConfig::fill_tx_env(evm.tx_mut(), transaction, *sender);

// Execute transaction.
let ResultAndState { result, state } = evm.transact().map_err(move |err| {
Expand Down
42 changes: 35 additions & 7 deletions crates/ethereum/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
#[cfg(not(feature = "std"))]
extern crate alloc;

use reth_chainspec::ChainSpec;
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
use reth_primitives::{
revm::{config::revm_spec, env::fill_tx_env},
revm_primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv},
Address, Head, Header, TransactionSigned, U256,
};
use reth_revm::{Database, EvmBuilder};

pub mod execute;
Expand All @@ -28,7 +34,34 @@ pub mod eip6110;
#[non_exhaustive]
pub struct EthEvmConfig;

impl ConfigureEvmEnv for EthEvmConfig {}
impl ConfigureEvmEnv for EthEvmConfig {
fn fill_tx_env(tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
fill_tx_env(tx_env, transaction, sender)
}

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;
}
}

impl ConfigureEvm for EthEvmConfig {
type DefaultExternalContext<'a> = ();
Expand All @@ -44,12 +77,7 @@ impl ConfigureEvm for EthEvmConfig {
#[cfg(test)]
mod tests {
use super::*;
use reth_chainspec::ChainSpec;
use reth_primitives::{
revm_primitives::{BlockEnv, CfgEnv, SpecId},
Header, U256,
};
use revm_primitives::CfgEnvWithHandlerCfg;
use reth_primitives::revm_primitives::{BlockEnv, CfgEnv, SpecId};

#[test]
#[ignore]
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum/node/tests/e2e/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::utils::EthNode;
use alloy_genesis::Genesis;
use alloy_primitives::{b256, hex};
use futures::StreamExt;
use reth::rpc::eth::servers::EthTransactions;
use reth::rpc::eth::EthTransactions;
use reth_chainspec::ChainSpec;
use reth_e2e_test_utils::setup;
use reth_provider::CanonStateSubscriptions;
Expand Down
Loading

0 comments on commit ae309c6

Please sign in to comment.