diff --git a/Cargo.lock b/Cargo.lock index a00e861a..93131867 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -255,9 +255,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa2d9df04dce5c4a8d46783fa18d687b946a9f7d61166cdc35b0631dfc50b810" +checksum = "705687d5bfd019fee57cf9e206b27b30a9a9617535d5590a02b171e813208f8e" dependencies = [ "alloy-eips", "alloy-primitives", @@ -294,9 +294,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2717a756c33fe935751d8963b5898d406c8846199660c9d6c6eeb41a18a15697" +checksum = "6ffb906284a1e1f63c4607da2068c8197458a352d0b3e9796e67353d72a9be85" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -312,9 +312,9 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9162561c17566bf289a5d0aad07831b7c07d5412108ce533689d379940ba70" +checksum = "8429cf4554eed9b40feec7f4451113e76596086447550275e3def933faf47ce3" dependencies = [ "alloy-primitives", "alloy-serde", @@ -323,9 +323,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4f3797fbb22b3312d6cb63fcce9a1f921e567074f9dc2c012de5200342ebe8" +checksum = "f8fa8a1a3c4cbd221f2b8e3693aeb328fca79a757fe556ed08e47bbbc2a70db7" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -337,9 +337,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad95873a12c4e0a45575c66fcabe7ccc31fcf4c946a7d30c7cc38a115c59004e" +checksum = "85fa23a6a9d612b52e402c995f2d582c25165ec03ac6edf64c861a76bc5b87cd" dependencies = [ "alloy-consensus", "alloy-eips", @@ -358,9 +358,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8416e4e9ceee8014d2f89fc3dde331da392b26d14226a0d5cbc207ae7799fb2f" +checksum = "801492711d4392b2ccf5fc0bc69e299fa1aab15167d74dcaa9aab96a54f684bd" dependencies = [ "alloy-consensus", "alloy-eips", @@ -371,9 +371,9 @@ dependencies = [ [[package]] name = "alloy-node-bindings" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60d32daf9f95aa04cd7cad47f9de58ab91a3a039fa51979637787f14f13a8292" +checksum = "4f1334a738aa1710cb8227441b3fcc319202ce78e967ef37406940242df4a454" dependencies = [ "alloy-genesis", "alloy-primitives", @@ -397,7 +397,7 @@ dependencies = [ "cfg-if", "const-hex", "derive_more 1.0.0", - "hashbrown", + "hashbrown 0.14.5", "hex-literal", "indexmap", "itoa", @@ -415,9 +415,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82c0e8ebddbcce9450431680dc1576b380e1a781c2f8033321bef805272644b" +checksum = "fcfaa4ffec0af04e3555686b8aacbcdf7d13638133a0672749209069750f78a6" dependencies = [ "alloy-chains", "alloy-consensus", @@ -471,9 +471,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "424516469135db9d385a1f9a51bc0d198e226bf3ff29843fde799a39b5507e12" +checksum = "370143ed581aace6e663342d21d209c6b2e34ee6142f7d6675adb518deeaf0dc" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -493,9 +493,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0d2d760a666acdcaed038164bef0d179ee10790ba68e39b18361faac7eb6e7" +checksum = "9ffc534b7919e18f35e3aa1f507b6f3d9d92ec298463a9f6beaac112809d8d06" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -505,9 +505,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c032e9b725a990be03cc0ddd9fa73c21f61d1449b328083aa22fbfafb03eda1b" +checksum = "e0285c4c09f838ab830048b780d7f4a4f460f309aa1194bb049843309524c64c" dependencies = [ "alloy-consensus", "alloy-eips", @@ -521,9 +521,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e1f655dcd5e9ccf215cbffb69272698ef6b3ec76907e8937345f2a82ae04ed4" +checksum = "413f4aa3ccf2c3e4234a047c5fa4727916d7daf25a89f9b765df0ba09784fd87" dependencies = [ "alloy-consensus", "alloy-eips", @@ -540,9 +540,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c1b34ed2d54f2db4ec4f38bcd78d9913f9b2deb065254d3541cc350ba660c0d" +checksum = "9dff0ab1cdd43ca001e324dc27ee0e8606bd2161d6623c63e0e0b8c4dfc13600" dependencies = [ "alloy-primitives", "serde", @@ -551,9 +551,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "672b6462295502a7eb24e76e16dc8664ece33d168a2cade3bf4dac6a858e054e" +checksum = "2fd4e0ad79c81a27ca659be5d176ca12399141659fef2bcbfdc848da478f4504" dependencies = [ "alloy-primitives", "async-trait", @@ -623,9 +623,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c99b41f0ea73dbbb1f0c970dd7c5150db9040d6201c07daf1ee0bfd74f5fb60" +checksum = "2ac3e97dad3d31770db0fc89bd6a63b789fbae78963086733f960cf32c483904" dependencies = [ "alloy-json-rpc", "base64", @@ -642,9 +642,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8915d70b52abcefa0d9e463a3d85de82f3dd7d14a0caa94f6ec3802cb462be9" +checksum = "b367dcccada5b28987c2296717ee04b9a5637aacd78eacb1726ef211678b5212" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -862,9 +862,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-stream" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", @@ -873,9 +873,9 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", @@ -1159,9 +1159,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.23" +version = "1.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bbb537bb4a30b90362caddba8f360c0a56bc13d3a5570028e7197204cb54a17" +checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" dependencies = [ "jobserver", "libc", @@ -1223,9 +1223,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.18" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" +checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" dependencies = [ "clap_builder", "clap_derive", @@ -1233,9 +1233,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.18" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" +checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" dependencies = [ "anstream", "anstyle", @@ -1454,7 +1454,7 @@ checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" dependencies = [ "cfg-if", "crossbeam-utils", - "hashbrown", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -1937,6 +1937,12 @@ dependencies = [ "serde", ] +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + [[package]] name = "heck" version = "0.5.0" @@ -2146,12 +2152,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.0", "serde", ] @@ -2496,7 +2502,6 @@ dependencies = [ "op-alloy-consensus", "op-alloy-genesis", "op-alloy-protocol", - "thiserror 1.0.64 (git+https://github.com/quartiq/thiserror?branch=no-std)", ] [[package]] @@ -2661,7 +2666,7 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -2948,9 +2953,9 @@ checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "op-alloy-consensus" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c662868734bd5a274c4474dc0642b5211f008367e591573277e5895333cb78f5" +checksum = "c4f7f318f885db6e1455370ca91f74b7faed152c8142f6418f0936d606e582ff" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2964,9 +2969,9 @@ dependencies = [ [[package]] name = "op-alloy-genesis" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b4faf4f93b34c263e66cb163a085d9da72ced1f3adb34b7bd70c6e9fc7e5d6" +checksum = "c8215c87b74d2fbbaff0fd2887868a8341df33a3c495ee01f813e5ddd5be9c46" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2978,9 +2983,9 @@ dependencies = [ [[package]] name = "op-alloy-protocol" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20bec4f5aff4fe44e1e5beecd988096e6b757bd4bdfe6b10bb3f08c410287348" +checksum = "fa5c397fbe35e07f9c95a571440ca2e90df754e198496d82ff4127de00b89dd9" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2995,17 +3000,14 @@ dependencies = [ [[package]] name = "op-alloy-rpc-types-engine" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb2b515967262eae36ccecf868ab123dd8a098476f08f28f8ab4c3db5e1ee306" +checksum = "5041122e20b76644cc690bba688671eecdc4626e6384a76eb740535d6ddcef14" dependencies = [ - "alloy-eips", "alloy-primitives", "alloy-rpc-types-engine", "alloy-serde", "derive_more 1.0.0", - "op-alloy-consensus", - "op-alloy-genesis", "op-alloy-protocol", "serde", ] @@ -3762,7 +3764,7 @@ checksum = "395027076c569819ea6035ee62e664f5e03d74e281744f55261dd1afd939212b" dependencies = [ "bytecheck", "bytes", - "hashbrown", + "hashbrown 0.14.5", "indexmap", "munge", "ptr_meta", @@ -4320,9 +4322,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "superchain" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a854c55867599645eb2f518a68af34094f3a76140d02280e2bf5e913a796ebb" +checksum = "3c17db382702137f40724f16c545cf8424d994bbc508d8cd030bb187e967c726" dependencies = [ "alloy-primitives", "lazy_static", @@ -4333,9 +4335,9 @@ dependencies = [ [[package]] name = "symbolic-common" -version = "12.11.1" +version = "12.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fdf97c441f18a4f92425b896a4ec7a27e03631a0b1047ec4e34e9916a9a167e" +checksum = "366f1b4c6baf6cfefc234bbd4899535fca0b06c74443039a73f6dfb2fad88d77" dependencies = [ "debugid", "memmap2", @@ -4345,9 +4347,9 @@ dependencies = [ [[package]] name = "symbolic-demangle" -version = "12.11.1" +version = "12.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc8ece6b129e97e53d1fbb3f61d33a6a9e5369b11d01228c068094d6d134eaea" +checksum = "aba05ba5b9962ea5617baf556293720a8b2d0a282aa14ee4bf10e22efc7da8c8" dependencies = [ "cpp_demangle", "rustc-demangle", @@ -4848,9 +4850,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" diff --git a/Cargo.toml b/Cargo.toml index 16d0ea08..6368b953 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -133,7 +133,7 @@ alloy-node-bindings = { version = "0.4.0", default-features = false } alloy-transport-http = { version = "0.4.0", default-features = false } # OP Alloy -op-alloy-consensus = { version = "0.3.2", default-features = false } -op-alloy-protocol = { version = "0.3.2", default-features = false } -op-alloy-genesis = { version = "0.3.2", default-features = false } -op-alloy-rpc-types-engine = { version = "0.3.2", default-features = false } +op-alloy-consensus = { version = "0.3.3", default-features = false } +op-alloy-protocol = { version = "0.3.3", default-features = false } +op-alloy-genesis = { version = "0.3.3", default-features = false } +op-alloy-rpc-types-engine = { version = "0.3.3", default-features = false } diff --git a/bin/client/src/l2/chain_provider.rs b/bin/client/src/l2/chain_provider.rs index 077fa5ed..6e9a7b7a 100644 --- a/bin/client/src/l2/chain_provider.rs +++ b/bin/client/src/l2/chain_provider.rs @@ -10,10 +10,10 @@ use anyhow::{anyhow, Result}; use async_trait::async_trait; use kona_mpt::{OrderedListWalker, TrieHinter, TrieProvider}; use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType}; -use kona_providers::{to_system_config, L2ChainProvider}; +use kona_providers::L2ChainProvider; use op_alloy_consensus::{OpBlock, OpTxEnvelope}; use op_alloy_genesis::{RollupConfig, SystemConfig}; -use op_alloy_protocol::L2BlockInfo; +use op_alloy_protocol::{to_system_config, L2BlockInfo}; /// The oracle-backed L2 chain provider for the client program. #[derive(Debug, Clone)] diff --git a/crates/derive/src/attributes/mod.rs b/crates/derive/src/attributes/mod.rs index 54878ce6..d0b14ca9 100644 --- a/crates/derive/src/attributes/mod.rs +++ b/crates/derive/src/attributes/mod.rs @@ -9,13 +9,13 @@ use crate::{ use alloc::{boxed::Box, fmt::Debug, string::ToString, sync::Arc, vec, vec::Vec}; use alloy_consensus::{Eip658Value, Receipt}; use alloy_eips::{eip2718::Encodable2718, BlockNumHash}; -use alloy_primitives::{address, Address, Bytes, B256}; +use alloy_primitives::{address, Address, Bytes, B256, B64}; use alloy_rlp::Encodable; use alloy_rpc_types_engine::PayloadAttributes; use async_trait::async_trait; use kona_providers::{ChainProvider, L2ChainProvider}; use op_alloy_consensus::Hardforks; -use op_alloy_genesis::RollupConfig; +use op_alloy_genesis::{RollupConfig, SystemConfig}; use op_alloy_protocol::{decode_deposit, L1BlockInfoTx, L2BlockInfo, DEPOSIT_EVENT_ABI_HASH}; use op_alloy_rpc_types_engine::OptimismPayloadAttributes; @@ -196,10 +196,26 @@ where gas_limit: Some(u64::from_be_bytes( alloy_primitives::U64::from(sys_config.gas_limit).to_be_bytes(), )), + eip_1559_params: eip_1559_params_from_system_config(&sys_config), }) } } +/// Returns the eip1559 parameters from a [SystemConfig] encoded as a [B64]. +fn eip_1559_params_from_system_config(sys_config: &SystemConfig) -> Option { + if sys_config.eip1559_denominator.is_none() && sys_config.eip1559_elasticity.is_none() { + None + } else { + Some(B64::from_slice( + &[ + sys_config.eip1559_denominator.unwrap_or_default().to_be_bytes(), + sys_config.eip1559_elasticity.unwrap_or_default().to_be_bytes(), + ] + .concat(), + )) + } +} + /// Derive deposits as `Vec` for transaction receipts. /// /// Successful deposits must be emitted by the deposit contract and have the correct event @@ -295,6 +311,34 @@ mod tests { } } + #[test] + fn test_eip_1559_params_from_system_config_none() { + let sys_config = SystemConfig::default(); + assert_eq!(eip_1559_params_from_system_config(&sys_config), None); + } + + #[test] + fn test_eip_1559_params_from_system_config_some() { + let sys_config = SystemConfig { + eip1559_denominator: Some(1), + eip1559_elasticity: None, + ..Default::default() + }; + let expected = Some(B64::from_slice(&[1u32.to_be_bytes(), 0u32.to_be_bytes()].concat())); + assert_eq!(eip_1559_params_from_system_config(&sys_config), expected); + } + + #[test] + fn test_eip_1559_params_from_system_config() { + let sys_config = SystemConfig { + eip1559_denominator: Some(1), + eip1559_elasticity: Some(2), + ..Default::default() + }; + let expected = Some(B64::from_slice(&[1u32.to_be_bytes(), 2u32.to_be_bytes()].concat())); + assert_eq!(eip_1559_params_from_system_config(&sys_config), expected); + } + #[tokio::test] async fn test_derive_deposits_empty() { let receipts = vec![]; @@ -463,6 +507,7 @@ mod tests { gas_limit: Some(u64::from_be_bytes( alloy_primitives::U64::from(SystemConfig::default().gas_limit).to_be_bytes(), )), + eip_1559_params: None, }; assert_eq!(payload, expected); assert_eq!(payload.transactions.unwrap().len(), 1); @@ -508,6 +553,7 @@ mod tests { gas_limit: Some(u64::from_be_bytes( alloy_primitives::U64::from(SystemConfig::default().gas_limit).to_be_bytes(), )), + eip_1559_params: None, }; assert_eq!(payload, expected); assert_eq!(payload.transactions.unwrap().len(), 1); @@ -555,6 +601,7 @@ mod tests { gas_limit: Some(u64::from_be_bytes( alloy_primitives::U64::from(SystemConfig::default().gas_limit).to_be_bytes(), )), + eip_1559_params: None, }; assert_eq!(payload, expected); assert_eq!(payload.transactions.unwrap().len(), 7); @@ -601,6 +648,7 @@ mod tests { gas_limit: Some(u64::from_be_bytes( alloy_primitives::U64::from(SystemConfig::default().gas_limit).to_be_bytes(), )), + eip_1559_params: None, }; assert_eq!(payload, expected); assert_eq!(payload.transactions.unwrap().len(), 4); diff --git a/crates/derive/src/stages/attributes_queue.rs b/crates/derive/src/stages/attributes_queue.rs index 3a0a8fdc..b1d184bd 100644 --- a/crates/derive/src/stages/attributes_queue.rs +++ b/crates/derive/src/stages/attributes_queue.rs @@ -232,6 +232,7 @@ mod tests { no_tx_pool: Some(false), transactions: None, gas_limit: None, + eip_1559_params: None, } } diff --git a/crates/executor/benches/execution.rs b/crates/executor/benches/execution.rs index 6b0576a9..b3895ef5 100644 --- a/crates/executor/benches/execution.rs +++ b/crates/executor/benches/execution.rs @@ -126,6 +126,7 @@ fn execution(c: &mut Criterion) { gas_limit: Some(30_000_000), transactions: Some(raw_txs), no_tx_pool: Some(false), + eip_1559_params: None, }; op_mainnet_exec_bench("block_121065789_exec", parent_header, payload_attrs, b) @@ -167,6 +168,7 @@ fn execution(c: &mut Criterion) { gas_limit: Some(30_000_000), transactions: Some(raw_txs), no_tx_pool: Some(false), + eip_1559_params: None, }; op_mainnet_exec_bench("block_121135704_exec", parent_header, payload_attrs, b) diff --git a/crates/executor/src/lib.rs b/crates/executor/src/lib.rs index bc4729cc..0cde944d 100644 --- a/crates/executor/src/lib.rs +++ b/crates/executor/src/lib.rs @@ -747,6 +747,7 @@ mod test { gas_limit: Some(0x1c9c380), transactions: Some(alloc::vec![raw_tx.into()]), no_tx_pool: None, + eip_1559_params: None, }; let produced_header = l2_block_executor.execute_payload(payload_attrs).unwrap().clone(); @@ -809,6 +810,7 @@ mod test { gas_limit: Some(30000000), transactions: Some(raw_txs), no_tx_pool: Some(false), + eip_1559_params: None, }; let produced_header = l2_block_executor.execute_payload(payload_attrs).unwrap().clone(); @@ -878,6 +880,7 @@ mod test { gas_limit: Some(0x1c9c380), transactions: Some(raw_txs), no_tx_pool: Some(false), + eip_1559_params: None, }; let produced_header = l2_block_executor.execute_payload(payload_attrs).unwrap().clone(); @@ -941,6 +944,7 @@ mod test { gas_limit: Some(30_000_000), transactions: Some(raw_txs), no_tx_pool: None, + eip_1559_params: None, }; let produced_header = l2_block_executor.execute_payload(payload_attrs).unwrap().clone(); @@ -1013,6 +1017,7 @@ mod test { gas_limit: Some(30_000_000), transactions: Some(raw_txs), no_tx_pool: Some(false), + eip_1559_params: None, }; let produced_header = l2_block_executor.execute_payload(payload_attrs).unwrap().clone(); @@ -1090,6 +1095,7 @@ mod test { gas_limit: Some(30_000_000), transactions: Some(raw_txs), no_tx_pool: None, + eip_1559_params: None, }; let produced_header = l2_block_executor.execute_payload(payload_attrs).unwrap().clone(); diff --git a/crates/providers-alloy/src/alloy_providers.rs b/crates/providers-alloy/src/alloy_providers.rs index 5ef9fd80..7f2d9029 100644 --- a/crates/providers-alloy/src/alloy_providers.rs +++ b/crates/providers-alloy/src/alloy_providers.rs @@ -6,11 +6,11 @@ use alloy_provider::{Provider, ReqwestProvider}; use alloy_rlp::{Buf, Decodable}; use alloy_transport::{RpcError, TransportErrorKind, TransportResult}; use async_trait::async_trait; -use kona_providers::{to_system_config, ChainProvider, L2ChainProvider}; +use kona_providers::{ChainProvider, L2ChainProvider}; use lru::LruCache; use op_alloy_consensus::OpBlock; use op_alloy_genesis::{RollupConfig, SystemConfig}; -use op_alloy_protocol::{BlockInfo, L2BlockInfo}; +use op_alloy_protocol::{to_system_config, BlockInfo, L2BlockInfo}; use std::{boxed::Box, num::NonZeroUsize, sync::Arc, vec::Vec}; const CACHE_SIZE: usize = 16; diff --git a/crates/providers/Cargo.toml b/crates/providers/Cargo.toml index 14fb8db5..97c43577 100644 --- a/crates/providers/Cargo.toml +++ b/crates/providers/Cargo.toml @@ -22,5 +22,4 @@ op-alloy-genesis.workspace = true op-alloy-consensus = { workspace = true, features = ["k256"] } # Misc -thiserror.workspace = true async-trait.workspace = true diff --git a/crates/providers/src/lib.rs b/crates/providers/src/lib.rs index b0dec93e..b4840ec8 100644 --- a/crates/providers/src/lib.rs +++ b/crates/providers/src/lib.rs @@ -10,9 +10,6 @@ pub mod prelude { pub use super::*; } -mod utils; -pub use utils::{to_system_config, OpBlockConversionError}; - mod l1_chain_provider; pub use l1_chain_provider::ChainProvider; diff --git a/crates/providers/src/utils.rs b/crates/providers/src/utils.rs deleted file mode 100644 index a310b19f..00000000 --- a/crates/providers/src/utils.rs +++ /dev/null @@ -1,91 +0,0 @@ -//! Conversion utilities. - -use alloy_primitives::B256; -use op_alloy_consensus::{OpBlock, OpTxEnvelope}; -use op_alloy_genesis::{RollupConfig, SystemConfig}; -use op_alloy_protocol::{ - block_info::DecodeError, L1BlockInfoBedrock, L1BlockInfoEcotone, L1BlockInfoHolocene, - L1BlockInfoTx, -}; -use thiserror::Error; - -/// An error encountered during [OpBlock] conversion. -#[derive(Error, Debug)] -pub enum OpBlockConversionError { - /// Invalid genesis hash. - #[error("Invalid genesis hash. Expected {0}, got {1}")] - InvalidGenesisHash(B256, B256), - /// Invalid transaction type. - #[error("First payload transaction has unexpected type: {0}")] - InvalidTxType(u8), - /// L1 Info error - #[error(transparent)] - L1InfoError(#[from] DecodeError), - /// Missing system config in genesis block. - #[error("Missing system config in genesis block")] - MissingSystemConfigGenesis, - /// Empty transactions. - #[error("Empty transactions in payload. Block hash: {0}")] - EmptyTransactions(B256), -} - -/// Converts the [OpBlock] to a partial [SystemConfig]. -pub fn to_system_config( - block: &OpBlock, - rollup_config: &RollupConfig, -) -> Result { - if block.header.number == rollup_config.genesis.l2.number { - if block.header.hash_slow() != rollup_config.genesis.l2.hash { - return Err(OpBlockConversionError::InvalidGenesisHash( - rollup_config.genesis.l2.hash, - block.header.hash_slow(), - )); - } - return rollup_config - .genesis - .system_config - .ok_or(OpBlockConversionError::MissingSystemConfigGenesis); - } - - if block.body.transactions.is_empty() { - return Err(OpBlockConversionError::EmptyTransactions(block.header.hash_slow())); - } - let OpTxEnvelope::Deposit(ref tx) = block.body.transactions[0] else { - return Err(OpBlockConversionError::InvalidTxType( - block.body.transactions[0].tx_type() as u8 - )); - }; - - let l1_info = L1BlockInfoTx::decode_calldata(tx.input.as_ref())?; - let l1_fee_scalar = match l1_info { - L1BlockInfoTx::Bedrock(L1BlockInfoBedrock { l1_fee_scalar, .. }) => l1_fee_scalar, - L1BlockInfoTx::Ecotone(L1BlockInfoEcotone { - base_fee_scalar, - blob_base_fee_scalar, - .. - }) | - L1BlockInfoTx::Holocene(L1BlockInfoHolocene { - base_fee_scalar, - blob_base_fee_scalar, - .. - }) => { - // Translate Ecotone values back into encoded scalar if needed. - // We do not know if it was derived from a v0 or v1 scalar, - // but v1 is fine, a 0 blob base fee has the same effect. - let mut buf = B256::ZERO; - buf[0] = 0x01; - buf[24..28].copy_from_slice(blob_base_fee_scalar.to_be_bytes().as_ref()); - buf[28..32].copy_from_slice(base_fee_scalar.to_be_bytes().as_ref()); - buf.into() - } - }; - - Ok(SystemConfig { - batcher_address: l1_info.batcher_address(), - overhead: l1_info.l1_fee_overhead(), - scalar: l1_fee_scalar, - gas_limit: block.header.gas_limit, - base_fee_scalar: None, - blob_base_fee_scalar: None, - }) -} diff --git a/examples/trusted-sync/src/validation.rs b/examples/trusted-sync/src/validation.rs index dd4d7f34..a1d28281 100644 --- a/examples/trusted-sync/src/validation.rs +++ b/examples/trusted-sync/src/validation.rs @@ -21,12 +21,18 @@ pub struct OnlineValidator { provider: ReqwestProvider, /// The canyon activation timestamp. canyon_activation: u64, + /// The holocene activation timestamp. + holocene_activation: u64, } impl OnlineValidator { /// Creates a new `OnlineValidator`. pub fn new(provider: ReqwestProvider, cfg: &RollupConfig) -> Self { - Self { provider, canyon_activation: cfg.canyon_time.unwrap_or_default() } + Self { + provider, + canyon_activation: cfg.canyon_time.unwrap_or_default(), + holocene_activation: cfg.holocene_time.unwrap_or_default(), + } } /// Creates a new [OnlineValidator] from the provided [reqwest::Url]. @@ -80,6 +86,11 @@ impl OnlineValidator { transactions: Some(transactions), no_tx_pool: Some(true), gas_limit: Some(header.gas_limit), + eip_1559_params: if header.timestamp >= self.holocene_activation { + header.nonce + } else { + None + }, }) }