diff --git a/Cargo.lock b/Cargo.lock index 042209bfcf6..f1c3002dd75 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -259,9 +259,9 @@ dependencies = [ [[package]] name = "alloy-evm" -version = "0.16.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a3c4a8d217f8ac0d0e5f890979646037d59a85fd3fc8f5b03d2f7a59b8d134" +checksum = "4042e855163839443cba91147fb7737c4aba02df4767cb322b0e8cea5a77642c" dependencies = [ "alloy-consensus", "alloy-eips", @@ -293,9 +293,9 @@ dependencies = [ [[package]] name = "alloy-hardforks" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819a3620fe125e0fff365363315ee5e24c23169173b19747dfd6deba33db8990" +checksum = "3165210652f71dfc094b051602bafd691f506c54050a174b1cba18fb5ef706a3" dependencies = [ "alloy-chains", "alloy-eip2124", @@ -373,9 +373,9 @@ dependencies = [ [[package]] name = "alloy-op-evm" -version = "0.16.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0286cb45e87871995815db4ce8bc560ba35f7db4cc084e48a79b355db3342bd" +checksum = "e8c0bc6a883d3198c43c4018aa952448a303dec265439fa1c2e7c4397beeb289" dependencies = [ "alloy-consensus", "alloy-eips", @@ -390,9 +390,9 @@ dependencies = [ [[package]] name = "alloy-op-hardforks" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2090f21bb6df43e147d976e754bc9a007ca851badbfc6685377aa679b5f151d9" +checksum = "3417f4187eaf7f7fb0d7556f0197bca26f0b23c4bb3aca0c9d566dc1c5d727a2" dependencies = [ "alloy-chains", "alloy-hardforks", @@ -1479,9 +1479,9 @@ checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" [[package]] name = "backon" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302eaff5357a264a2c42f127ecb8bac761cf99749fc3dc95677e2743991f99e7" +checksum = "592277618714fbcecda9a02ba7a8781f319d26532a88553bbacc77ba5d2b3a8d" dependencies = [ "fastrand 2.3.0", "tokio", @@ -2137,9 +2137,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.41" +version = "4.5.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" +checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882" dependencies = [ "clap_builder", "clap_derive", @@ -2147,9 +2147,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.41" +version = "4.5.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" +checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966" dependencies = [ "anstream", "anstyle", @@ -2303,7 +2303,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -2954,7 +2954,7 @@ checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" dependencies = [ "libc", "option-ext", - "redox_users 0.5.0", + "redox_users 0.5.2", "windows-sys 0.60.2", ] @@ -3027,9 +3027,9 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "dyn-clone" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" [[package]] name = "ecdsa" @@ -4525,7 +4525,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.58.0", + "windows-core 0.61.2", ] [[package]] @@ -5337,7 +5337,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.53.3", ] [[package]] @@ -5378,9 +5378,9 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4488594b9328dee448adb906d8b126d9b7deb7cf5c22161ee591610bb1be83c0" +checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" dependencies = [ "bitflags 2.9.1", "libc", @@ -6092,9 +6092,9 @@ checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" [[package]] name = "op-alloy-consensus" -version = "0.18.13" +version = "0.18.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3c719b26da6d9cac18c3a35634d6ab27a74a304ed9b403b43749c22e57a389f" +checksum = "0c88d2940558fd69f8f07b3cbd7bb3c02fc7d31159c1a7ba9deede50e7881024" dependencies = [ "alloy-consensus", "alloy-eips", @@ -6118,9 +6118,9 @@ checksum = "a79f352fc3893dcd670172e615afef993a41798a1d3fc0db88a3e60ef2e70ecc" [[package]] name = "op-alloy-network" -version = "0.18.13" +version = "0.18.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66be312d3446099f1c46b3bb4bbaccdd4b3d6fb3668921158e3d47dff0a8d4a0" +checksum = "7071d7c3457d02aa0d35799cb8fbd93eabd51a21d100dcf411f4fcab6fdd2ea5" dependencies = [ "alloy-consensus", "alloy-network", @@ -6134,9 +6134,9 @@ dependencies = [ [[package]] name = "op-alloy-rpc-jsonrpsee" -version = "0.18.13" +version = "0.18.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3833995acfc568fdac3684f037c4ed3f1f2bd2ef5deeb3f46ecee32aafa34c8e" +checksum = "327fc8be822ca7d4be006c69779853fa27e747cff4456a1c2ef521a68ac26432" dependencies = [ "alloy-primitives", "jsonrpsee", @@ -6144,9 +6144,9 @@ dependencies = [ [[package]] name = "op-alloy-rpc-types" -version = "0.18.13" +version = "0.18.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99911fa02e717a96ba24de59874b20cf31c9d116ce79ed4e0253267260b6922f" +checksum = "f22201e53e8cbb67a053e88b534b4e7f02265c5406994bf35978482a9ad0ae26" dependencies = [ "alloy-consensus", "alloy-eips", @@ -6164,9 +6164,9 @@ dependencies = [ [[package]] name = "op-alloy-rpc-types-engine" -version = "0.18.13" +version = "0.18.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cf45d43a3d548fdc39d9bfab6ba13cc06b3214ef4b9c36d3efbf3faea1b9f1" +checksum = "b2b4f977b51e9e177e69a4d241ab7c4b439df9a3a5a998c000ae01be724de271" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7141,9 +7141,9 @@ checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" [[package]] name = "redox_syscall" -version = "0.5.16" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7251471db004e509f4e75a62cca9435365b5ec7bcdff530d612ac7c87c44a792" +checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" dependencies = [ "bitflags 2.9.1", ] @@ -7161,9 +7161,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" dependencies = [ "getrandom 0.2.16", "libredox", @@ -11547,9 +11547,9 @@ checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" [[package]] name = "rustc-demangle" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "rustc-hash" @@ -11618,9 +11618,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.29" +version = "0.23.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2491382039b29b9b11ff08b76ff6c97cf287671dbb74f0be44bda389fffe9bd1" +checksum = "c0ebcbd2f03de0fc1122ad9bb24b127a5a6cd51d72604a3f3c50ac459762b6cc" dependencies = [ "log", "once_cell", @@ -12097,9 +12097,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.141" +version = "1.0.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3" +checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" dependencies = [ "indexmap 2.10.0", "itoa", @@ -12927,9 +12927,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.47.0" +version = "1.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43864ed400b6043a4757a25c7a64a8efde741aed79a056a2fb348a406701bb35" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" dependencies = [ "backtrace", "bytes", @@ -13007,9 +13007,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.15" +version = "0.7.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" dependencies = [ "bytes", "futures-core", @@ -13311,7 +13311,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "319c70195101a93f56db4c74733e272d720768e13471f400c78406a326b172b0" dependencies = [ "cc", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -13857,7 +13857,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -14138,7 +14138,7 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.2", + "windows-targets 0.53.3", ] [[package]] @@ -14189,10 +14189,11 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.2" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ + "windows-link", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", diff --git a/crates/scroll/node/src/builder/payload.rs b/crates/scroll/node/src/builder/payload.rs index c4c2624d8d7..25761255bac 100644 --- a/crates/scroll/node/src/builder/payload.rs +++ b/crates/scroll/node/src/builder/payload.rs @@ -70,7 +70,7 @@ impl ScrollPayloadBuilderBuilder { evm_config, ctx.provider().clone(), ScrollBuilderConfig::new( - gas_limit, + Some(gas_limit), self.payload_building_time_limit, self.block_da_size_limit, ), diff --git a/crates/scroll/payload/src/builder.rs b/crates/scroll/payload/src/builder.rs index bd7619b6e61..d0bf505d029 100644 --- a/crates/scroll/payload/src/builder.rs +++ b/crates/scroll/payload/src/builder.rs @@ -414,7 +414,10 @@ where ScrollNextBlockEnvAttributes { timestamp: self.attributes().timestamp(), suggested_fee_recipient: self.attributes().suggested_fee_recipient(), - gas_limit: self.attributes().gas_limit.unwrap_or(builder_config.gas_limit), + gas_limit: self + .attributes() + .gas_limit + .unwrap_or_else(|| builder_config.gas_limit.unwrap_or_default()), base_fee, }, ) diff --git a/crates/scroll/payload/src/config.rs b/crates/scroll/payload/src/config.rs index d3dc286dd7c..bbccb868384 100644 --- a/crates/scroll/payload/src/config.rs +++ b/crates/scroll/payload/src/config.rs @@ -8,7 +8,7 @@ use std::{fmt::Debug, time::Instant}; #[derive(Debug, PartialEq, Eq, Clone)] pub struct ScrollBuilderConfig { /// Gas limit. - pub gas_limit: u64, + pub gas_limit: Option, /// Time limit for payload building. pub time_limit: Duration, /// Maximum total data availability size for a block. @@ -20,7 +20,11 @@ pub const MIN_TRANSACTION_DATA_SIZE: u64 = 115u64; impl ScrollBuilderConfig { /// Returns a new instance of [`ScrollBuilderConfig`]. - pub const fn new(gas_limit: u64, time_limit: Duration, max_da_block_size: Option) -> Self { + pub const fn new( + gas_limit: Option, + time_limit: Duration, + max_da_block_size: Option, + ) -> Self { Self { gas_limit, time_limit, max_da_block_size } } @@ -35,13 +39,13 @@ impl ScrollBuilderConfig { pub struct PayloadBuildingBreaker { start: Instant, time_limit: Duration, - gas_limit: u64, + gas_limit: Option, max_da_block_size: Option, } impl PayloadBuildingBreaker { /// Returns a new instance of the [`PayloadBuildingBreaker`]. - fn new(time_limit: Duration, gas_limit: u64, max_da_block_size: Option) -> Self { + fn new(time_limit: Duration, gas_limit: Option, max_da_block_size: Option) -> Self { Self { start: Instant::now(), time_limit, gas_limit, max_da_block_size } } @@ -56,9 +60,11 @@ impl PayloadBuildingBreaker { return true; } - // Check gas limit - if cumulative_gas_used > self.gas_limit.saturating_sub(MIN_TRANSACTION_GAS) { - return true; + // Check gas limit if configured + if let Some(gas_limit) = self.gas_limit { + if cumulative_gas_used > gas_limit.saturating_sub(MIN_TRANSACTION_GAS) { + return true; + } } // Check data availability size limit if configured @@ -80,7 +86,7 @@ mod tests { fn test_should_break_on_time_limit() { let breaker = PayloadBuildingBreaker::new( Duration::from_millis(200), - 2 * MIN_TRANSACTION_GAS, + Some(2 * MIN_TRANSACTION_GAS), Some(2 * MIN_TRANSACTION_DATA_SIZE), ); assert!(!breaker.should_break(MIN_TRANSACTION_GAS, MIN_TRANSACTION_DATA_SIZE)); @@ -92,7 +98,7 @@ mod tests { fn test_should_break_on_gas_limit() { let breaker = PayloadBuildingBreaker::new( Duration::from_secs(1), - 2 * MIN_TRANSACTION_GAS, + Some(2 * MIN_TRANSACTION_GAS), Some(2 * MIN_TRANSACTION_DATA_SIZE), ); assert!(!breaker.should_break(MIN_TRANSACTION_GAS, MIN_TRANSACTION_DATA_SIZE)); @@ -103,7 +109,7 @@ mod tests { fn test_should_break_on_data_size_limit() { let breaker = PayloadBuildingBreaker::new( Duration::from_secs(1), - 2 * MIN_TRANSACTION_GAS, + Some(2 * MIN_TRANSACTION_GAS), Some(2 * MIN_TRANSACTION_DATA_SIZE), ); assert!(!breaker.should_break(MIN_TRANSACTION_GAS, MIN_TRANSACTION_DATA_SIZE)); @@ -114,7 +120,7 @@ mod tests { fn test_should_break_with_no_da_limit() { let breaker = PayloadBuildingBreaker::new( Duration::from_secs(1), - 2 * MIN_TRANSACTION_GAS, + Some(2 * MIN_TRANSACTION_GAS), None, // No DA limit ); // Should not break on large DA size when no limit is set