Skip to content

Commit

Permalink
bump: revm with upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodann committed Jul 31, 2024
1 parent ea0403b commit d02728b
Show file tree
Hide file tree
Showing 25 changed files with 96 additions and 96 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions crates/edr_eth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ itertools = { version = "0.10.5", default-features = false, features = ["use_all
k256 = { version = "0.13.1", default-features = false, features = ["arithmetic", "ecdsa", "pkcs8", ] }
log = { version = "0.4.17", default-features = false }
once_cell = { version = "1.18.0", default-features = false, features = ["alloc", "race", "std"] }
revm = { git = "https://github.com/NomicFoundation/revm", rev = "da8175a2", version = "12.1", default-features = false, features = ["c-kzg", "dev", "serde"] }
revm-primitives = { git = "https://github.com/NomicFoundation/revm", rev = "da8175a2", version = "7.1", default-features = false, features = ["c-kzg", "hashbrown"] }
revm = { git = "https://github.com/Wodann/revm", rev = "6d479da", version = "12.1", default-features = false, features = ["c-kzg", "dev", "serde"] }
revm-primitives = { git = "https://github.com/Wodann/revm", rev = "6d479da", version = "7.1", default-features = false, features = ["c-kzg", "hashbrown"] }
serde = { version = "1.0.147", default-features = false, features = ["derive"], optional = true }
sha2 = { version = "0.10.8", default-features = false }
sha3 = { version = "0.10.8", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions crates/edr_eth/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, RlpEncodable)]
pub struct L1ChainSpec;

impl revm::primitives::ChainSpec for L1ChainSpec {
impl revm::primitives::EvmWiring for L1ChainSpec {
type Block = revm_primitives::BlockEnv;

type Hardfork = revm_primitives::SpecId;
Expand All @@ -19,7 +19,7 @@ impl revm::primitives::ChainSpec for L1ChainSpec {
type Transaction = transaction::Signed;
}

impl revm::ChainSpec for L1ChainSpec {
impl revm::EvmWiring for L1ChainSpec {
type Context = ();

fn handler<'evm, EXT, DB>(hardfork: Self::Hardfork) -> revm::EvmHandler<'evm, Self, EXT, DB>
Expand All @@ -31,7 +31,7 @@ impl revm::ChainSpec for L1ChainSpec {
}

/// Constants for constructing Ethereum headers.
pub trait EthHeaderConstants: revm_primitives::ChainSpec<Hardfork: PartialOrd> {
pub trait EthHeaderConstants: revm_primitives::EvmWiring<Hardfork: PartialOrd> {
/// Parameters for the EIP-1559 base fee calculation.
const BASE_FEE_PARAMS: BaseFeeParams<Self>;

Expand Down
14 changes: 7 additions & 7 deletions crates/edr_eth/src/eips/eip1559.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
pub use alloy_eips::eip1559::BaseFeeParams as ConstantBaseFeeParams;
use derive_where::derive_where;
use revm_primitives::ChainSpec;
use revm_primitives::EvmWiring;

/// A mapping of hardfork to [`ConstantBaseFeeParams`]. This is used to specify
/// dynamic EIP-1559 parameters for chains like Optimism.
#[derive_where(Clone, Debug, PartialEq, Eq; ChainSpecT::Hardfork)]
pub struct ForkBaseFeeParams<ChainSpecT: ChainSpec> {
pub struct ForkBaseFeeParams<ChainSpecT: EvmWiring> {
activations: &'static [(ChainSpecT::Hardfork, ConstantBaseFeeParams)],
}

impl<ChainSpecT: ChainSpec> ForkBaseFeeParams<ChainSpecT> {
impl<ChainSpecT: EvmWiring> ForkBaseFeeParams<ChainSpecT> {
/// Constructs a new instance from the provided mapping.
pub const fn new(
activations: &'static [(ChainSpecT::Hardfork, ConstantBaseFeeParams)],
Expand All @@ -20,7 +20,7 @@ impl<ChainSpecT: ChainSpec> ForkBaseFeeParams<ChainSpecT> {

/// Type that allows specifying constant or dynamic EIP-1559 parameters based on
/// the active hardfork.
pub enum BaseFeeParams<ChainSpecT: ChainSpec> {
pub enum BaseFeeParams<ChainSpecT: EvmWiring> {
/// Constant [`ConstantBaseFeeParams`]; used for chains that don't have
/// dynamic EIP-1559 parameters
Constant(ConstantBaseFeeParams),
Expand All @@ -29,7 +29,7 @@ pub enum BaseFeeParams<ChainSpecT: ChainSpec> {
Variable(ForkBaseFeeParams<ChainSpecT>),
}

impl<ChainSpecT: ChainSpec<Hardfork: PartialOrd>> BaseFeeParams<ChainSpecT> {
impl<ChainSpecT: EvmWiring<Hardfork: PartialOrd>> BaseFeeParams<ChainSpecT> {
/// Retrieves the [`ConstantBaseFeeParams`] for the given hardfork, if any.
pub fn at_hardfork(&self, hardfork: ChainSpecT::Hardfork) -> Option<&ConstantBaseFeeParams> {
match self {
Expand All @@ -44,13 +44,13 @@ impl<ChainSpecT: ChainSpec<Hardfork: PartialOrd>> BaseFeeParams<ChainSpecT> {
}
}

impl<ChainSpecT: ChainSpec> From<ConstantBaseFeeParams> for BaseFeeParams<ChainSpecT> {
impl<ChainSpecT: EvmWiring> From<ConstantBaseFeeParams> for BaseFeeParams<ChainSpecT> {
fn from(params: ConstantBaseFeeParams) -> Self {
Self::Constant(params)
}
}

impl<ChainSpecT: ChainSpec> From<ForkBaseFeeParams<ChainSpecT>> for BaseFeeParams<ChainSpecT> {
impl<ChainSpecT: EvmWiring> From<ForkBaseFeeParams<ChainSpecT>> for BaseFeeParams<ChainSpecT> {
fn from(params: ForkBaseFeeParams<ChainSpecT>) -> Self {
Self::Variable(params)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/edr_eth/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub mod execution;
mod transaction;

use revm::db::StateRef;
use revm_primitives::ChainSpec;
use revm_primitives::EvmWiring;

pub use self::{block::BlockReceipt, transaction::TransactionReceipt};
use crate::{block::PartialHeader, Bloom, B256};
Expand All @@ -28,7 +28,7 @@ pub enum Execution<LogT> {
}

/// Trait for a builder that constructs an execution receipt.
pub trait ExecutionReceiptBuilder<ChainSpecT: ChainSpec>: Sized {
pub trait ExecutionReceiptBuilder<ChainSpecT: EvmWiring>: Sized {
/// The receipt type that the builder constructs.
type Receipt;

Expand Down
4 changes: 2 additions & 2 deletions crates/edr_eth/src/receipt/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod eip658;
mod legacy;

use alloy_rlp::{RlpDecodable, RlpEncodable};
use revm_primitives::ChainSpec;
use revm_primitives::EvmWiring;

use super::{Execution, ExecutionReceiptBuilder, MapReceiptLogs, Receipt};
use crate::{
Expand Down Expand Up @@ -123,7 +123,7 @@ impl ExecutionReceiptBuilder<L1ChainSpec> for Builder {

fn new_receipt_builder<StateT: revm::db::StateRef>(
_pre_execution_state: StateT,
_transaction: &<L1ChainSpec as ChainSpec>::Transaction,
_transaction: &<L1ChainSpec as EvmWiring>::Transaction,
) -> Result<Self, StateT::Error> {
Ok(Self)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/edr_eth/src/receipt/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::marker::PhantomData;

use alloy_rlp::BufMut;
use revm_primitives::{ChainSpec, ExecutionResult, Output};
use revm_primitives::{EvmWiring, ExecutionResult, Output};

use super::{MapReceiptLogs, Receipt};
use crate::{
Expand Down Expand Up @@ -59,7 +59,7 @@ impl<ExecutionReceiptT: Receipt<LogT>, LogT> TransactionReceipt<ExecutionReceipt
hardfork: ChainSpecT::Hardfork,
) -> Self
where
ChainSpecT: ChainSpec,
ChainSpecT: EvmWiring,
{
let contract_address = if let ExecutionResult::Success {
output: Output::Create(_, address),
Expand Down
2 changes: 1 addition & 1 deletion crates/edr_evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ parking_lot = { version = "0.12.1", default-features = false }
edr_defaults = { version = "0.3.5", path = "../edr_defaults" }
edr_eth = { version = "0.3.5", path = "../edr_eth", features = ["rand", "serde"] }
edr_rpc_eth = { version = "0.3.5", path = "../edr_rpc_eth" }
revm = { git = "https://github.com/NomicFoundation/revm", rev = "da8175a2", version = "12.1", default-features = false, features = ["c-kzg", "dev", "serde", "std"] }
revm = { git = "https://github.com/Wodann/revm", rev = "6d479da", version = "12.1", default-features = false, features = ["c-kzg", "dev", "serde", "std"] }
rpds = { version = "1.1.0", default-features = false, features = ["std"] }
serde = { version = "1.0.158", default-features = false, features = ["std"] }
serde_json = { version = "1.0.94", default-features = false, features = ["std"] }
Expand Down
14 changes: 7 additions & 7 deletions crates/edr_evm/src/block/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use edr_eth::{
};
use revm::{
db::{DatabaseComponents, StateRef},
handler::{CfgEnvWithChainSpec, EnvWithChainSpec},
handler::{CfgEnvWithEvmWiring, EnvWithEvmWiring},
primitives::{
ExecutionResult, ResultAndState, SpecId, Transaction as _, TransactionValidation,
MAX_BLOB_GAS_PER_BLOCK,
Expand Down Expand Up @@ -48,7 +48,7 @@ where
#[derive(Debug, thiserror::Error)]
pub enum BlockTransactionError<ChainSpecT, BlockchainErrorT, StateErrorT>
where
ChainSpecT: revm::primitives::ChainSpec,
ChainSpecT: revm::primitives::EvmWiring,
{
/// Transaction has higher gas limit than is remaining in block
#[error("Transaction has a higher gas limit than the remaining gas in the block")]
Expand All @@ -71,7 +71,7 @@ pub struct ExecutionResultWithContext<
DebugDataT,
StateT: StateRef,
> where
ChainSpecT: revm::ChainSpec,
ChainSpecT: revm::EvmWiring,
{
/// The result of executing the transaction.
pub result: Result<
Expand All @@ -92,7 +92,7 @@ pub struct BuildBlockResult<ChainSpecT: ChainSpec> {

/// A builder for constructing Ethereum blocks.
pub struct BlockBuilder<ChainSpecT: ChainSpec> {
cfg: CfgEnvWithChainSpec<ChainSpecT>,
cfg: CfgEnvWithEvmWiring<ChainSpecT>,
header: PartialHeader,
transactions: Vec<ChainSpecT::Transaction>,
state_diff: StateDiff,
Expand All @@ -108,7 +108,7 @@ where
/// Creates an intance of [`BlockBuilder`].
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all))]
pub fn new<BlockchainErrorT>(
cfg: CfgEnvWithChainSpec<ChainSpecT>,
cfg: CfgEnvWithEvmWiring<ChainSpecT>,
parent: &dyn SyncBlock<ChainSpecT, Error = BlockchainErrorT>,
mut options: BlockOptions,
) -> Result<Self, BlockBuilderCreationError<ChainSpecT>> {
Expand Down Expand Up @@ -148,7 +148,7 @@ where

impl<ChainSpecT: ChainSpec> BlockBuilder<ChainSpecT> {
/// Retrieves the config of the block builder.
pub fn config(&self) -> &CfgEnvWithChainSpec<ChainSpecT> {
pub fn config(&self) -> &CfgEnvWithEvmWiring<ChainSpecT> {
&self.cfg
}

Expand Down Expand Up @@ -317,7 +317,7 @@ where
}
};

let env = EnvWithChainSpec::new_with_cfg_env(self.cfg.clone(), block, transaction.clone());
let env = EnvWithEvmWiring::new_with_cfg_env(self.cfg.clone(), block, transaction.clone());

let db = DatabaseComponents {
state,
Expand Down
2 changes: 1 addition & 1 deletion crates/edr_evm/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
pub trait ChainSpec:
alloy_rlp::Encodable
+ EthHeaderConstants
+ revm::ChainSpec<
+ revm::EvmWiring<
Block: BlockEnvConstructor<Self>,
Transaction: alloy_rlp::Encodable
+ Clone
Expand Down
4 changes: 2 additions & 2 deletions crates/edr_evm/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub type HandleRegister<'evm, ChainSpecT, BlockchainErrorT, DebugDataT, StateT>
/// `EvmBuilder`.
pub struct DebugContext<'evm, ChainSpecT, BlockchainErrorT, DebugDataT, StateT>
where
ChainSpecT: revm::ChainSpec,
ChainSpecT: revm::EvmWiring,
StateT: StateRef,
{
/// The contextual data.
Expand All @@ -31,7 +31,7 @@ where

pub struct EvmContext<'evm, ChainSpecT, BlockchainErrorT, DebugDataT, StateT>
where
ChainSpecT: revm::ChainSpec,
ChainSpecT: revm::EvmWiring,
StateT: StateRef,
{
pub debug: Option<DebugContext<'evm, ChainSpecT, BlockchainErrorT, DebugDataT, StateT>>,
Expand Down
Loading

0 comments on commit d02728b

Please sign in to comment.