Skip to content

Commit 2cb551b

Browse files
authored
feat(eth_sender): Allow to use validator timelock from the config (#4370)
## What ❔ <!-- What are the changes this PR brings about? --> <!-- Example: This PR adds a PR template to the repo. --> <!-- (For bigger PRs adding more context is appreciated) --> ## Why ❔ <!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? --> <!-- The `Why` has to be clear to non-Matter Labs entities running their own ZK Chain --> <!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. --> ## Is this a breaking change? - [ ] Yes - [ ] No ## Operational changes <!-- Any config changes? Any new flags? Any changes to any scripts? --> <!-- Please add anything that non-Matter Labs entities running their own ZK Chain may need to know --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`. Signed-off-by: Danil <[email protected]>
1 parent 80a20d9 commit 2cb551b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

core/lib/config/src/configs/eth_sender.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ impl EthConfig {
5353
max_acceptable_base_fee_in_wei: 100000000000,
5454
time_in_mempool_multiplier_cap: None,
5555
precommit_params: None,
56+
force_use_validator_timelock: false,
5657
},
5758
gas_adjuster: GasAdjusterConfig {
5859
default_priority_fee_per_gas: 1000000000,
@@ -173,6 +174,9 @@ pub struct SenderConfig {
173174
/// Parameters for precommit operation.
174175
#[config(nest)]
175176
pub precommit_params: Option<PrecommitParams>,
177+
/// Allow to force change the validator timelock address.
178+
#[config(default)]
179+
pub force_use_validator_timelock: bool,
176180
}
177181

178182
/// We send precommit if l2_blocks_to_aggregate OR deadline_sec passed since last precommit or beginning of batch.
@@ -296,6 +300,7 @@ mod tests {
296300
l2_blocks_to_aggregate: 1,
297301
deadline: Duration::from_secs(1),
298302
}),
303+
force_use_validator_timelock: false,
299304
},
300305
gas_adjuster: GasAdjusterConfig {
301306
default_priority_fee_per_gas: 20000000000,
@@ -395,6 +400,7 @@ mod tests {
395400
gas_limit_mode: Calculated
396401
max_acceptable_base_fee_in_wei: 100000000000
397402
time_in_mempool_multiplier_cap: 10
403+
force_use_validator_timelock: false
398404
precommit_params:
399405
l2_blocks_to_aggregate: 1
400406
deadline: 1 sec
@@ -451,6 +457,7 @@ mod tests {
451457
gas_limit_mode: Calculated
452458
max_acceptable_base_fee_in_wei: 100000000000
453459
time_in_mempool_multiplier_cap: 10
460+
force_use_validator_timelock: false
454461
precommit_params:
455462
l2_blocks_to_aggregate: 1
456463
deadline: 1 sec

core/node/eth_sender/src/eth_tx_aggregator.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,9 @@ impl EthTxAggregator {
576576
// For chains before v26 (gateway) we use the timelock address from config.
577577
// After that, the timelock address can be fetched from STM as it is the valid one
578578
// for versions starting from v26 and is not expected to change in the near future.
579-
if chain_protocol_version_id < ProtocolVersionId::gateway_upgrade() {
579+
if chain_protocol_version_id < ProtocolVersionId::gateway_upgrade()
580+
|| self.config.force_use_validator_timelock
581+
{
580582
self.config_timelock_contract_address
581583
} else {
582584
assert!(

0 commit comments

Comments
 (0)