From 37d9fc18ea4df64887d4d8ef437aff648eaff28b Mon Sep 17 00:00:00 2001 From: Roshan Date: Thu, 9 May 2024 22:28:08 +0800 Subject: [PATCH] fix review comments --- crates/primitives/Cargo.toml | 1 - crates/revm/Cargo.toml | 6 +++++- crates/revm/src/bsc/factory.rs | 2 +- crates/revm/src/bsc/processor.rs | 9 ++------- crates/stages/Cargo.toml | 4 +++- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 0e28f14000..3e08655dbb 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -113,7 +113,6 @@ zstd-codec = [ "dep:zstd" ] clap = ["dep:clap"] -bsc = ["revm-primitives/bsc"] optimism = [ "reth-codecs/optimism", "revm-primitives/optimism", diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index 0476bf926c..51020dfb3d 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -35,7 +35,11 @@ cfg-if = "1.0.0" reth-trie.workspace = true [features] -bsc = ["revm/bsc"] +bsc = [ + "revm/bsc", + "reth-interfaces/bsc", + "reth-provider/bsc", +] test-utils = ["dep:reth-trie"] optimism = [ "revm/optimism", diff --git a/crates/revm/src/bsc/factory.rs b/crates/revm/src/bsc/factory.rs index 7ec13df585..cb9e1ac0b2 100644 --- a/crates/revm/src/bsc/factory.rs +++ b/crates/revm/src/bsc/factory.rs @@ -61,7 +61,7 @@ where fn with_state_and_provider< 'a, SP: StateProvider + 'a, - P: HeaderProvider + ParliaSnapshotReader + ParliaSnapshotWriter + 'a, + P: HeaderProvider + ParliaSnapshotReader + ParliaSnapshotWriter, >( &'a self, sp: SP, diff --git a/crates/revm/src/bsc/processor.rs b/crates/revm/src/bsc/processor.rs index b21bcb92d1..0ba70c9549 100644 --- a/crates/revm/src/bsc/processor.rs +++ b/crates/revm/src/bsc/processor.rs @@ -148,10 +148,10 @@ where total_difficulty: U256, ) -> Result, BlockExecutionError> { self.init_env(&block.header, total_difficulty); - let (mut system_tx, mut receipts, mut cumulative_gas_used) = + let (mut system_txs, mut receipts, mut cumulative_gas_used) = self.execute_transactions_and_get_system_txs(block, total_difficulty)?; - self.finalize(&block.header, &mut system_tx, &mut receipts, &mut cumulative_gas_used)?; + self.finalize(&block.header, &mut system_txs, &mut receipts, &mut cumulative_gas_used)?; // Check if gas used matches the value set in header. if block.gas_used != cumulative_gas_used { let receipts = Receipts::from_block_receipt(receipts); @@ -557,11 +557,6 @@ where todo!() } - // perf: do not execute empty blocks - if block.body.is_empty() { - return Ok((Vec::new(), Vec::new(), 0)) - } - let mut cumulative_gas_used = 0; let mut system_txs = Vec::with_capacity(2); let mut receipts = Vec::with_capacity(block.body.len()); diff --git a/crates/stages/Cargo.toml b/crates/stages/Cargo.toml index 2b6f675c55..f99e1b544d 100644 --- a/crates/stages/Cargo.toml +++ b/crates/stages/Cargo.toml @@ -76,7 +76,9 @@ pprof = { workspace = true, features = [ ] } [features] -bsc = [] +bsc = [ + "reth-revm/bsc", +] test-utils = [ "reth-interfaces/test-utils", "reth-db/test-utils",