Skip to content

Commit 4502f07

Browse files
authored
fix: unbounded lock delay (#16951)
Alters configuration limits used in the Governance! Allow values up to 90 days for most values, but up to `uint32` for the lock delay.
2 parents 83084b7 + 45e3bdb commit 4502f07

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

l1-contracts/src/governance/libraries/ConfigurationLib.sol

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ library ConfigurationLib {
2323
uint256 internal constant LOCK_AMOUNT_UPPER = type(uint96).max; // Maximum for compressed storage (uint96)
2424

2525
Timestamp internal constant TIME_LOWER = Timestamp.wrap(60);
26-
Timestamp internal constant TIME_UPPER = Timestamp.wrap(30 * 24 * 3600);
26+
Timestamp internal constant TIME_UPPER = Timestamp.wrap(90 * 24 * 3600);
2727

2828
/**
2929
* @notice The delay after which a withdrawal can be finalized.
@@ -66,12 +66,13 @@ library ConfigurationLib {
6666
);
6767

6868
// Beyond checking the bounds like this, it might be useful to ensure that the value is larger than the withdrawal
69-
// delay
70-
// this, can be useful if one want to ensure that the "locker" cannot himself vote in the proposal, but as it is
71-
// unclear
72-
// if this is a useful property, it is not enforced.
69+
// delay. this, can be useful if one want to ensure that the "locker" cannot himself vote in the proposal, but as
70+
// it is unclear if this is a useful property, it is not enforced.
7371
require(_self.proposeConfig.lockDelay >= TIME_LOWER, Errors.Governance__ConfigurationLib__TimeTooSmall("LockDelay"));
74-
require(_self.proposeConfig.lockDelay <= TIME_UPPER, Errors.Governance__ConfigurationLib__TimeTooBig("LockDelay"));
72+
require(
73+
_self.proposeConfig.lockDelay <= Timestamp.wrap(type(uint32).max),
74+
Errors.Governance__ConfigurationLib__TimeTooBig("LockDelay")
75+
);
7576

7677
require(_self.votingDelay >= TIME_LOWER, Errors.Governance__ConfigurationLib__TimeTooSmall("VotingDelay"));
7778
require(_self.votingDelay <= TIME_UPPER, Errors.Governance__ConfigurationLib__TimeTooBig("VotingDelay"));

l1-contracts/test/governance/governance/updateConfiguration.t.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ contract UpdateConfigurationTest is GovernanceBase {
8585
vm.prank(address(governance));
8686
governance.updateConfiguration(config);
8787

88-
config.proposeConfig.lockDelay =
89-
Timestamp.wrap(bound(_val, Timestamp.unwrap(ConfigurationLib.TIME_UPPER) + 1, type(uint256).max));
88+
config.proposeConfig.lockDelay = Timestamp.wrap(uint256(type(uint32).max) + 1);
9089
vm.expectRevert(abi.encodeWithSelector(Errors.Governance__ConfigurationLib__TimeTooBig.selector, "LockDelay"));
9190
vm.prank(address(governance));
9291
governance.updateConfiguration(config);

0 commit comments

Comments
 (0)