Skip to content

Commit 76f9c0c

Browse files
authored
feat: add l1 data fee buffer check (#486)
* add l1 data fee buffer check * update reth * update tag and fix docker genesis
1 parent 0330e50 commit 76f9c0c

File tree

12 files changed

+357
-198
lines changed

12 files changed

+357
-198
lines changed

Cargo.lock

Lines changed: 144 additions & 141 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ strip = "none"
127127
alloy-chains = { version = "0.2.5", default-features = false }
128128
alloy-consensus = { version = "1.0.37", default-features = false }
129129
alloy-eips = { version = "1.0.37", default-features = false }
130+
alloy-genesis = { version = "1.0.37", default-features = false }
130131
alloy-json-rpc = { version = "1.0.37", default-features = false }
131132
alloy-network = { version = "1.0.37", default-features = false }
132133
alloy-primitives = { version = "1.4.1", default-features = false }
@@ -140,59 +141,59 @@ alloy-signer-local = { version = "1.0.37", default-features = false }
140141
alloy-transport = { version = "1.0.37", default-features = false }
141142

142143
# scroll-alloy
143-
scroll-alloy-consensus = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
144-
scroll-alloy-hardforks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
145-
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
146-
scroll-alloy-provider = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
147-
scroll-alloy-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
148-
scroll-alloy-rpc-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
149-
scroll-alloy-rpc-types-engine = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
144+
scroll-alloy-consensus = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
145+
scroll-alloy-hardforks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
146+
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
147+
scroll-alloy-provider = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
148+
scroll-alloy-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
149+
scroll-alloy-rpc-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
150+
scroll-alloy-rpc-types-engine = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
150151

151152
# reth
152-
reth-chainspec = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
153-
reth-e2e-test-utils = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5" }
154-
reth-eth-wire = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
155-
reth-eth-wire-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
156-
reth-network = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
157-
reth-network-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
158-
reth-network-p2p = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
159-
reth-network-peers = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
160-
reth-network-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
161-
reth-node-builder = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
162-
reth-node-core = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
163-
reth-node-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
164-
reth-node-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
165-
reth-payload-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
166-
reth-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
167-
reth-primitives-traits = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
168-
reth-provider = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
169-
reth-rpc-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
170-
reth-rpc-eth-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
171-
reth-rpc-eth-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
172-
reth-rpc-layer = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
173-
reth-rpc-server-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
174-
reth-storage-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
175-
reth-tasks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
176-
reth-tokio-util = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
177-
reth-tracing = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
178-
reth-transaction-pool = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
179-
reth-trie-db = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
180-
reth-testing-utils = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
181-
reth-revm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
182-
reth-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
183-
reth-engine-local = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
184-
reth-cli-util = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
153+
reth-chainspec = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
154+
reth-e2e-test-utils = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7" }
155+
reth-eth-wire = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
156+
reth-eth-wire-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
157+
reth-network = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
158+
reth-network-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
159+
reth-network-p2p = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
160+
reth-network-peers = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
161+
reth-network-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
162+
reth-node-builder = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
163+
reth-node-core = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
164+
reth-node-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
165+
reth-node-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
166+
reth-payload-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
167+
reth-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
168+
reth-primitives-traits = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
169+
reth-provider = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
170+
reth-rpc-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
171+
reth-rpc-eth-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
172+
reth-rpc-eth-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
173+
reth-rpc-layer = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
174+
reth-rpc-server-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
175+
reth-storage-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
176+
reth-tasks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
177+
reth-tokio-util = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
178+
reth-tracing = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
179+
reth-transaction-pool = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
180+
reth-trie-db = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
181+
reth-testing-utils = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
182+
reth-revm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
183+
reth-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
184+
reth-engine-local = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
185+
reth-cli-util = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
185186

186187
# reth-scroll
187-
reth-scroll-chainspec = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
188-
reth-scroll-consensus = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
189-
reth-scroll-cli = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
190-
reth-scroll-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
191-
reth-scroll-rpc = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
192-
reth-scroll-engine-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
193-
reth-scroll-forks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
194-
reth-scroll-node = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
195-
reth-scroll-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.5", default-features = false }
188+
reth-scroll-chainspec = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
189+
reth-scroll-consensus = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
190+
reth-scroll-cli = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
191+
reth-scroll-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
192+
reth-scroll-rpc = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
193+
reth-scroll-engine-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
194+
reth-scroll-forks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
195+
reth-scroll-node = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
196+
reth-scroll-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.7", default-features = false }
196197

197198
# rollup node
198199
rollup-node = { path = "crates/node" }
@@ -239,8 +240,8 @@ tracing = "0.1.0"
239240
getrandom = { version = "0.2", features = ["js"] }
240241

241242
[patch.crates-io]
242-
revm = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
243-
op-revm = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
243+
revm = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91.1" }
244+
op-revm = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91.1" }
244245

245246
# [patch."https://github.com/scroll-tech/reth.git"]
246247
# reth-chainspec = { path = "../reth/crates/chainspec" }

crates/node/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ http-body-util = "0.1"
114114

115115
[dev-dependencies]
116116
alloy-chains.workspace = true
117+
alloy-consensus.workspace = true
118+
alloy-genesis.workspace = true
117119
alloy-eips.workspace = true
118120
futures.workspace = true
119121
reth-e2e-test-utils.workspace = true

crates/node/src/args.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ pub struct ScrollRollupNodeConfig {
100100
/// The database connection (not parsed via CLI but hydrated after validation).
101101
#[arg(skip)]
102102
pub database: Option<Arc<Database>>,
103+
/// Require an additional L1 data fee buffer in the account balance checks for transactions.
104+
#[arg(
105+
long = "require-l1-data-fee-buffer",
106+
value_name = "REQUIRE_L1_DATA_FEE_BUFFER",
107+
default_value = "false"
108+
)]
109+
pub require_l1_data_fee_buffer: bool,
103110
}
104111

