From 0c128f92bed945f65ae1622e8c7450e5efab3ffc Mon Sep 17 00:00:00 2001 From: sergerad Date: Tue, 14 Jan 2025 18:56:44 +1300 Subject: [PATCH 1/3] Bump revm to 19.2.0 and fix compilation --- Cargo.lock | 33 ++++++++++------------------- Cargo.toml | 2 +- crates/executor/src/executor/env.rs | 2 +- crates/executor/src/executor/mod.rs | 9 ++++---- 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5731c35b..ba3b6877 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,18 +123,6 @@ dependencies = [ "serde", ] -[[package]] -name = "alloy-eip7702" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeffd2590ce780ddfaa9d0ae340eb2b4e08627650c4676eef537cef0b4bf535d" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "k256", - "serde", -] - [[package]] name = "alloy-eip7702" version = "0.5.0" @@ -155,7 +143,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52dd5869ed09e399003e0e0ec6903d981b2a92e74c5d37e6b40890bad2517526" dependencies = [ "alloy-eip2930", - "alloy-eip7702 0.5.0", + "alloy-eip7702", "alloy-primitives", "alloy-rlp", "alloy-serde", @@ -3599,13 +3587,14 @@ dependencies = [ [[package]] name = "revm" -version = "16.0.0" +version = "19.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34e44692d5736cc44c697a372e507890f8797f06d1541c5f4b9bec594d90fd8a" +checksum = "0a5a57589c308880c0f89ebf68d92aeef0d51e1ed88867474f895f6fd0f25c64" dependencies = [ "auto_impl", "cfg-if", "dyn-clone", + "once_cell", "revm-interpreter", "revm-precompile", "serde", @@ -3614,9 +3603,9 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "12.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f89940d17d5d077570de1977f52f69049595322e237cb6c754c3d47f668f023" +checksum = "c0f632e761f171fb2f6ace8d1552a5793e0350578d4acec3e79ade1489f4c2a6" dependencies = [ "revm-primitives", "serde", @@ -3624,9 +3613,9 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "13.0.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8f816aaea3245cbdbe7fdd84955df33597f9322c7912c3e3ba7bc855e03211f" +checksum = "6542fb37650dfdbf4b9186769e49c4a8bc1901a3280b2ebf32f915b6c8850f36" dependencies = [ "aurora-engine-modexp", "blst", @@ -3644,12 +3633,12 @@ dependencies = [ [[package]] name = "revm-primitives" -version = "12.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532411bbde45a46707c1d434dcdc29866cf261c1b748fb01b303ce3b4310b361" +checksum = "48faea1ecf2c9f80d9b043bbde0db9da616431faed84c4cfa3dd7393005598e6" dependencies = [ "alloy-eip2930", - "alloy-eip7702 0.2.0", + "alloy-eip7702", "alloy-primitives", "auto_impl", "bitflags 2.7.0", diff --git a/Cargo.toml b/Cargo.toml index b55f19de..a7d3a254 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -134,7 +134,7 @@ serde_json = { version = "1.0.135", default-features = false } # Ethereum unsigned-varint = "0.8.0" -revm = { version = "16.0.0", default-features = false } +revm = { version = "19.2.0", default-features = false } # K/V database rocksdb = { version = "0.22.0", default-features = false } diff --git a/crates/executor/src/executor/env.rs b/crates/executor/src/executor/env.rs index 1d4cba75..34530093 100644 --- a/crates/executor/src/executor/env.rs +++ b/crates/executor/src/executor/env.rs @@ -73,7 +73,7 @@ where let blob_excess_gas_and_price = parent_header .next_block_excess_blob_gas(BlobParams::cancun()) .or_else(|| spec_id.is_enabled_in(SpecId::ECOTONE).then_some(0)) - .map(BlobExcessGasAndPrice::new); + .map(|n| BlobExcessGasAndPrice::new(n, false)); let next_block_base_fee = parent_header.next_block_base_fee(*base_fee_params).unwrap_or_default(); diff --git a/crates/executor/src/executor/mod.rs b/crates/executor/src/executor/mod.rs index 1daf3f80..e89c8fff 100644 --- a/crates/executor/src/executor/mod.rs +++ b/crates/executor/src/executor/mod.rs @@ -172,8 +172,8 @@ where // The sum of the transaction’s gas limit, Tg, and the gas utilized in this block prior, // must be no greater than the block’s gasLimit. let block_available_gas = (gas_limit - cumulative_gas_used) as u128; - if (transaction.gas_limit() as u128) > block_available_gas && - (is_regolith || !transaction.is_system_transaction()) + if (transaction.gas_limit() as u128) > block_available_gas + && (is_regolith || !transaction.is_system_transaction()) { return Err(ExecutorError::BlockGasLimitExceeded); } @@ -296,10 +296,11 @@ where let excess_blob_gas = if self.config.is_ecotone_active(parent_header.timestamp) { let parent_excess_blob_gas = parent_header.excess_blob_gas.unwrap_or_default(); let parent_blob_gas_used = parent_header.blob_gas_used.unwrap_or_default(); - calc_excess_blob_gas(parent_excess_blob_gas, parent_blob_gas_used) + // TODO: Calculate actual target + calc_excess_blob_gas(parent_excess_blob_gas, parent_blob_gas_used, 0) } else { // For the first post-fork block, both blob gas fields are evaluated to 0. - calc_excess_blob_gas(0, 0) + calc_excess_blob_gas(0, 0, 0) }; (Some(0), Some(excess_blob_gas as u128)) From dfea834867f457e86ceac6c22c801a052f208a6b Mon Sep 17 00:00:00 2001 From: sergerad Date: Wed, 15 Jan 2025 06:19:49 +1300 Subject: [PATCH 2/3] Bump minor and use previous values for blob gas --- Cargo.toml | 2 +- crates/executor/src/executor/mod.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a7d3a254..0a5b5904 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -134,7 +134,7 @@ serde_json = { version = "1.0.135", default-features = false } # Ethereum unsigned-varint = "0.8.0" -revm = { version = "19.2.0", default-features = false } +revm = { version = "19.3.0", default-features = false } # K/V database rocksdb = { version = "0.22.0", default-features = false } diff --git a/crates/executor/src/executor/mod.rs b/crates/executor/src/executor/mod.rs index e89c8fff..84bc4655 100644 --- a/crates/executor/src/executor/mod.rs +++ b/crates/executor/src/executor/mod.rs @@ -296,8 +296,14 @@ where let excess_blob_gas = if self.config.is_ecotone_active(parent_header.timestamp) { let parent_excess_blob_gas = parent_header.excess_blob_gas.unwrap_or_default(); let parent_blob_gas_used = parent_header.blob_gas_used.unwrap_or_default(); - // TODO: Calculate actual target - calc_excess_blob_gas(parent_excess_blob_gas, parent_blob_gas_used, 0) + const TARGET_BLOB_NUMBER_PER_BLOCK: u64 = 3; + const TARGET_BLOB_GAS_PER_BLOCK: u64 = + TARGET_BLOB_NUMBER_PER_BLOCK * revm::primitives::GAS_PER_BLOB; + calc_excess_blob_gas( + parent_excess_blob_gas, + parent_blob_gas_used, + TARGET_BLOB_GAS_PER_BLOCK, + ) } else { // For the first post-fork block, both blob gas fields are evaluated to 0. calc_excess_blob_gas(0, 0, 0) From df009fba0b0ec506a525dc30ab0202afc15aedfe Mon Sep 17 00:00:00 2001 From: sergerad Date: Wed, 15 Jan 2025 19:54:53 +1300 Subject: [PATCH 3/3] fmt --- crates/executor/src/executor/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/executor/src/executor/mod.rs b/crates/executor/src/executor/mod.rs index 84bc4655..be25a835 100644 --- a/crates/executor/src/executor/mod.rs +++ b/crates/executor/src/executor/mod.rs @@ -172,8 +172,8 @@ where // The sum of the transaction’s gas limit, Tg, and the gas utilized in this block prior, // must be no greater than the block’s gasLimit. let block_available_gas = (gas_limit - cumulative_gas_used) as u128; - if (transaction.gas_limit() as u128) > block_available_gas - && (is_regolith || !transaction.is_system_transaction()) + if (transaction.gas_limit() as u128) > block_available_gas && + (is_regolith || !transaction.is_system_transaction()) { return Err(ExecutorError::BlockGasLimitExceeded); }