Skip to content

Commit

Permalink
chore: bump revm 6.0 (paradigmxyz#6638)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Feb 17, 2024
1 parent 632fc05 commit bcc95b1
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 43 deletions.
32 changes: 17 additions & 15 deletions Cargo.lock

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

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ reth-transaction-pool = { path = "crates/transaction-pool" }
reth-trie = { path = "crates/trie" }

# revm
revm = { version = "5.0", features = ["std", "secp256k1"], default-features = false }
revm = { version = "6.0", features = ["std", "secp256k1"], default-features = false }
revm-primitives = { version = "2.0", features = ["std"], default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "8f17f34" }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "ac63f06" }

# eth
alloy-chains = { version = "0.1", feature = ["serde", "rlp", "arbitrary"] }
Expand All @@ -181,12 +181,12 @@ alloy-dyn-abi = "0.6"
alloy-sol-types = "0.6"
alloy-rlp = "0.3"
alloy-trie = "0.2"
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" }
alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" }
alloy-rpc-engine-types = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "b9dd518" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" }
alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" }
alloy-rpc-engine-types = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "5062eaf" }
ethers-core = { version = "2.0", default-features = false }
ethers-providers = { version = "2.0", default-features = false }
ethers-signers = { version = "2.0", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/node-ethereum/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mod tests {
#[test]
#[ignore]
fn test_fill_cfg_and_block_env() {
let mut cfg_env = CfgEnvWithHandlerCfg::new(CfgEnv::default(), SpecId::LATEST);
let mut cfg_env = CfgEnvWithHandlerCfg::new_with_spec_id(CfgEnv::default(), SpecId::LATEST);
let mut block_env = BlockEnv::default();
let header = Header::default();
let chain_spec = ChainSpec::default();
Expand Down
2 changes: 1 addition & 1 deletion crates/node-optimism/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ mod tests {
#[test]
#[ignore]
fn test_fill_cfg_and_block_env() {
let mut cfg_env = CfgEnvWithHandlerCfg::new(CfgEnv::default(), SpecId::LATEST);
let mut cfg_env = CfgEnvWithHandlerCfg::new_with_spec_id(CfgEnv::default(), SpecId::LATEST);
let mut block_env = BlockEnv::default();
let header = Header::default();
let chain_spec = ChainSpec::default();
Expand Down
10 changes: 5 additions & 5 deletions crates/payload/builder/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ impl PayloadBuilderAttributes for EthPayloadBuilderAttributes {
Ok(Self::new(parent, attributes))
}

fn parent(&self) -> B256 {
self.parent
}

fn payload_id(&self) -> PayloadId {
self.id
}

fn parent(&self) -> B256 {
self.parent
}

fn timestamp(&self) -> u64 {
self.timestamp
}
Expand Down Expand Up @@ -279,7 +279,7 @@ impl PayloadBuilderAttributes for EthPayloadBuilderAttributes {
blob_excess_gas_and_price,
};

(CfgEnvWithHandlerCfg::new(cfg, spec_id), block_env)
(CfgEnvWithHandlerCfg::new_with_spec_id(cfg, spec_id), block_env)
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ where
self.db_mut().set_state_clear_flag(state_clear_flag);

let mut cfg: CfgEnvWithHandlerCfg =
CfgEnvWithHandlerCfg::new(self.evm.cfg().clone(), self.evm.spec_id());
CfgEnvWithHandlerCfg::new_with_spec_id(self.evm.cfg().clone(), self.evm.spec_id());
EvmConfig::fill_cfg_and_block_env(
&mut cfg,
self.evm.block_mut(),
Expand Down
10 changes: 7 additions & 3 deletions crates/rpc/rpc-types-compat/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ pub fn from_block_full(
}

/// Converts from a [reth_primitives::SealedHeader] to a [reth_rpc_types::BlockNumberOrTag]
///
/// Note: This does not set the `totalDifficulty` field.
pub fn from_primitive_with_hash(primitive_header: reth_primitives::SealedHeader) -> Header {
let (header, hash) = primitive_header.split();
let PrimitiveHeader {
Expand Down Expand Up @@ -138,6 +140,7 @@ pub fn from_primitive_with_hash(primitive_header: reth_primitives::SealedHeader)
blob_gas_used: blob_gas_used.map(U64::from),
excess_blob_gas: excess_blob_gas.map(U64::from),
parent_beacon_block_root,
total_difficulty: None,
}
}

Expand All @@ -161,19 +164,21 @@ fn from_block_with_transactions(
transactions: BlockTransactions,
) -> Block {
let uncles = block.ommers.into_iter().map(|h| h.hash_slow()).collect();
let header = from_primitive_with_hash(block.header.seal(block_hash));
let mut header = from_primitive_with_hash(block.header.seal(block_hash));
header.total_difficulty = Some(total_difficulty);

let withdrawals = if header.withdrawals_root.is_some() {
block
.withdrawals
.map(|withdrawals| withdrawals.into_iter().map(from_primitive_withdrawal).collect())
} else {
None
};

Block {
header,
uncles,
transactions,
total_difficulty: Some(total_difficulty),
size: Some(U256::from(block_length)),
withdrawals,
other: Default::default(),
Expand All @@ -193,7 +198,6 @@ pub fn uncle_block_from_header(header: PrimitiveHeader) -> Block {
transactions: BlockTransactions::Uncle,
withdrawals: Some(vec![]),
size,
total_difficulty: None,
other: Default::default(),
}
}
7 changes: 1 addition & 6 deletions crates/rpc/rpc/src/eth/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,7 @@ where
PendingBlockEnvOrigin::DerivedFromLatest(latest)
};

let mut cfg = CfgEnvWithHandlerCfg::new(CfgEnv::default(), SpecId::LATEST);

#[cfg(feature = "optimism")]
{
cfg.handler_cfg.is_optimism = self.provider().chain_spec().is_optimism();
}
let mut cfg = CfgEnvWithHandlerCfg::new_with_spec_id(CfgEnv::default(), SpecId::LATEST);

let mut block_env = BlockEnv::default();
// Note: for the PENDING block we assume it is past the known merge block and thus this will
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ where
this.action_task_spawner.spawn_blocking(Box::pin(async move {
// Acquire permit
let _permit = rate_limiter.acquire().await;
let mut cfg = CfgEnvWithHandlerCfg::new(
let mut cfg = CfgEnvWithHandlerCfg::new_with_spec_id(
CfgEnv::default(),
SpecId::LATEST,
);
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/traits/evm_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub trait EvmEnvProvider: Send + Sync {
where
EvmConfig: ConfigureEvmEnv,
{
let mut cfg = CfgEnvWithHandlerCfg::new(CfgEnv::default(), SpecId::LATEST);
let mut cfg = CfgEnvWithHandlerCfg::new_with_spec_id(CfgEnv::default(), SpecId::LATEST);
let mut block_env = BlockEnv::default();
self.fill_env_with_header::<EvmConfig>(&mut cfg, &mut block_env, header, evm_config)?;
Ok((cfg, block_env))
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl PayloadBuilderAttributes for CustomPayloadBuilderAttributes {
blob_excess_gas_and_price,
};

(CfgEnvWithHandlerCfg::new(cfg, spec_id), block_env)
(CfgEnvWithHandlerCfg::new_with_spec_id(cfg, spec_id), block_env)
}
}

Expand Down

0 comments on commit bcc95b1

Please sign in to comment.