From 05147a3061f8c677dd99da34fd7b844f09cc8b74 Mon Sep 17 00:00:00 2001 From: Anna Carroll Date: Tue, 2 Jul 2024 17:31:28 +0200 Subject: [PATCH] feat: split Passage from Zenith --- .gas-snapshot | 18 +++++++++--------- script/Zenith.s.sol | 6 ++++-- src/Zenith.sol | 9 ++------- test/Helpers.t.sol | 8 +------- test/Zenith.t.sol | 3 +-- 5 files changed, 17 insertions(+), 27 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 029ba01..1a8998c 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -27,12 +27,12 @@ PassageTest:test_setUp() (gas: 16968) PassageTest:test_transact() (gas: 58562) PassageTest:test_transact_defaultChain() (gas: 57475) PassageTest:test_withdraw() (gas: 59033) -ZenithTest:test_addSequencer() (gas: 88191) -ZenithTest:test_badSignature() (gas: 37477) -ZenithTest:test_incorrectHostBlock() (gas: 35310) -ZenithTest:test_notSequencer() (gas: 34223) -ZenithTest:test_notSequencerAdmin() (gas: 10193) -ZenithTest:test_onePerBlock() (gas: 68463) -ZenithTest:test_removeSequencer() (gas: 39857) -ZenithTest:test_setUp() (gas: 8434) -ZenithTest:test_submitBlock() (gas: 63468) \ No newline at end of file +ZenithTest:test_addSequencer() (gas: 88121) +ZenithTest:test_badSignature() (gas: 37241) +ZenithTest:test_incorrectHostBlock() (gas: 35086) +ZenithTest:test_notSequencer() (gas: 34076) +ZenithTest:test_notSequencerAdmin() (gas: 10125) +ZenithTest:test_onePerBlock() (gas: 68193) +ZenithTest:test_removeSequencer() (gas: 39665) +ZenithTest:test_setUp() (gas: 8366) +ZenithTest:test_submitBlock() (gas: 63333) \ No newline at end of file diff --git a/script/Zenith.s.sol b/script/Zenith.s.sol index 2a74c7b..215edc0 100644 --- a/script/Zenith.s.sol +++ b/script/Zenith.s.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.24; import {Script} from "forge-std/Script.sol"; import {Zenith} from "../src/Zenith.sol"; +import {Passage} from "../src/Passage.sol"; import {HostOrders, RollupOrders} from "../src/Orders.sol"; contract ZenithScript is Script { @@ -13,9 +14,10 @@ contract ZenithScript is Script { address withdrawalAdmin, address[] memory initialEnterTokens, address sequencerAdmin - ) public returns (Zenith z, HostOrders m) { + ) public returns (Zenith z, Passage p, HostOrders m) { vm.startBroadcast(); - z = new Zenith(defaultRollupChainId, withdrawalAdmin, initialEnterTokens, sequencerAdmin); + z = new Zenith(sequencerAdmin); + p = new Passage(defaultRollupChainId, withdrawalAdmin, initialEnterTokens); m = new HostOrders(); } diff --git a/src/Zenith.sol b/src/Zenith.sol index d92c8e6..6bcb1bf 100644 --- a/src/Zenith.sol +++ b/src/Zenith.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.24; import {Passage} from "./Passage.sol"; -contract Zenith is Passage { +contract Zenith { /// @notice The address that is allowed to set/remove sequencers. address public immutable sequencerAdmin; @@ -66,12 +66,7 @@ contract Zenith is Passage { /// @notice Emitted when a sequencer is added or removed. event SequencerSet(address indexed sequencer, bool indexed permissioned); - constructor( - uint256 _defaultRollupChainId, - address _withdrawalAdmin, - address[] memory initialEnterTokens, - address _sequencerAdmin - ) Passage(_defaultRollupChainId, _withdrawalAdmin, initialEnterTokens) { + constructor(address _sequencerAdmin) { sequencerAdmin = _sequencerAdmin; deployBlockNumber = block.number; } diff --git a/test/Helpers.t.sol b/test/Helpers.t.sol index 647f003..48e78be 100644 --- a/test/Helpers.t.sol +++ b/test/Helpers.t.sol @@ -18,13 +18,7 @@ contract HelpersTest is Test { function setUp() public { vm.createSelectFork("https://rpc.holesky.ethpandaops.io"); - address[] memory initialEnterTokens; - target = new Zenith( - block.chainid + 1, - 0x11Aa4EBFbf7a481617c719a2Df028c9DA1a219aa, - initialEnterTokens, - 0x29403F107781ea45Bf93710abf8df13F67f2008f - ); + target = new Zenith(0x29403F107781ea45Bf93710abf8df13F67f2008f); } function check_signature() public { diff --git a/test/Zenith.t.sol b/test/Zenith.t.sol index 9020f84..b917d28 100644 --- a/test/Zenith.t.sol +++ b/test/Zenith.t.sol @@ -26,8 +26,7 @@ contract ZenithTest is Test { event SequencerSet(address indexed sequencer, bool indexed permissioned); function setUp() public { - address[] memory initialEnterTokens; - target = new Zenith(block.chainid + 1, address(this), initialEnterTokens, address(this)); + target = new Zenith(address(this)); target.addSequencer(vm.addr(sequencerKey)); // set default block values