105112
impl ScrollRollupNodeConfig {
@@ -1047,6 +1054,7 @@ mod tests {
10471054
rpc_args: RpcArgs::default(),
10481055
pprof_args: PprofArgs::default(),
10491056
remote_block_source_args: RemoteBlockSourceArgs::default(),
1057+
require_l1_data_fee_buffer: false,
10501058
};
10511059

10521060
let result = config.validate();
@@ -1078,6 +1086,7 @@ mod tests {
10781086
url: None,
10791087
poll_interval_ms: 100,
10801088
},
1089+
require_l1_data_fee_buffer: false,
10811090
};
10821091

10831092
let result = config.validate();
@@ -1112,6 +1121,7 @@ mod tests {
11121121
rpc_args: RpcArgs::default(),
11131122
pprof_args: PprofArgs::default(),
11141123
remote_block_source_args: RemoteBlockSourceArgs::default(),
1124+
require_l1_data_fee_buffer: false,
11151125
};
11161126

11171127
let result = config.validate();
@@ -1141,6 +1151,7 @@ mod tests {
11411151
rpc_args: RpcArgs::default(),
11421152
pprof_args: PprofArgs::default(),
11431153
remote_block_source_args: RemoteBlockSourceArgs::default(),
1154+
require_l1_data_fee_buffer: false,
11441155
};
11451156

11461157
assert!(config.validate().is_ok());
@@ -1168,6 +1179,7 @@ mod tests {
11681179
rpc_args: RpcArgs::default(),
11691180
pprof_args: PprofArgs::default(),
11701181
remote_block_source_args: RemoteBlockSourceArgs::default(),
1182+
require_l1_data_fee_buffer: false,
11711183
};
11721184

11731185
assert!(config.validate().is_ok());
@@ -1191,6 +1203,7 @@ mod tests {
11911203
rpc_args: RpcArgs::default(),
11921204
pprof_args: PprofArgs::default(),
11931205
remote_block_source_args: RemoteBlockSourceArgs::default(),
1206+
require_l1_data_fee_buffer: false,
11941207
};
11951208

11961209
assert!(config.validate().is_ok());

