Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set sequencer inbox maxtimevariation action contract #233

Merged
merged 11 commits into from
Mar 19, 2024
1 change: 1 addition & 0 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ SequencerActionsTest:testAddAndRemoveSequencer() (gas: 483444)
SequencerActionsTest:testCantAddZeroAddress() (gas: 235614)
SetInitialGovParamsActionTest:testL1() (gas: 259904)
SetInitialGovParamsActionTest:testL2() (gas: 688888)
SetSequencerInboxMaxTimeVariationAction:testSetMaxTimeVariation() (gas: 374240)
TokenDistributorTest:testClaim() (gas: 5742744)
TokenDistributorTest:testClaimAndDelegate() (gas: 5850827)
TokenDistributorTest:testClaimAndDelegateFailsForExpired() (gas: 5748244)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "../../address-registries/interfaces.sol";
import "../../sequencer/SetSequencerInboxMaxTimeVariationAction.sol";

/// @notice Set the future blocks / future seconds to 64 blocks and 64 * 12 seconds so that small L1 reorgs don't cause batches to revert. Delay blocks / delay seconds remain their current values.contract
contract AIPSetSequencerInboxMaxTimeVariationArbOneAction is
SetSequencerInboxMaxTimeVariationAction
{
constructor()
SetSequencerInboxMaxTimeVariationAction(
ISequencerInboxGetter(0xd514C2b3aaBDBfa10800B9C96dc1eB25427520A0), // Arb One Address Registry
5760, // Delay blocks (same as current value)
64, // New future blocks value
86_400, // Delay seconds (same as current value)
768 // New future seconds value (future blocks * 12)
)
{}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "../../address-registries/interfaces.sol";
import "../../sequencer/SetSequencerInboxMaxTimeVariationAction.sol";

/// @notice Set the future blocks / future seconds to 64 blocks and 64 * 12 seconds so that small L1 reorgs don't cause batches to revert. Delay blocks / delay seconds remain their current values.
contract AIPSetSequencerInboxMaxTimeVariationNovaAction is
SetSequencerInboxMaxTimeVariationAction
{
constructor()
SetSequencerInboxMaxTimeVariationAction(
ISequencerInboxGetter(0x2F06643fc2CC18585Ae790b546388F0DE4Ec6635), // Nova Address Registry
5760, // Delay blocks (same as current value)
64, // New future blocks value
86_400, // Delay seconds (same as current value)
768 // New future seconds value (future blocks * 12)
)
{}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "../address-registries/interfaces.sol";

contract SetSequencerInboxMaxTimeVariationAction {
ISequencerInbox public immutable sequencerInbox;
uint256 public immutable delayBlocks;
uint256 public immutable futureBlocks;
uint256 public immutable delaySeconds;
uint256 public immutable futureSeconds;

constructor(
ISequencerInboxGetter _addressRegistry,
uint256 _delayBlocks,
uint256 _futureBlocks,
uint256 _delaySeconds,
uint256 _futureSeconds
) {
sequencerInbox = _addressRegistry.sequencerInbox();
delayBlocks = _delayBlocks;
futureBlocks = _futureBlocks;
delaySeconds = _delaySeconds;
futureSeconds = _futureSeconds;
}

function perform() external {
sequencerInbox.setMaxTimeVariation(
ISequencerInbox.MaxTimeVariation({
delayBlocks: delayBlocks,
futureBlocks: futureBlocks,
delaySeconds: delaySeconds,
futureSeconds: futureSeconds
})
);
}
}
33 changes: 33 additions & 0 deletions test/gov-actions/SetSequencerInboxMaxTimeVariationAction.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "forge-std/Test.sol";

import "../util/ActionTestBase.sol";
// import this way to avoid naming collision
import "../../src/gov-action-contracts/sequencer/SetSequencerInboxMaxTimeVariationAction.sol" as
action;

contract SetSequencerInboxMaxTimeVariationAction is Test, ActionTestBase {
uint256 public newDelayBlocks = 123;
uint256 public newFutureBlocks = 456;
uint256 public newDelaySeconds = 789;
uint256 public newFutureSeconds = 10_112;

function testSetMaxTimeVariation() public {
action.SetSequencerInboxMaxTimeVariationAction setSequencerInboxMaxTimeVariationAction =
new action.SetSequencerInboxMaxTimeVariationAction(
addressRegistry, newDelayBlocks, newFutureBlocks, newDelaySeconds, newFutureSeconds
);
bytes memory callData =
abi.encodeWithSelector(action.SetSequencerInboxMaxTimeVariationAction.perform.selector);
vm.prank(executor0);
ue.execute(address(setSequencerInboxMaxTimeVariationAction), callData);
(uint256 delayBlocks, uint256 futureBlocks, uint256 delaySeconds, uint256 futureSeconds) =
si.maxTimeVariation();
assertEq(delayBlocks, newDelayBlocks, "delay blocks set");
assertEq(futureBlocks, newFutureBlocks, "future blocks set");
assertEq(delaySeconds, newDelaySeconds, "delay seconds set");
assertEq(futureSeconds, newFutureSeconds, "future seconds set");
}
}
Loading