crates/node/src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@ fn main() {
3030
if let Err(err) = Cli::<ScrollChainSpecParser, ScrollRollupNodeConfig>::parse().run(
3131
|builder, args| async move {
3232
info!(target: "reth::cli", "Launching node");
33+
34+
// Modify the chain spec based on the CLI args.
3335
let config = builder.config().clone();
36+
let mut chain_spec = (*config.chain).clone();
37+
chain_spec.config.l1_data_fee_buffer_check = args.require_l1_data_fee_buffer;
38+
let config = config.with_chain(chain_spec);
39+
40+
// Launch the node.
3441
let handle = builder
3542
.node(ScrollRollupNode::new(args, config).await)
3643
.launch_with_fn(|builder| {

crates/node/src/test_utils/fixture.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
};
1212

1313
use alloy_eips::BlockNumberOrTag;
14-
use alloy_primitives::Address;
14+
use alloy_primitives::{Address, B256};
1515
use alloy_rpc_types_eth::Block;
1616
use alloy_signer_local::PrivateKeySigner;
1717
use reth_chainspec::EthChainSpec;
@@ -171,9 +171,8 @@ impl TestFixture {
171171
&mut self,
172172
node_index: usize,
173173
tx: impl Into<alloy_primitives::Bytes>,
174-
) -> eyre::Result<()> {
175-
self.nodes[node_index].node.rpc.inject_tx(tx.into()).await?;
176-
Ok(())
174+
) -> eyre::Result<B256> {
175+
Ok(self.nodes[node_index].node.rpc.inject_tx(tx.into()).await?)
177176
}
178177

179178
/// Get the current (latest) block from a specific node.
@@ -216,7 +215,7 @@ impl TestFixture {
216215
}
217216

218217
/// Builder for creating test fixtures with a fluent API.
219-
#[derive(Debug)]
218+
#[derive(Debug, Clone)]
220219
pub struct TestFixtureBuilder {
221220
config: ScrollRollupNodeConfig,
222221
num_nodes: usize,
@@ -270,6 +269,7 @@ impl TestFixtureBuilder {
270269
rpc_args: RpcArgs { basic_enabled: true, admin_enabled: true },
271270
remote_block_source_args: Default::default(),
272271
pprof_args: PprofArgs::default(),
272+
require_l1_data_fee_buffer: false,
273273
}
274274
}
275275

@@ -444,6 +444,15 @@ impl TestFixtureBuilder {
444444
&mut self.config
445445
}
446446

447+
/// Modify the underlying config using a closure.
448+
pub fn config<F>(mut self, f: F) -> Self
449+
where
450+
F: FnOnce(&mut ScrollRollupNodeConfig),
451+
{
452+
f(&mut self.config);
453+
self
454+
}
455+
447456
/// Build the test fixture.
448457
pub async fn build(self) -> eyre::Result<TestFixture> {
449458
let config = self.config;

crates/node/src/test_utils/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ where
140140

141141
// Create nodes and peer them
142142
let mut nodes: Vec<NodeTestContext<_, _>> = Vec::with_capacity(num_nodes);
143-
143+
let mut chain_spec = Arc::unwrap_or_clone(chain_spec);
144+
chain_spec.config.l1_data_fee_buffer_check = scroll_node_config.require_l1_data_fee_buffer;
145+
let chain_spec = Arc::new(chain_spec);
144146
for idx in 0..num_nodes {
145147
// disable sequencer nodes after the first one
146148
if idx != 0 {
@@ -243,6 +245,7 @@ pub fn default_test_scroll_rollup_node_config() -> ScrollRollupNodeConfig {
243245
pprof_args: PprofArgs::default(),
244246
remote_block_source_args: Default::default(),
245247
rpc_args: RpcArgs { basic_enabled: true, admin_enabled: true },
248+
require_l1_data_fee_buffer: false,
246249
}
247250
}
248251

@@ -285,5 +288,6 @@ pub fn default_sequencer_test_scroll_rollup_node_config() -> ScrollRollupNodeCon
285288
remote_block_source_args: Default::default(),
286289
pprof_args: PprofArgs::default(),
287290
rpc_args: RpcArgs { basic_enabled: true, admin_enabled: true },
291+
require_l1_data_fee_buffer: false,
288292
}
289293
}

crates/node/tests/e2e.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,7 @@ async fn test_custom_genesis_block_production_and_propagation() -> eyre::Result<
16101610
"scroll": {
16111611
"feeVaultAddress": "0x5300000000000000000000000000000000000005",
16121612
"maxTxPayloadBytesPerBlock": 122880,
1613+
"l1DataFeeBufferCheck": false,
16131614
"l1Config": {
16141615
"l1ChainId": 1,
16151616
"l1MessageQueueAddress": "0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B",

0 commit comments

Comments
 (0)