From b9708256d89e5de3f9395f1bac6f34e3c6e81a28 Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Thu, 5 Oct 2023 13:37:18 +0200 Subject: [PATCH 01/15] Added batch poster manager --- scripts/rollupCreation.ts | 10 +++--- src/bridge/ISequencerInbox.sol | 7 +++- src/bridge/SequencerInbox.sol | 17 ++++++++-- src/libraries/Error.sol | 3 ++ src/rollup/BridgeCreator.sol | 11 +++++-- src/rollup/RollupCreator.sol | 57 ++++++++++++++++++--------------- test/contract/arbRollup.spec.ts | 49 ++++++++++++++++++++++++---- 7 files changed, 112 insertions(+), 42 deletions(-) diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index 62a148f7..665e3d29 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -53,10 +53,12 @@ async function main() { // Call the createRollup function console.log('Calling createRollup to generate a new rollup ...') const createRollupTx = await rollupCreator.createRollup( - config.rollupConfig, - config.batchPoster, - config.validators, - maxDataSize + { + config: config.rollupConfig, + _batchPoster: config.batchPosters, + _validators: config.validators, + maxDataSize + } ) const createRollupReceipt = await createRollupTx.wait() diff --git a/src/bridge/ISequencerInbox.sol b/src/bridge/ISequencerInbox.sol index b4fadddb..38d323f7 100644 --- a/src/bridge/ISequencerInbox.sol +++ b/src/bridge/ISequencerInbox.sol @@ -176,5 +176,10 @@ interface ISequencerInbox is IDelayedMessageProvider { // ---------- initializer ---------- - function initialize(IBridge bridge_, MaxTimeVariation calldata maxTimeVariation_) external; + function initialize( + IBridge bridge_, + MaxTimeVariation calldata maxTimeVariation_, + address[] calldata batchPosters_, + address batchPosterManager_ + ) external; } diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index 3fa44a94..5f824367 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -20,7 +20,8 @@ import { DataNotAuthenticated, AlreadyValidDASKeyset, NoSuchKeyset, - NotForked + NotForked, + NotBatchPosterManager } from "../libraries/Error.sol"; import "./IBridge.sol"; import "./IInbox.sol"; @@ -54,6 +55,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox bytes1 public constant DATA_AUTHENTICATED_FLAG = 0x40; IOwnable public rollup; + /// @notice The batch poster manager has the ability to change the batch poster addresses + /// This enables the patch poster to do key rotation + address public batchPosterManager; mapping(address => bool) public isBatchPoster; ISequencerInbox.MaxTimeVariation public maxTimeVariation; @@ -82,13 +86,19 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox function initialize( IBridge bridge_, - ISequencerInbox.MaxTimeVariation calldata maxTimeVariation_ + ISequencerInbox.MaxTimeVariation calldata maxTimeVariation_, + address[] calldata batchPosters_, + address batchPosterManager_ ) external onlyDelegated { if (bridge != IBridge(address(0))) revert AlreadyInit(); if (bridge_ == IBridge(address(0))) revert HadZeroInit(); bridge = bridge_; rollup = bridge_.rollup(); maxTimeVariation = maxTimeVariation_; + for (uint256 i = 0; i < batchPosters_.length; i++) { + isBatchPoster[batchPosters_[i]] = true; + } + batchPosterManager = batchPosterManager_; } function getTimeBounds() internal view virtual returns (TimeBounds memory) { @@ -447,7 +457,8 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox } /// @inheritdoc ISequencerInbox - function setIsBatchPoster(address addr, bool isBatchPoster_) external onlyRollupOwner { + function setIsBatchPoster(address addr, bool isBatchPoster_) external { + if (msg.sender != batchPosterManager) revert NotBatchPosterManager(msg.sender); isBatchPoster[addr] = isBatchPoster_; emit OwnerFunctionCalled(1); } diff --git a/src/libraries/Error.sol b/src/libraries/Error.sol index 2114aa1e..63b2d0d2 100644 --- a/src/libraries/Error.sol +++ b/src/libraries/Error.sol @@ -161,3 +161,6 @@ error AlreadyValidDASKeyset(bytes32); /// @dev Tried to use or invalidate an already invalid Data Availability Service keyset error NoSuchKeyset(bytes32); + +/// @dev Thrown when the provided address is not the designated batch poster manager +error NotBatchPosterManager(address); diff --git a/src/rollup/BridgeCreator.sol b/src/rollup/BridgeCreator.sol index 153bff2d..013e6815 100644 --- a/src/rollup/BridgeCreator.sol +++ b/src/rollup/BridgeCreator.sol @@ -60,7 +60,9 @@ contract BridgeCreator is Ownable { function createBridge( address adminProxy, address rollup, - ISequencerInbox.MaxTimeVariation memory maxTimeVariation + ISequencerInbox.MaxTimeVariation memory maxTimeVariation, + address[] memory batchPosters, + address batchPosterManager ) external returns ( @@ -99,7 +101,12 @@ contract BridgeCreator is Ownable { } frame.bridge.initialize(IOwnable(rollup)); - frame.sequencerInbox.initialize(IBridge(frame.bridge), maxTimeVariation); + frame.sequencerInbox.initialize( + IBridge(frame.bridge), + maxTimeVariation, + batchPosters, + batchPosterManager + ); frame.inbox.initialize(IBridge(frame.bridge), ISequencerInbox(frame.sequencerInbox)); frame.rollupEventInbox.initialize(IBridge(frame.bridge)); frame.outbox.initialize(IBridge(frame.bridge)); diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index 6895a6b5..81908269 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -28,6 +28,16 @@ contract RollupCreator is Ownable { ); event TemplatesUpdated(); + struct RollupCreatorConfig { + Config config; + //// @dev The address of the batch poster, not used when set to zero address + address[] _batchPosters; + /// @dev The list of validator addresses, not used when set to empty list + address[] _validators; + uint256 maxDataSize; + address batchPosterManager; + } + BridgeCreator public bridgeCreator; IOneStepProofEntry public osp; IChallengeManager public challengeManagerTemplate; @@ -66,31 +76,29 @@ contract RollupCreator is Ownable { * @dev - RollupOwner should be the owner of Rollup * @dev - Bridge should have a single inbox and outbox * @dev - Validators and batch poster should be set if provided - * @param config The configuration for the rollup - * @param _batchPoster The address of the batch poster, not used when set to zero address - * @param _validators The list of validator addresses, not used when set to empty list + * @param rollupCreatorConfig The configuration for the rollup creator * @return The address of the newly created rollup */ - function createRollup( - Config memory config, - address _batchPoster, - address[] memory _validators, - uint256 maxDataSize - ) external returns (address) { + function createRollup(RollupCreatorConfig memory rollupCreatorConfig) + external + returns (address) + { // Make sure the immutable maxDataSize is as expected require( - maxDataSize == bridgeCreator.sequencerInboxTemplate().maxDataSize(), + rollupCreatorConfig.maxDataSize == bridgeCreator.sequencerInboxTemplate().maxDataSize(), "SI_MAX_DATA_SIZE_MISMATCH" ); require( - maxDataSize == bridgeCreator.inboxTemplate().maxDataSize(), + rollupCreatorConfig.maxDataSize == bridgeCreator.inboxTemplate().maxDataSize(), "I_MAX_DATA_SIZE_MISMATCH" ); ProxyAdmin proxyAdmin = new ProxyAdmin(); // Create the rollup proxy to figure out the address and initialize it later - RollupProxy rollup = new RollupProxy{salt: keccak256(abi.encode(config))}(); + RollupProxy rollup = new RollupProxy{ + salt: keccak256(abi.encode(rollupCreatorConfig.config)) + }(); ( IBridge bridge, @@ -101,7 +109,9 @@ contract RollupCreator is Ownable { ) = bridgeCreator.createBridge( address(proxyAdmin), address(rollup), - config.sequencerInboxMaxTimeVariation + rollupCreatorConfig.config.sequencerInboxMaxTimeVariation, + rollupCreatorConfig._batchPosters, + rollupCreatorConfig.batchPosterManager ); IChallengeManager challengeManager = IChallengeManager( @@ -120,14 +130,14 @@ contract RollupCreator is Ownable { osp ); - proxyAdmin.transferOwnership(config.owner); + proxyAdmin.transferOwnership(rollupCreatorConfig.config.owner); // initialize the rollup with this contract as owner to set batch poster and validators // it will transfer the ownership back to the actual owner later - address actualOwner = config.owner; - config.owner = address(this); + address actualOwner = rollupCreatorConfig.config.owner; + rollupCreatorConfig.config.owner = address(this); rollup.initializeProxy( - config, + rollupCreatorConfig.config, ContractDependencies({ bridge: bridge, sequencerInbox: sequencerInbox, @@ -142,18 +152,13 @@ contract RollupCreator is Ownable { }) ); - // setting batch poster, if the address provided is not zero address - if (_batchPoster != address(0)) { - sequencerInbox.setIsBatchPoster(_batchPoster, true); - } - // Call setValidator on the newly created rollup contract just if validator set is not empty - if (_validators.length != 0) { - bool[] memory _vals = new bool[](_validators.length); - for (uint256 i = 0; i < _validators.length; i++) { + if (rollupCreatorConfig._validators.length != 0) { + bool[] memory _vals = new bool[](rollupCreatorConfig._validators.length); + for (uint256 i = 0; i < rollupCreatorConfig._validators.length; i++) { _vals[i] = true; } - IRollupAdmin(address(rollup)).setValidator(_validators, _vals); + IRollupAdmin(address(rollup)).setValidator(rollupCreatorConfig._validators, _vals); } IRollupAdmin(address(rollup)).setOwner(actualOwner); diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index b54c78ec..20252b15 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -70,6 +70,7 @@ const wasmModuleRoot = // let rollup: RollupContract let rollup: RollupContract +let batchPosterManager: Signer let rollupUser: RollupUserLogic let rollupAdmin: RollupAdminLogic let accounts: Signer[] @@ -113,6 +114,7 @@ const setup = async () => { const val3 = accounts[4] const val4 = accounts[5] sequencer = accounts[6] + const batchPosterManager = accounts[7] const oneStep0Fac = (await ethers.getContractFactory( 'OneStepProver0' @@ -176,12 +178,17 @@ const setup = async () => { ethers.constants.AddressZero ) - const response = await rollupCreator.createRollup( - await getDefaultConfig(), - await sequencer.getAddress(), - [await val1.getAddress(), await val2.getAddress(), await val3.getAddress()], - 117964 - ) + const response = await rollupCreator.createRollup({ + config: await getDefaultConfig(), + _batchPosters: [await sequencer.getAddress()], + _validators: [ + await val1.getAddress(), + await val2.getAddress(), + await val3.getAddress(), + ], + maxDataSize: 117964, + batchPosterManager: await batchPosterManager.getAddress(), + }) const rec = await response.wait() @@ -226,6 +233,7 @@ const setup = async () => { delayedBridge: rollupCreatedEvent.bridge, delayedInbox: rollupCreatedEvent.inboxAddress, bridge: rollupCreatedEvent.bridge, + batchPosterManager, } } @@ -392,12 +400,14 @@ describe('ArbRollup', () => { rollupUser: rollupUserContract, admin: adminI, validators: validatorsI, + batchPosterManager: batchPosterManagerI, } = await setup() rollupAdmin = rollupAdminContract rollupUser = rollupUserContract admin = adminI validators = validatorsI rollup = new RollupContract(rollupUser.connect(validators[0])) + batchPosterManager = batchPosterManagerI }) it('should only initialize once', async function () { @@ -1181,6 +1191,33 @@ describe('ArbRollup', () => { ) }) + it('can set a batch poster', async function () { + const testAddress = await accounts[9].getAddress() + expect(await sequencerInbox.isBatchPoster(testAddress)).to.be.false + await expect( + sequencerInbox.setIsBatchPoster(testAddress, true) + ).to.revertedWith( + `NotBatchPosterManager("${await sequencerInbox.signer.getAddress()}")` + ) + expect(await sequencerInbox.isBatchPoster(testAddress)).to.be.false + + await ( + await sequencerInbox + .connect(batchPosterManager) + .setIsBatchPoster(testAddress, true) + ).wait() + + expect(await sequencerInbox.isBatchPoster(testAddress)).to.be.true + + await ( + await sequencerInbox + .connect(batchPosterManager) + .setIsBatchPoster(testAddress, false) + ).wait() + + expect(await sequencerInbox.isBatchPoster(testAddress)).to.be.false + }) + it('should fail the batch poster check', async function () { await expect( sequencerInbox.addSequencerL2Batch( From f2c085c3eb437c1b6ff7047ee720eda4b657a6d3 Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Thu, 5 Oct 2023 13:38:08 +0200 Subject: [PATCH 02/15] Formatting --- scripts/rollupCreation.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index 665e3d29..671e83b7 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -52,14 +52,12 @@ async function main() { } // Call the createRollup function console.log('Calling createRollup to generate a new rollup ...') - const createRollupTx = await rollupCreator.createRollup( - { - config: config.rollupConfig, - _batchPoster: config.batchPosters, - _validators: config.validators, - maxDataSize - } - ) + const createRollupTx = await rollupCreator.createRollup({ + config: config.rollupConfig, + _batchPoster: config.batchPosters, + _validators: config.validators, + maxDataSize, + }) const createRollupReceipt = await createRollupTx.wait() const rollupCreatedEvent = createRollupReceipt.events?.find( From cc5a0fe09a5026853ef5685997baf26c5b049453 Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Thu, 5 Oct 2023 14:17:35 +0200 Subject: [PATCH 03/15] Comment typo --- src/bridge/SequencerInbox.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index 5f824367..c2f16aff 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -56,7 +56,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox IOwnable public rollup; /// @notice The batch poster manager has the ability to change the batch poster addresses - /// This enables the patch poster to do key rotation + /// This enables the batch poster to do key rotation address public batchPosterManager; mapping(address => bool) public isBatchPoster; ISequencerInbox.MaxTimeVariation public maxTimeVariation; From 12a132f9039bea5d53e11987723ac2d9c9b71d68 Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Thu, 5 Oct 2023 17:37:56 +0200 Subject: [PATCH 04/15] Added batch poster manager setter --- package.json | 1 + src/bridge/ISequencerInbox.sol | 6 ++++++ src/bridge/SequencerInbox.sol | 6 ++++++ test/contract/arbRollup.spec.ts | 17 +++++++++++++++++ 4 files changed, 30 insertions(+) diff --git a/package.json b/package.json index 1ae9ddd4..4c2c05c0 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ }, "scripts": { "build": "hardhat compile", + "test": "hardhat --network hardhat test test/contract/*.spec.ts", "lint:test": "eslint ./test", "solhint": "solhint -f table src/**/*.sol", "prettier:solidity": "prettier --write src/**/*.sol", diff --git a/src/bridge/ISequencerInbox.sol b/src/bridge/ISequencerInbox.sol index 38d323f7..4ceff327 100644 --- a/src/bridge/ISequencerInbox.sol +++ b/src/bridge/ISequencerInbox.sol @@ -174,6 +174,12 @@ interface ISequencerInbox is IDelayedMessageProvider { */ function setIsSequencer(address addr, bool isSequencer_) external; + /** + * @notice Updates the batch poster manager, the address which has the ability to rotate batch poster keys + * @param newBatchPosterManager The new batch poster manager to be set + */ + function setBatchPosterManager(address newBatchPosterManager) external; + // ---------- initializer ---------- function initialize( diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index c2f16aff..33db9006 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -499,6 +499,12 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox emit OwnerFunctionCalled(4); } + /// @inheritdoc ISequencerInbox + function setBatchPosterManager(address newBatchPosterManager) external onlyRollupOwner { + batchPosterManager = newBatchPosterManager; + emit OwnerFunctionCalled(1); + } + function isValidKeysetHash(bytes32 ksHash) external view returns (bool) { return dasKeySetInfo[ksHash].isValidKeyset; } diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index 20252b15..c2fb6cd6 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -1218,6 +1218,23 @@ describe('ArbRollup', () => { expect(await sequencerInbox.isBatchPoster(testAddress)).to.be.false }) + it('can set batch poster manager', async function () { + const testManager = await accounts[8].getAddress() + expect(await sequencerInbox.batchPosterManager()).to.eq( + await batchPosterManager.getAddress() + ) + await expect( + sequencerInbox.connect(accounts[8]).setBatchPosterManager(testManager) + ).to.revertedWith(`NotOwner("${testManager}", "${rollupUser.address}")`) + expect(await sequencerInbox.batchPosterManager()).to.eq( + await batchPosterManager.getAddress() + ) + + await (await sequencerInbox.setBatchPosterManager(testManager)).wait() + + expect(await sequencerInbox.batchPosterManager()).to.eq(testManager) + }) + it('should fail the batch poster check', async function () { await expect( sequencerInbox.addSequencerL2Batch( From b916a527cff9d4f3c32eb0b010c01d079ac983e2 Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Thu, 5 Oct 2023 17:39:10 +0200 Subject: [PATCH 05/15] Formatting --- package.json | 1 - src/bridge/SequencerInbox.sol | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 4c2c05c0..1ae9ddd4 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ }, "scripts": { "build": "hardhat compile", - "test": "hardhat --network hardhat test test/contract/*.spec.ts", "lint:test": "eslint ./test", "solhint": "solhint -f table src/**/*.sol", "prettier:solidity": "prettier --write src/**/*.sol", diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index 33db9006..a530da42 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -500,7 +500,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox } /// @inheritdoc ISequencerInbox - function setBatchPosterManager(address newBatchPosterManager) external onlyRollupOwner { + function setBatchPosterManager(address newBatchPosterManager) external onlyRollupOwner { batchPosterManager = newBatchPosterManager; emit OwnerFunctionCalled(1); } From c7b70dd4c83e7bee923677a64a79a6699750d67c Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Thu, 5 Oct 2023 17:52:52 +0200 Subject: [PATCH 06/15] Test updates --- package.json | 1 + test/contract/arbRollup.spec.ts | 2 ++ .../sequencerInboxForceInclude.spec.ts | 19 +++++++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 1ae9ddd4..4c2c05c0 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ }, "scripts": { "build": "hardhat compile", + "test": "hardhat --network hardhat test test/contract/*.spec.ts", "lint:test": "eslint ./test", "solhint": "solhint -f table src/**/*.sol", "prettier:solidity": "prettier --write src/**/*.sol", diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index c2fb6cd6..547c0e28 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -943,12 +943,14 @@ describe('ArbRollup', () => { rollupUser: rollupUserContract, admin: adminI, validators: validatorsI, + batchPosterManager: batchPosterManagerI, } = await setup() rollupAdmin = rollupAdminContract rollupUser = rollupUserContract admin = adminI validators = validatorsI rollup = new RollupContract(rollupUser.connect(validators[0])) + batchPosterManager = batchPosterManagerI }) it('should stake on initial node again', async function () { diff --git a/test/contract/sequencerInboxForceInclude.spec.ts b/test/contract/sequencerInboxForceInclude.spec.ts index 43634737..da648ff7 100644 --- a/test/contract/sequencerInboxForceInclude.spec.ts +++ b/test/contract/sequencerInboxForceInclude.spec.ts @@ -220,6 +220,8 @@ describe('SequencerInboxForceInclude', async () => { const adminAddr = await admin.getAddress() const user = accounts[1] const dummyRollup = accounts[2] + const batchPoster = accounts[3] + const batchPosterManager = accounts[4] const sequencerInboxFac = (await ethers.getContractFactory( 'SequencerInbox' @@ -264,12 +266,17 @@ describe('SequencerInboxForceInclude', async () => { await bridge.initialize(await dummyRollup.getAddress()) - await sequencerInbox.initialize(bridgeProxy.address, { - delayBlocks: maxDelayBlocks, - delaySeconds: maxDelayTime, - futureBlocks: 10, - futureSeconds: 3000, - }) + await sequencerInbox.initialize( + bridgeProxy.address, + { + delayBlocks: maxDelayBlocks, + delaySeconds: maxDelayTime, + futureBlocks: 10, + futureSeconds: 3000, + }, + [await batchPoster.getAddress()], + await batchPosterManager.getAddress() + ) await inbox.initialize(bridgeProxy.address, sequencerInbox.address) await bridgeAdmin.setDelayedInbox(inbox.address, true) From cd7a3cd45a71630bf337d74a65d44943ac4e4863 Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Thu, 5 Oct 2023 18:01:49 +0200 Subject: [PATCH 07/15] Moved batch poster manager to the end of the storage block --- src/bridge/SequencerInbox.sol | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index a530da42..b2632275 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -55,9 +55,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox bytes1 public constant DATA_AUTHENTICATED_FLAG = 0x40; IOwnable public rollup; - /// @notice The batch poster manager has the ability to change the batch poster addresses - /// This enables the batch poster to do key rotation - address public batchPosterManager; + mapping(address => bool) public isBatchPoster; ISequencerInbox.MaxTimeVariation public maxTimeVariation; @@ -70,6 +68,10 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox mapping(address => bool) public isSequencer; + /// @notice The batch poster manager has the ability to change the batch poster addresses + /// This enables the batch poster to do key rotation + address public batchPosterManager; + // On L1 this should be set to 117964: 90% of Geth's 128KB tx size limit, leaving ~13KB for proving uint256 public immutable maxDataSize; uint256 internal immutable deployTimeChainId = block.chainid; From 757663b0245246f764a6058ffe5b43e7682b8d0b Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Thu, 5 Oct 2023 18:18:26 +0200 Subject: [PATCH 08/15] Allow batch poster manager to set the sequencer mapping --- src/bridge/SequencerInbox.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index b2632275..df564145 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -496,7 +496,8 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox } /// @inheritdoc ISequencerInbox - function setIsSequencer(address addr, bool isSequencer_) external onlyRollupOwner { + function setIsSequencer(address addr, bool isSequencer_) external { + if (msg.sender != batchPosterManager) revert NotBatchPosterManager(msg.sender); isSequencer[addr] = isSequencer_; emit OwnerFunctionCalled(4); } @@ -504,7 +505,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox /// @inheritdoc ISequencerInbox function setBatchPosterManager(address newBatchPosterManager) external onlyRollupOwner { batchPosterManager = newBatchPosterManager; - emit OwnerFunctionCalled(1); + emit OwnerFunctionCalled(5); } function isValidKeysetHash(bytes32 ksHash) external view returns (bool) { From c47f4ccc2a2b1348bf042e5136a28220b522ce72 Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Thu, 5 Oct 2023 18:25:36 +0200 Subject: [PATCH 09/15] Updated seq inbox storage --- test/storage/SequencerInbox.dot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/storage/SequencerInbox.dot b/test/storage/SequencerInbox.dot index f9ea05ab..e1846d17 100644 --- a/test/storage/SequencerInbox.dot +++ b/test/storage/SequencerInbox.dot @@ -4,7 +4,7 @@ rankdir=LR color=black arrowhead=open node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -3 [label="SequencerInbox \<\\>\n | {{ slot| 0 | 1 | 2 | 3 | 4-7 | 8 | 9 } | { type: \.variable (bytes) | { uint256: totalDelayedMessagesRead (32) } | { unallocated (12) | IBridge: bridge (20) } | { unallocated (12) | IOwnable: rollup (20) } | { mapping\(address=\>bool\): isBatchPoster (32) } | { <9> ISequencerInbox.MaxTimeVariation: maxTimeVariation (128) } | { <12> mapping\(bytes32=\>DasKeySetInfo\): dasKeySetInfo (32) } | { mapping\(address=\>bool\): isSequencer (32) }}}"] +3 [label="SequencerInbox \<\\>\n | {{ slot| 0 | 1 | 2 | 3 | 4-7 | 8 | 9 | 10 } | { type: \.variable (bytes) | { uint256: totalDelayedMessagesRead (32) } | { unallocated (12) | IBridge: bridge (20) } | { unallocated (12) | IOwnable: rollup (20) } | { mapping\(address=\>bool\): isBatchPoster (32) } | { <9> ISequencerInbox.MaxTimeVariation: maxTimeVariation (128) } | { <12> mapping\(bytes32=\>DasKeySetInfo\): dasKeySetInfo (32) } | { mapping\(address=\>bool\): isSequencer (32) } | { unallocated (12) | address: batchPosterManager (20) }}}"] 1 [label="ISequencerInbox.MaxTimeVariation \<\\>\n | {{ slot| 4 | 5 | 6 | 7 } | { type: variable (bytes) | { uint256: MaxTimeVariation.delayBlocks (32) } | { uint256: MaxTimeVariation.futureBlocks (32) } | { uint256: MaxTimeVariation.delaySeconds (32) } | { uint256: MaxTimeVariation.futureSeconds (32) }}}"] From 966c2ca76dda581433cfff5f6f7ebf92c23e2b50 Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Fri, 6 Oct 2023 11:16:20 +0200 Subject: [PATCH 10/15] Added test for setting sequencer --- test/contract/arbRollup.spec.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index 547c0e28..384fd069 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -1193,6 +1193,33 @@ describe('ArbRollup', () => { ) }) + it('can set is sequencer', async function () { + const testAddress = await accounts[9].getAddress() + expect(await sequencerInbox.isSequencer(testAddress)).to.be.false + await expect( + sequencerInbox.setIsSequencer(testAddress, true) + ).to.revertedWith( + `NotBatchPosterManager("${await sequencerInbox.signer.getAddress()}")` + ) + expect(await sequencerInbox.isSequencer(testAddress)).to.be.false + + await ( + await sequencerInbox + .connect(batchPosterManager) + .setIsSequencer(testAddress, true) + ).wait() + + expect(await sequencerInbox.isSequencer(testAddress)).to.be.true + + await ( + await sequencerInbox + .connect(batchPosterManager) + .setIsSequencer(testAddress, false) + ).wait() + + expect(await sequencerInbox.isSequencer(testAddress)).to.be.false + }) + it('can set a batch poster', async function () { const testAddress = await accounts[9].getAddress() expect(await sequencerInbox.isBatchPoster(testAddress)).to.be.false From 7a9e0f64de9d1a8bf8499d283b5377c8ae570959 Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Wed, 25 Oct 2023 15:52:01 +0200 Subject: [PATCH 11/15] Add test --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 0fed524f..59a8f0a9 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "deploy-rollup": "hardhat run scripts/rollupCreation.ts", "deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts", "deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts", - "test": "hardhat --network hardhat test test/contract/*.spec.ts" }, "dependencies": { "@offchainlabs/upgrade-executor": "1.1.0-beta.0", From b62608787d420f6de664303866141a0c713b22eb Mon Sep 17 00:00:00 2001 From: gzeon Date: Tue, 31 Oct 2023 02:12:26 +0800 Subject: [PATCH 12/15] Merge remote-tracking branch 'origin/seq-inbox-opt' into batch-poster-manager --- .github/workflows/contract-tests.yml | 8 ++++++ .gitignore | 2 +- package.json | 4 +-- src/osp/OneStepProverHostIo.sol | 30 ++++++++++++++++++---- test/storage/Bridge | 15 +++++++++++ test/storage/Bridge.dot | 30 ---------------------- test/storage/ChallengeManager | 8 ++++++ test/storage/ChallengeManager.dot | 9 ------- test/storage/ERC20Bridge | 16 ++++++++++++ test/storage/ERC20Bridge.dot | 27 -------------------- test/storage/ERC20Inbox | 12 +++++++++ test/storage/ERC20Inbox.dot | 15 ----------- test/storage/ERC20Outbox | 8 ++++++ test/storage/ERC20Outbox.dot | 12 --------- test/storage/Inbox | 12 +++++++++ test/storage/Inbox.dot | 18 ------------- test/storage/Outbox | 8 ++++++ test/storage/Outbox.dot | 15 ----------- test/storage/RollupAdminLogic | 38 ++++++++++++++++++++++++++++ test/storage/RollupAdminLogic.dot | 30 ---------------------- test/storage/RollupCore | 38 ++++++++++++++++++++++++++++ test/storage/RollupCore.dot | 30 ---------------------- test/storage/RollupUserLogic | 38 ++++++++++++++++++++++++++++ test/storage/RollupUserLogic.dot | 30 ---------------------- test/storage/SequencerInbox | 8 ++++++ test/storage/SequencerInbox.dot | 15 ----------- test/storage/test.bash | 9 ++++--- 27 files changed, 242 insertions(+), 243 deletions(-) create mode 100644 test/storage/Bridge delete mode 100644 test/storage/Bridge.dot create mode 100644 test/storage/ChallengeManager delete mode 100644 test/storage/ChallengeManager.dot create mode 100644 test/storage/ERC20Bridge delete mode 100644 test/storage/ERC20Bridge.dot create mode 100644 test/storage/ERC20Inbox delete mode 100644 test/storage/ERC20Inbox.dot create mode 100644 test/storage/ERC20Outbox delete mode 100644 test/storage/ERC20Outbox.dot create mode 100644 test/storage/Inbox delete mode 100644 test/storage/Inbox.dot create mode 100644 test/storage/Outbox delete mode 100644 test/storage/Outbox.dot create mode 100644 test/storage/RollupAdminLogic delete mode 100644 test/storage/RollupAdminLogic.dot create mode 100644 test/storage/RollupCore delete mode 100644 test/storage/RollupCore.dot create mode 100644 test/storage/RollupUserLogic delete mode 100644 test/storage/RollupUserLogic.dot create mode 100644 test/storage/SequencerInbox delete mode 100644 test/storage/SequencerInbox.dot diff --git a/.github/workflows/contract-tests.yml b/.github/workflows/contract-tests.yml index 0048c6d8..5a940cfd 100644 --- a/.github/workflows/contract-tests.yml +++ b/.github/workflows/contract-tests.yml @@ -52,6 +52,11 @@ jobs: cache: 'yarn' cache-dependency-path: '**/yarn.lock' + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + - name: Install dependencies run: yarn install @@ -70,6 +75,9 @@ jobs: - name: Interface compatibility run: yarn run test:compatibility + - name: Forge build + run: forge build + - name: Test Storage Layouts run: yarn run test:storage diff --git a/.gitignore b/.gitignore index b42d2ab9..6de9a1bc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ node_modules/ deployments/ /test/prover/proofs/*.json /test/prover/spec-proofs/*.json -/test/storage/*-old.dot +/test/storage/*-old scripts/config.ts forge-cache/ out/ diff --git a/package.json b/package.json index 59a8f0a9..46facd0a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@arbitrum/nitro-contracts", - "version": "1.1.0-beta.0", + "version": "1.1.0", "description": "Layer 2 precompiles and rollup for Arbitrum Nitro", "author": "Offchain Labs, Inc.", "license": "BUSL-1.1", @@ -33,7 +33,7 @@ "deploy-factory": "hardhat run scripts/deployment.ts", "deploy-rollup": "hardhat run scripts/rollupCreation.ts", "deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts", - "deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts", + "deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts" }, "dependencies": { "@offchainlabs/upgrade-executor": "1.1.0-beta.0", diff --git a/src/osp/OneStepProverHostIo.sol b/src/osp/OneStepProverHostIo.sol index 260ab206..0206572f 100644 --- a/src/osp/OneStepProverHostIo.sol +++ b/src/osp/OneStepProverHostIo.sol @@ -105,7 +105,7 @@ contract OneStepProverHostIo is IOneStepProver { ExecutionContext calldata, Machine memory mach, Module memory mod, - Instruction calldata, + Instruction calldata inst, bytes calldata proof ) internal pure { uint256 preimageOffset = mach.valueStack.pop().assumeI32(); @@ -128,9 +128,30 @@ contract OneStepProverHostIo is IOneStepProver { bytes memory extracted; uint8 proofType = uint8(proof[proofOffset]); proofOffset++; - if (proofType == 0) { + // These values must be kept in sync with `arbitrator/arbutil/src/types.rs` + // and `arbutil/preimage_type.go` (both in the nitro repo). + if (inst.argumentData == 0) { + // The machine is asking for a keccak256 preimage + + if (proofType == 0) { + bytes calldata preimage = proof[proofOffset:]; + require(keccak256(preimage) == leafContents, "BAD_PREIMAGE"); + + uint256 preimageEnd = preimageOffset + 32; + if (preimageEnd > preimage.length) { + preimageEnd = preimage.length; + } + extracted = preimage[preimageOffset:preimageEnd]; + } else { + // TODO: support proving via an authenticated contract + revert("UNKNOWN_PREIMAGE_PROOF"); + } + } else if (inst.argumentData == 1) { + // The machine is asking for a sha2-256 preimage + + require(proofType == 0, "UNKNOWN_PREIMAGE_PROOF"); bytes calldata preimage = proof[proofOffset:]; - require(keccak256(preimage) == leafContents, "BAD_PREIMAGE"); + require(sha256(preimage) == leafContents, "BAD_PREIMAGE"); uint256 preimageEnd = preimageOffset + 32; if (preimageEnd > preimage.length) { @@ -138,8 +159,7 @@ contract OneStepProverHostIo is IOneStepProver { } extracted = preimage[preimageOffset:preimageEnd]; } else { - // TODO: support proving via an authenticated contract - revert("UNKNOWN_PREIMAGE_PROOF"); + revert("UNKNOWN_PREIMAGE_TYPE"); } for (uint256 i = 0; i < extracted.length; i++) { diff --git a/test/storage/Bridge b/test/storage/Bridge new file mode 100644 index 00000000..9ed7f48a --- /dev/null +++ b/test/storage/Bridge @@ -0,0 +1,15 @@ +| Name | Type | Slot | Offset | Bytes | Contract | +|----------------------------------|------------------------------------------------|------|--------|-------|------------------------------| +| _initialized | bool | 0 | 0 | 1 | src/bridge/Bridge.sol:Bridge | +| _initializing | bool | 0 | 1 | 1 | src/bridge/Bridge.sol:Bridge | +| allowedDelayedInboxesMap | mapping(address => struct AbsBridge.InOutInfo) | 1 | 0 | 32 | src/bridge/Bridge.sol:Bridge | +| allowedOutboxesMap | mapping(address => struct AbsBridge.InOutInfo) | 2 | 0 | 32 | src/bridge/Bridge.sol:Bridge | +| allowedDelayedInboxList | address[] | 3 | 0 | 32 | src/bridge/Bridge.sol:Bridge | +| allowedOutboxList | address[] | 4 | 0 | 32 | src/bridge/Bridge.sol:Bridge | +| _activeOutbox | address | 5 | 0 | 20 | src/bridge/Bridge.sol:Bridge | +| delayedInboxAccs | bytes32[] | 6 | 0 | 32 | src/bridge/Bridge.sol:Bridge | +| sequencerInboxAccs | bytes32[] | 7 | 0 | 32 | src/bridge/Bridge.sol:Bridge | +| rollup | contract IOwnable | 8 | 0 | 20 | src/bridge/Bridge.sol:Bridge | +| sequencerInbox | address | 9 | 0 | 20 | src/bridge/Bridge.sol:Bridge | +| sequencerReportedSubMessageCount | uint256 | 10 | 0 | 32 | src/bridge/Bridge.sol:Bridge | +| __gap | uint256[40] | 11 | 0 | 1280 | src/bridge/Bridge.sol:Bridge | diff --git a/test/storage/Bridge.dot b/test/storage/Bridge.dot deleted file mode 100644 index c98a5e8c..00000000 --- a/test/storage/Bridge.dot +++ /dev/null @@ -1,30 +0,0 @@ - -digraph StorageDiagram { -rankdir=LR -color=black -arrowhead=open -node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -8 [label="Bridge \<\\>\n | {{ slot| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11-50 } | { type: \.variable (bytes) | { unallocated (30) | bool: Initializable._initializing (1) | bool: Initializable._initialized (1) } | { <5> mapping\(address=\>InOutInfo\): AbsBridge.allowedDelayedInboxesMap (32) } | { <8> mapping\(address=\>InOutInfo\): AbsBridge.allowedOutboxesMap (32) } | { <10> address[]: AbsBridge.allowedDelayedInboxList (32) } | { <12> address[]: AbsBridge.allowedOutboxList (32) } | { unallocated (12) | address: AbsBridge._activeOutbox (20) } | { <15> bytes32[]: AbsBridge.delayedInboxAccs (32) } | { <17> bytes32[]: AbsBridge.sequencerInboxAccs (32) } | { unallocated (12) | IOwnable: AbsBridge.rollup (20) } | { unallocated (12) | address: AbsBridge.sequencerInbox (20) } | { uint256: AbsBridge.sequencerReportedSubMessageCount (32) } | { <61> uint256[40]: AbsBridge.__gap (1280) }}}"] - -1 [label="InOutInfo \<\\>\n | {{ slot| 0 | 1 } | { type: variable (bytes) | { uint256: index (32) } | { unallocated (31) | bool: allowed (1) }}}"] - -2 [label="InOutInfo \<\\>\n | {{ slot| 0 | 1 } | { type: variable (bytes) | { uint256: index (32) } | { unallocated (31) | bool: allowed (1) }}}"] - -3 [label="address[]: allowedDelayedInboxList \<\\>\n0x11987c15ef5ed64ec2e3cd9cfc79d7bd155aea3982ea59f35a5e6b5c1593a54b | {{ slot| 0 } | { type: variable (bytes) | { unallocated (12) | address (20) }}}"] - -4 [label="address[]: allowedOutboxList \<\\>\n0x68f9c7fa29c0442459fc0d2760448ff932de4dd67b90b4a6ac1899621cfd70a7 | {{ slot| 0 } | { type: variable (bytes) | { unallocated (12) | address (20) }}}"] - -5 [label="bytes32[]: delayedInboxAccs \<\\>\n0x5ff1374942f1d7624ea1478457e8132b05531ee44999ffc0f33a70926c6a0d30 | {{ slot| 0 } | { type: variable (bytes) | { bytes32 (32) }}}"] - -6 [label="bytes32[]: sequencerInboxAccs \<\\>\n0x995663702627f3d8fc4237c51a46b303536bb17f3f65e07c08ad05fecbf4d88e | {{ slot| 0 } | { type: variable (bytes) | { bytes32 (32) }}}"] - -7 [label="uint256[40]: __gap \<\\>\n | {{ slot| 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - - 8:5 -> 1 - 8:8 -> 2 - 8:10 -> 3 - 8:12 -> 4 - 8:15 -> 5 - 8:17 -> 6 - 8:61 -> 7 -} \ No newline at end of file diff --git a/test/storage/ChallengeManager b/test/storage/ChallengeManager new file mode 100644 index 00000000..85c7f035 --- /dev/null +++ b/test/storage/ChallengeManager @@ -0,0 +1,8 @@ +| Name | Type | Slot | Offset | Bytes | Contract | +|------------------------|---------------------------------------------------|------|--------|-------|-----------------------------------------------------| +| totalChallengesCreated | uint64 | 0 | 0 | 8 | src/challenge/ChallengeManager.sol:ChallengeManager | +| challenges | mapping(uint256 => struct ChallengeLib.Challenge) | 1 | 0 | 32 | src/challenge/ChallengeManager.sol:ChallengeManager | +| resultReceiver | contract IChallengeResultReceiver | 2 | 0 | 20 | src/challenge/ChallengeManager.sol:ChallengeManager | +| sequencerInbox | contract ISequencerInbox | 3 | 0 | 20 | src/challenge/ChallengeManager.sol:ChallengeManager | +| bridge | contract IBridge | 4 | 0 | 20 | src/challenge/ChallengeManager.sol:ChallengeManager | +| osp | contract IOneStepProofEntry | 5 | 0 | 20 | src/challenge/ChallengeManager.sol:ChallengeManager | diff --git a/test/storage/ChallengeManager.dot b/test/storage/ChallengeManager.dot deleted file mode 100644 index d566805f..00000000 --- a/test/storage/ChallengeManager.dot +++ /dev/null @@ -1,9 +0,0 @@ - -digraph StorageDiagram { -rankdir=LR -color=black -arrowhead=open -node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -1 [label="ChallengeManager \<\\>\n | {{ slot| 0 | 1 | 2 | 3 | 4 | 5 } | { type: \.variable (bytes) | { unallocated (24) | uint64: totalChallengesCreated (8) } | { mapping\(uint256=\>ChallengeLib.Challenge\): challenges (32) } | { unallocated (12) | IChallengeResultReceiver: resultReceiver (20) } | { unallocated (12) | ISequencerInbox: sequencerInbox (20) } | { unallocated (12) | IBridge: bridge (20) } | { unallocated (12) | IOneStepProofEntry: osp (20) }}}"] - -} \ No newline at end of file diff --git a/test/storage/ERC20Bridge b/test/storage/ERC20Bridge new file mode 100644 index 00000000..1b0d838b --- /dev/null +++ b/test/storage/ERC20Bridge @@ -0,0 +1,16 @@ +| Name | Type | Slot | Offset | Bytes | Contract | +|----------------------------------|------------------------------------------------|------|--------|-------|----------------------------------------| +| _initialized | bool | 0 | 0 | 1 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| _initializing | bool | 0 | 1 | 1 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| allowedDelayedInboxesMap | mapping(address => struct AbsBridge.InOutInfo) | 1 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| allowedOutboxesMap | mapping(address => struct AbsBridge.InOutInfo) | 2 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| allowedDelayedInboxList | address[] | 3 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| allowedOutboxList | address[] | 4 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| _activeOutbox | address | 5 | 0 | 20 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| delayedInboxAccs | bytes32[] | 6 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| sequencerInboxAccs | bytes32[] | 7 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| rollup | contract IOwnable | 8 | 0 | 20 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| sequencerInbox | address | 9 | 0 | 20 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| sequencerReportedSubMessageCount | uint256 | 10 | 0 | 32 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| __gap | uint256[40] | 11 | 0 | 1280 | src/bridge/ERC20Bridge.sol:ERC20Bridge | +| nativeToken | address | 51 | 0 | 20 | src/bridge/ERC20Bridge.sol:ERC20Bridge | diff --git a/test/storage/ERC20Bridge.dot b/test/storage/ERC20Bridge.dot deleted file mode 100644 index ff456b92..00000000 --- a/test/storage/ERC20Bridge.dot +++ /dev/null @@ -1,27 +0,0 @@ - -digraph StorageDiagram { -rankdir=LR -color=black -arrowhead=open -node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -7 [label="ERC20Bridge \<\\>\n | {{ slot| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 } | { type: \.variable (bytes) | { unallocated (30) | bool: Initializable._initializing (1) | bool: Initializable._initialized (1) } | { <5> mapping\(address=\>InOutInfo\): AbsBridge.allowedDelayedInboxesMap (32) } | { <8> mapping\(address=\>InOutInfo\): AbsBridge.allowedOutboxesMap (32) } | { <10> address[]: AbsBridge.allowedDelayedInboxList (32) } | { <12> address[]: AbsBridge.allowedOutboxList (32) } | { unallocated (12) | address: AbsBridge._activeOutbox (20) } | { <15> bytes32[]: AbsBridge.delayedInboxAccs (32) } | { <17> bytes32[]: AbsBridge.sequencerInboxAccs (32) } | { unallocated (12) | IOwnable: AbsBridge.rollup (20) } | { unallocated (12) | address: AbsBridge.sequencerInbox (20) } | { uint256: AbsBridge.sequencerReportedSubMessageCount (32) } | { unallocated (12) | address: nativeToken (20) }}}"] - -1 [label="InOutInfo \<\\>\n | {{ slot| 0 | 1 } | { type: variable (bytes) | { uint256: index (32) } | { unallocated (31) | bool: allowed (1) }}}"] - -2 [label="InOutInfo \<\\>\n | {{ slot| 0 | 1 } | { type: variable (bytes) | { uint256: index (32) } | { unallocated (31) | bool: allowed (1) }}}"] - -3 [label="address[]: allowedDelayedInboxList \<\\>\n0x11987c15ef5ed64ec2e3cd9cfc79d7bd155aea3982ea59f35a5e6b5c1593a54b | {{ slot| 0 } | { type: variable (bytes) | { unallocated (12) | address (20) }}}"] - -4 [label="address[]: allowedOutboxList \<\\>\n0x68f9c7fa29c0442459fc0d2760448ff932de4dd67b90b4a6ac1899621cfd70a7 | {{ slot| 0 } | { type: variable (bytes) | { unallocated (12) | address (20) }}}"] - -5 [label="bytes32[]: delayedInboxAccs \<\\>\n0x5ff1374942f1d7624ea1478457e8132b05531ee44999ffc0f33a70926c6a0d30 | {{ slot| 0 } | { type: variable (bytes) | { bytes32 (32) }}}"] - -6 [label="bytes32[]: sequencerInboxAccs \<\\>\n0x995663702627f3d8fc4237c51a46b303536bb17f3f65e07c08ad05fecbf4d88e | {{ slot| 0 } | { type: variable (bytes) | { bytes32 (32) }}}"] - - 7:5 -> 1 - 7:8 -> 2 - 7:10 -> 3 - 7:12 -> 4 - 7:15 -> 5 - 7:17 -> 6 -} \ No newline at end of file diff --git a/test/storage/ERC20Inbox b/test/storage/ERC20Inbox new file mode 100644 index 00000000..58f398df --- /dev/null +++ b/test/storage/ERC20Inbox @@ -0,0 +1,12 @@ +| Name | Type | Slot | Offset | Bytes | Contract | +|------------------|--------------------------|------|--------|-------|--------------------------------------| +| _initialized | bool | 0 | 0 | 1 | src/bridge/ERC20Inbox.sol:ERC20Inbox | +| _initializing | bool | 0 | 1 | 1 | src/bridge/ERC20Inbox.sol:ERC20Inbox | +| __gap | uint256[50] | 1 | 0 | 1600 | src/bridge/ERC20Inbox.sol:ERC20Inbox | +| _paused | bool | 51 | 0 | 1 | src/bridge/ERC20Inbox.sol:ERC20Inbox | +| __gap | uint256[49] | 52 | 0 | 1568 | src/bridge/ERC20Inbox.sol:ERC20Inbox | +| bridge | contract IBridge | 101 | 0 | 20 | src/bridge/ERC20Inbox.sol:ERC20Inbox | +| sequencerInbox | contract ISequencerInbox | 102 | 0 | 20 | src/bridge/ERC20Inbox.sol:ERC20Inbox | +| allowListEnabled | bool | 102 | 20 | 1 | src/bridge/ERC20Inbox.sol:ERC20Inbox | +| isAllowed | mapping(address => bool) | 103 | 0 | 32 | src/bridge/ERC20Inbox.sol:ERC20Inbox | +| __gap | uint256[47] | 104 | 0 | 1504 | src/bridge/ERC20Inbox.sol:ERC20Inbox | diff --git a/test/storage/ERC20Inbox.dot b/test/storage/ERC20Inbox.dot deleted file mode 100644 index fc90ee0d..00000000 --- a/test/storage/ERC20Inbox.dot +++ /dev/null @@ -1,15 +0,0 @@ - -digraph StorageDiagram { -rankdir=LR -color=black -arrowhead=open -node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -3 [label="ERC20Inbox \<\\>\n | {{ slot| 0 | 1-50 | 51 | 52-100 | 101 | 102 | 103 } | { type: \.variable (bytes) | { unallocated (30) | bool: Initializable._initializing (1) | bool: Initializable._initialized (1) } | { <53> uint256[50]: ContextUpgradeable.__gap (1600) } | { unallocated (31) | bool: PausableUpgradeable._paused (1) } | { <104> uint256[49]: PausableUpgradeable.__gap (1568) } | { unallocated (12) | IBridge: AbsInbox.bridge (20) } | { unallocated (11) | bool: AbsInbox.allowListEnabled (1) | ISequencerInbox: AbsInbox.sequencerInbox (20) } | { mapping\(address=\>bool\): AbsInbox.isAllowed (32) }}}"] - -1 [label="uint256[50]: __gap \<\\>\n | {{ slot| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - -2 [label="uint256[49]: __gap \<\\>\n | {{ slot| 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - - 3:53 -> 1 - 3:104 -> 2 -} \ No newline at end of file diff --git a/test/storage/ERC20Outbox b/test/storage/ERC20Outbox new file mode 100644 index 00000000..09e2c38c --- /dev/null +++ b/test/storage/ERC20Outbox @@ -0,0 +1,8 @@ +| Name | Type | Slot | Offset | Bytes | Contract | +|---------|--------------------------------|------|--------|-------|----------------------------------------| +| rollup | address | 0 | 0 | 20 | src/bridge/ERC20Outbox.sol:ERC20Outbox | +| bridge | contract IBridge | 1 | 0 | 20 | src/bridge/ERC20Outbox.sol:ERC20Outbox | +| spent | mapping(uint256 => bytes32) | 2 | 0 | 32 | src/bridge/ERC20Outbox.sol:ERC20Outbox | +| roots | mapping(bytes32 => bytes32) | 3 | 0 | 32 | src/bridge/ERC20Outbox.sol:ERC20Outbox | +| context | struct AbsOutbox.L2ToL1Context | 4 | 0 | 128 | src/bridge/ERC20Outbox.sol:ERC20Outbox | +| __gap | uint256[42] | 8 | 0 | 1344 | src/bridge/ERC20Outbox.sol:ERC20Outbox | diff --git a/test/storage/ERC20Outbox.dot b/test/storage/ERC20Outbox.dot deleted file mode 100644 index db69c272..00000000 --- a/test/storage/ERC20Outbox.dot +++ /dev/null @@ -1,12 +0,0 @@ - -digraph StorageDiagram { -rankdir=LR -color=black -arrowhead=open -node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -2 [label="ERC20Outbox \<\\>\n | {{ slot| 0 | 1 | 2 | 3 | 4-7 } | { type: \.variable (bytes) | { unallocated (12) | address: AbsOutbox.rollup (20) } | { unallocated (12) | IBridge: AbsOutbox.bridge (20) } | { mapping\(uint256=\>bytes32\): AbsOutbox.spent (32) } | { mapping\(bytes32=\>bytes32\): AbsOutbox.roots (32) } | { <11> L2ToL1Context: AbsOutbox.context (128) }}}"] - -1 [label="L2ToL1Context \<\\>\n | {{ slot| 4 | 5 | 6 | 7 } | { type: variable (bytes) | { uint128: timestamp (16) | uint128: l2Block (16) } | { bytes32: outputId (32) } | { uint96: l1Block (12) | address: sender (20) } | { uint256: withdrawalAmount (32) }}}"] - - 2:11 -> 1 -} \ No newline at end of file diff --git a/test/storage/Inbox b/test/storage/Inbox new file mode 100644 index 00000000..0551822e --- /dev/null +++ b/test/storage/Inbox @@ -0,0 +1,12 @@ +| Name | Type | Slot | Offset | Bytes | Contract | +|------------------|--------------------------|------|--------|-------|----------------------------| +| _initialized | bool | 0 | 0 | 1 | src/bridge/Inbox.sol:Inbox | +| _initializing | bool | 0 | 1 | 1 | src/bridge/Inbox.sol:Inbox | +| __gap | uint256[50] | 1 | 0 | 1600 | src/bridge/Inbox.sol:Inbox | +| _paused | bool | 51 | 0 | 1 | src/bridge/Inbox.sol:Inbox | +| __gap | uint256[49] | 52 | 0 | 1568 | src/bridge/Inbox.sol:Inbox | +| bridge | contract IBridge | 101 | 0 | 20 | src/bridge/Inbox.sol:Inbox | +| sequencerInbox | contract ISequencerInbox | 102 | 0 | 20 | src/bridge/Inbox.sol:Inbox | +| allowListEnabled | bool | 102 | 20 | 1 | src/bridge/Inbox.sol:Inbox | +| isAllowed | mapping(address => bool) | 103 | 0 | 32 | src/bridge/Inbox.sol:Inbox | +| __gap | uint256[47] | 104 | 0 | 1504 | src/bridge/Inbox.sol:Inbox | diff --git a/test/storage/Inbox.dot b/test/storage/Inbox.dot deleted file mode 100644 index cc97bcc9..00000000 --- a/test/storage/Inbox.dot +++ /dev/null @@ -1,18 +0,0 @@ - -digraph StorageDiagram { -rankdir=LR -color=black -arrowhead=open -node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -4 [label="Inbox \<\\>\n | {{ slot| 0 | 1-50 | 51 | 52-100 | 101 | 102 | 103 | 104-150 } | { type: \.variable (bytes) | { unallocated (30) | bool: Initializable._initializing (1) | bool: Initializable._initialized (1) } | { <53> uint256[50]: ContextUpgradeable.__gap (1600) } | { unallocated (31) | bool: PausableUpgradeable._paused (1) } | { <104> uint256[49]: PausableUpgradeable.__gap (1568) } | { unallocated (12) | IBridge: AbsInbox.bridge (20) } | { unallocated (11) | bool: AbsInbox.allowListEnabled (1) | ISequencerInbox: AbsInbox.sequencerInbox (20) } | { mapping\(address=\>bool\): AbsInbox.isAllowed (32) } | { <156> uint256[47]: AbsInbox.__gap (1504) }}}"] - -1 [label="uint256[50]: __gap \<\\>\n | {{ slot| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - -2 [label="uint256[49]: __gap \<\\>\n | {{ slot| 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - -3 [label="uint256[47]: __gap \<\\>\n | {{ slot| 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - - 4:53 -> 1 - 4:104 -> 2 - 4:156 -> 3 -} \ No newline at end of file diff --git a/test/storage/Outbox b/test/storage/Outbox new file mode 100644 index 00000000..d161ae3b --- /dev/null +++ b/test/storage/Outbox @@ -0,0 +1,8 @@ +| Name | Type | Slot | Offset | Bytes | Contract | +|---------|--------------------------------|------|--------|-------|------------------------------| +| rollup | address | 0 | 0 | 20 | src/bridge/Outbox.sol:Outbox | +| bridge | contract IBridge | 1 | 0 | 20 | src/bridge/Outbox.sol:Outbox | +| spent | mapping(uint256 => bytes32) | 2 | 0 | 32 | src/bridge/Outbox.sol:Outbox | +| roots | mapping(bytes32 => bytes32) | 3 | 0 | 32 | src/bridge/Outbox.sol:Outbox | +| context | struct AbsOutbox.L2ToL1Context | 4 | 0 | 128 | src/bridge/Outbox.sol:Outbox | +| __gap | uint256[42] | 8 | 0 | 1344 | src/bridge/Outbox.sol:Outbox | diff --git a/test/storage/Outbox.dot b/test/storage/Outbox.dot deleted file mode 100644 index f2da1fcb..00000000 --- a/test/storage/Outbox.dot +++ /dev/null @@ -1,15 +0,0 @@ - -digraph StorageDiagram { -rankdir=LR -color=black -arrowhead=open -node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -3 [label="Outbox \<\\>\n | {{ slot| 0 | 1 | 2 | 3 | 4-7 | 8-49 } | { type: \.variable (bytes) | { unallocated (12) | address: AbsOutbox.rollup (20) } | { unallocated (12) | IBridge: AbsOutbox.bridge (20) } | { mapping\(uint256=\>bytes32\): AbsOutbox.spent (32) } | { mapping\(bytes32=\>bytes32\): AbsOutbox.roots (32) } | { <11> L2ToL1Context: AbsOutbox.context (128) } | { <54> uint256[42]: AbsOutbox.__gap (1344) }}}"] - -1 [label="L2ToL1Context \<\\>\n | {{ slot| 4 | 5 | 6 | 7 } | { type: variable (bytes) | { uint128: timestamp (16) | uint128: l2Block (16) } | { bytes32: outputId (32) } | { uint96: l1Block (12) | address: sender (20) } | { uint256: withdrawalAmount (32) }}}"] - -2 [label="uint256[42]: __gap \<\\>\n | {{ slot| 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - - 3:11 -> 1 - 3:54 -> 2 -} \ No newline at end of file diff --git a/test/storage/RollupAdminLogic b/test/storage/RollupAdminLogic new file mode 100644 index 00000000..7832c870 --- /dev/null +++ b/test/storage/RollupAdminLogic @@ -0,0 +1,38 @@ +| Name | Type | Slot | Offset | Bytes | Contract | +|----------------------------|-----------------------------------------------|------|--------|-------|--------------------------------------------------| +| _initialized | bool | 0 | 0 | 1 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _initializing | bool | 0 | 1 | 1 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| __gap | uint256[50] | 1 | 0 | 1600 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _paused | bool | 51 | 0 | 1 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| __gap | uint256[49] | 52 | 0 | 1568 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| confirmPeriodBlocks | uint64 | 101 | 0 | 8 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| extraChallengeTimeBlocks | uint64 | 101 | 8 | 8 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| chainId | uint256 | 102 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| baseStake | uint256 | 103 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| wasmModuleRoot | bytes32 | 104 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| inbox | contract IInboxBase | 105 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| bridge | contract IBridge | 106 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| outbox | contract IOutbox | 107 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| sequencerInbox | contract ISequencerInbox | 108 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| rollupEventInbox | contract IRollupEventInbox | 109 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| challengeManager | contract IChallengeManager | 110 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| validatorUtils | address | 111 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| validatorWalletCreator | address | 112 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| loserStakeEscrow | address | 113 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| stakeToken | address | 114 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| minimumAssertionPeriod | uint256 | 115 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| isValidator | mapping(address => bool) | 116 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _latestConfirmed | uint64 | 117 | 0 | 8 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _firstUnresolvedNode | uint64 | 117 | 8 | 8 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _latestNodeCreated | uint64 | 117 | 16 | 8 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _lastStakeBlock | uint64 | 117 | 24 | 8 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _nodes | mapping(uint64 => struct Node) | 118 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _nodeStakers | mapping(uint64 => mapping(address => bool)) | 119 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _stakerList | address[] | 120 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _stakerMap | mapping(address => struct IRollupCore.Staker) | 121 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _zombies | struct RollupCore.Zombie[] | 122 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _withdrawableFunds | mapping(address => uint256) | 123 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| totalWithdrawableFunds | uint256 | 124 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| rollupDeploymentBlock | uint256 | 125 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| validatorWhitelistDisabled | bool | 126 | 0 | 1 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +| _nodeCreatedAtArbSysBlock | mapping(uint64 => uint256) | 127 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | diff --git a/test/storage/RollupAdminLogic.dot b/test/storage/RollupAdminLogic.dot deleted file mode 100644 index 7dad73f2..00000000 --- a/test/storage/RollupAdminLogic.dot +++ /dev/null @@ -1,30 +0,0 @@ - -digraph StorageDiagram { -rankdir=LR -color=black -arrowhead=open -node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -8 [label="RollupAdminLogic \<\\>\n | {{ slot| 0 | 1-50 | 51 | 52-100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 } | { type: \.variable (bytes) | { unallocated (30) | bool: Initializable._initializing (1) | bool: Initializable._initialized (1) } | { <53> uint256[50]: ContextUpgradeable.__gap (1600) } | { unallocated (31) | bool: PausableUpgradeable._paused (1) } | { <104> uint256[49]: PausableUpgradeable.__gap (1568) } | { unallocated (16) | uint64: RollupCore.extraChallengeTimeBlocks (8) | uint64: RollupCore.confirmPeriodBlocks (8) } | { uint256: RollupCore.chainId (32) } | { uint256: RollupCore.baseStake (32) } | { bytes32: RollupCore.wasmModuleRoot (32) } | { unallocated (12) | IInboxBase: RollupCore.inbox (20) } | { unallocated (12) | IBridge: RollupCore.bridge (20) } | { unallocated (12) | IOutbox: RollupCore.outbox (20) } | { unallocated (12) | ISequencerInbox: RollupCore.sequencerInbox (20) } | { unallocated (12) | IRollupEventInbox: RollupCore.rollupEventInbox (20) } | { unallocated (12) | IChallengeManager: RollupCore.challengeManager (20) } | { unallocated (12) | address: RollupCore.validatorUtils (20) } | { unallocated (12) | address: RollupCore.validatorWalletCreator (20) } | { unallocated (12) | address: RollupCore.loserStakeEscrow (20) } | { unallocated (12) | address: RollupCore.stakeToken (20) } | { uint256: RollupCore.minimumAssertionPeriod (32) } | { mapping\(address=\>bool\): RollupCore.isValidator (32) } | { uint64: RollupCore._lastStakeBlock (8) | uint64: RollupCore._latestNodeCreated (8) | uint64: RollupCore._firstUnresolvedNode (8) | uint64: RollupCore._latestConfirmed (8) } | { <138> mapping\(uint64=\>Node\): RollupCore._nodes (32) } | { mapping\(uint64=\>mapping\(address=\>bool\)\): RollupCore._nodeStakers (32) } | { <141> address[]: RollupCore._stakerList (32) } | { <147> mapping\(address=\>Staker\): RollupCore._stakerMap (32) } | { <151> Zombie[]: RollupCore._zombies (32) } | { mapping\(address=\>uint256\): RollupCore._withdrawableFunds (32) } | { uint256: RollupCore.totalWithdrawableFunds (32) } | { uint256: RollupCore.rollupDeploymentBlock (32) } | { unallocated (31) | bool: RollupCore.validatorWhitelistDisabled (1) } | { mapping\(uint64=\>uint256\): RollupCore._nodeCreatedAtArbSysBlock (32) }}}"] - -1 [label="uint256[50]: __gap \<\\>\n | {{ slot| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - -2 [label="uint256[49]: __gap \<\\>\n | {{ slot| 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - -3 [label="Node \<\\>\n | {{ slot| 0 | 1 | 2 | 3 | 4 | 5 } | { type: variable (bytes) | { bytes32: stateHash (32) } | { bytes32: challengeHash (32) } | { bytes32: confirmData (32) } | { uint64: stakerCount (8) | uint64: noChildConfirmedBeforeBlock (8) | uint64: deadlineBlock (8) | uint64: prevNum (8) } | { uint64: createdAtBlock (8) | uint64: latestChildNumber (8) | uint64: firstChildBlock (8) | uint64: childStakerCount (8) } | { bytes32: nodeHash (32) }}}"] - -4 [label="address[]: _stakerList \<\\>\n0x315040cf50a9fea58aa3302eb9bbbb1153c7ed7311c4e1c76711b1190d535025 | {{ slot| 0 } | { type: variable (bytes) | { unallocated (12) | address (20) }}}"] - -5 [label="Staker \<\\>\n | {{ slot| 0 | 1 } | { type: variable (bytes) | { uint256: amountStaked (32) } | { unallocated (7) | bool: isStaked (1) | uint64: currentChallenge (8) | uint64: latestStakedNode (8) | uint64: index (8) }}}"] - -6 [label="Zombie \<\\>\n | {{ slot| 0 } | { type: variable (bytes) | { unallocated (4) | uint64: latestStakedNode (8) | address: stakerAddress (20) }}}"] - -7 [label="Zombie[]: _zombies \<\\>\n0x8e4a4be60bf9672655845da331c63e49fa2a771e90e72dc554369cbb34aae7b8 | {{ slot| 0 } | { type: variable (bytes) | { <148> Zombie (32) }}}"] - - 8:53 -> 1 - 8:104 -> 2 - 8:138 -> 3 - 8:141 -> 4 - 8:147 -> 5 - 8:151 -> 7 - 7:148 -> 6 -} \ No newline at end of file diff --git a/test/storage/RollupCore b/test/storage/RollupCore new file mode 100644 index 00000000..4480b0cc --- /dev/null +++ b/test/storage/RollupCore @@ -0,0 +1,38 @@ +| Name | Type | Slot | Offset | Bytes | Contract | +|----------------------------|-----------------------------------------------|------|--------|-------|--------------------------------------| +| _initialized | bool | 0 | 0 | 1 | src/rollup/RollupCore.sol:RollupCore | +| _initializing | bool | 0 | 1 | 1 | src/rollup/RollupCore.sol:RollupCore | +| __gap | uint256[50] | 1 | 0 | 1600 | src/rollup/RollupCore.sol:RollupCore | +| _paused | bool | 51 | 0 | 1 | src/rollup/RollupCore.sol:RollupCore | +| __gap | uint256[49] | 52 | 0 | 1568 | src/rollup/RollupCore.sol:RollupCore | +| confirmPeriodBlocks | uint64 | 101 | 0 | 8 | src/rollup/RollupCore.sol:RollupCore | +| extraChallengeTimeBlocks | uint64 | 101 | 8 | 8 | src/rollup/RollupCore.sol:RollupCore | +| chainId | uint256 | 102 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| baseStake | uint256 | 103 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| wasmModuleRoot | bytes32 | 104 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| inbox | contract IInboxBase | 105 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +| bridge | contract IBridge | 106 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +| outbox | contract IOutbox | 107 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +| sequencerInbox | contract ISequencerInbox | 108 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +| rollupEventInbox | contract IRollupEventInbox | 109 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +| challengeManager | contract IChallengeManager | 110 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +| validatorUtils | address | 111 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +| validatorWalletCreator | address | 112 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +| loserStakeEscrow | address | 113 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +| stakeToken | address | 114 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +| minimumAssertionPeriod | uint256 | 115 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| isValidator | mapping(address => bool) | 116 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| _latestConfirmed | uint64 | 117 | 0 | 8 | src/rollup/RollupCore.sol:RollupCore | +| _firstUnresolvedNode | uint64 | 117 | 8 | 8 | src/rollup/RollupCore.sol:RollupCore | +| _latestNodeCreated | uint64 | 117 | 16 | 8 | src/rollup/RollupCore.sol:RollupCore | +| _lastStakeBlock | uint64 | 117 | 24 | 8 | src/rollup/RollupCore.sol:RollupCore | +| _nodes | mapping(uint64 => struct Node) | 118 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| _nodeStakers | mapping(uint64 => mapping(address => bool)) | 119 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| _stakerList | address[] | 120 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| _stakerMap | mapping(address => struct IRollupCore.Staker) | 121 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| _zombies | struct RollupCore.Zombie[] | 122 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| _withdrawableFunds | mapping(address => uint256) | 123 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| totalWithdrawableFunds | uint256 | 124 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| rollupDeploymentBlock | uint256 | 125 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +| validatorWhitelistDisabled | bool | 126 | 0 | 1 | src/rollup/RollupCore.sol:RollupCore | +| _nodeCreatedAtArbSysBlock | mapping(uint64 => uint256) | 127 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | diff --git a/test/storage/RollupCore.dot b/test/storage/RollupCore.dot deleted file mode 100644 index 2307dcc5..00000000 --- a/test/storage/RollupCore.dot +++ /dev/null @@ -1,30 +0,0 @@ - -digraph StorageDiagram { -rankdir=LR -color=black -arrowhead=open -node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -8 [label="RollupCore \<\\>\n | {{ slot| 0 | 1-50 | 51 | 52-100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 } | { type: \.variable (bytes) | { unallocated (30) | bool: Initializable._initializing (1) | bool: Initializable._initialized (1) } | { <53> uint256[50]: ContextUpgradeable.__gap (1600) } | { unallocated (31) | bool: PausableUpgradeable._paused (1) } | { <104> uint256[49]: PausableUpgradeable.__gap (1568) } | { unallocated (16) | uint64: extraChallengeTimeBlocks (8) | uint64: confirmPeriodBlocks (8) } | { uint256: chainId (32) } | { uint256: baseStake (32) } | { bytes32: wasmModuleRoot (32) } | { unallocated (12) | IInboxBase: inbox (20) } | { unallocated (12) | IBridge: bridge (20) } | { unallocated (12) | IOutbox: outbox (20) } | { unallocated (12) | ISequencerInbox: sequencerInbox (20) } | { unallocated (12) | IRollupEventInbox: rollupEventInbox (20) } | { unallocated (12) | IChallengeManager: challengeManager (20) } | { unallocated (12) | address: validatorUtils (20) } | { unallocated (12) | address: validatorWalletCreator (20) } | { unallocated (12) | address: loserStakeEscrow (20) } | { unallocated (12) | address: stakeToken (20) } | { uint256: minimumAssertionPeriod (32) } | { mapping\(address=\>bool\): isValidator (32) } | { uint64: _lastStakeBlock (8) | uint64: _latestNodeCreated (8) | uint64: _firstUnresolvedNode (8) | uint64: _latestConfirmed (8) } | { <138> mapping\(uint64=\>Node\): _nodes (32) } | { mapping\(uint64=\>mapping\(address=\>bool\)\): _nodeStakers (32) } | { <141> address[]: _stakerList (32) } | { <147> mapping\(address=\>Staker\): _stakerMap (32) } | { <151> Zombie[]: _zombies (32) } | { mapping\(address=\>uint256\): _withdrawableFunds (32) } | { uint256: totalWithdrawableFunds (32) } | { uint256: rollupDeploymentBlock (32) } | { unallocated (31) | bool: validatorWhitelistDisabled (1) } | { mapping\(uint64=\>uint256\): _nodeCreatedAtArbSysBlock (32) }}}"] - -1 [label="uint256[50]: __gap \<\\>\n | {{ slot| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - -2 [label="uint256[49]: __gap \<\\>\n | {{ slot| 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - -3 [label="Node \<\\>\n | {{ slot| 0 | 1 | 2 | 3 | 4 | 5 } | { type: variable (bytes) | { bytes32: stateHash (32) } | { bytes32: challengeHash (32) } | { bytes32: confirmData (32) } | { uint64: stakerCount (8) | uint64: noChildConfirmedBeforeBlock (8) | uint64: deadlineBlock (8) | uint64: prevNum (8) } | { uint64: createdAtBlock (8) | uint64: latestChildNumber (8) | uint64: firstChildBlock (8) | uint64: childStakerCount (8) } | { bytes32: nodeHash (32) }}}"] - -4 [label="address[]: _stakerList \<\\>\n0x315040cf50a9fea58aa3302eb9bbbb1153c7ed7311c4e1c76711b1190d535025 | {{ slot| 0 } | { type: variable (bytes) | { unallocated (12) | address (20) }}}"] - -5 [label="Staker \<\\>\n | {{ slot| 0 | 1 } | { type: variable (bytes) | { uint256: amountStaked (32) } | { unallocated (7) | bool: isStaked (1) | uint64: currentChallenge (8) | uint64: latestStakedNode (8) | uint64: index (8) }}}"] - -6 [label="Zombie \<\\>\n | {{ slot| 0 } | { type: variable (bytes) | { unallocated (4) | uint64: latestStakedNode (8) | address: stakerAddress (20) }}}"] - -7 [label="Zombie[]: _zombies \<\\>\n0x8e4a4be60bf9672655845da331c63e49fa2a771e90e72dc554369cbb34aae7b8 | {{ slot| 0 } | { type: variable (bytes) | { <148> Zombie (32) }}}"] - - 8:53 -> 1 - 8:104 -> 2 - 8:138 -> 3 - 8:141 -> 4 - 8:147 -> 5 - 8:151 -> 7 - 7:148 -> 6 -} \ No newline at end of file diff --git a/test/storage/RollupUserLogic b/test/storage/RollupUserLogic new file mode 100644 index 00000000..27139d25 --- /dev/null +++ b/test/storage/RollupUserLogic @@ -0,0 +1,38 @@ +| Name | Type | Slot | Offset | Bytes | Contract | +|----------------------------|-----------------------------------------------|------|--------|-------|------------------------------------------------| +| _initialized | bool | 0 | 0 | 1 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _initializing | bool | 0 | 1 | 1 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| __gap | uint256[50] | 1 | 0 | 1600 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _paused | bool | 51 | 0 | 1 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| __gap | uint256[49] | 52 | 0 | 1568 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| confirmPeriodBlocks | uint64 | 101 | 0 | 8 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| extraChallengeTimeBlocks | uint64 | 101 | 8 | 8 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| chainId | uint256 | 102 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| baseStake | uint256 | 103 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| wasmModuleRoot | bytes32 | 104 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| inbox | contract IInboxBase | 105 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| bridge | contract IBridge | 106 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| outbox | contract IOutbox | 107 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| sequencerInbox | contract ISequencerInbox | 108 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| rollupEventInbox | contract IRollupEventInbox | 109 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| challengeManager | contract IChallengeManager | 110 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| validatorUtils | address | 111 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| validatorWalletCreator | address | 112 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| loserStakeEscrow | address | 113 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| stakeToken | address | 114 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| minimumAssertionPeriod | uint256 | 115 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| isValidator | mapping(address => bool) | 116 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _latestConfirmed | uint64 | 117 | 0 | 8 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _firstUnresolvedNode | uint64 | 117 | 8 | 8 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _latestNodeCreated | uint64 | 117 | 16 | 8 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _lastStakeBlock | uint64 | 117 | 24 | 8 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _nodes | mapping(uint64 => struct Node) | 118 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _nodeStakers | mapping(uint64 => mapping(address => bool)) | 119 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _stakerList | address[] | 120 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _stakerMap | mapping(address => struct IRollupCore.Staker) | 121 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _zombies | struct RollupCore.Zombie[] | 122 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _withdrawableFunds | mapping(address => uint256) | 123 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| totalWithdrawableFunds | uint256 | 124 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| rollupDeploymentBlock | uint256 | 125 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| validatorWhitelistDisabled | bool | 126 | 0 | 1 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +| _nodeCreatedAtArbSysBlock | mapping(uint64 => uint256) | 127 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | diff --git a/test/storage/RollupUserLogic.dot b/test/storage/RollupUserLogic.dot deleted file mode 100644 index bd7576a3..00000000 --- a/test/storage/RollupUserLogic.dot +++ /dev/null @@ -1,30 +0,0 @@ - -digraph StorageDiagram { -rankdir=LR -color=black -arrowhead=open -node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -8 [label="RollupUserLogic \<\\>\n | {{ slot| 0 | 1-50 | 51 | 52-100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 } | { type: \.variable (bytes) | { unallocated (30) | bool: Initializable._initializing (1) | bool: Initializable._initialized (1) } | { <53> uint256[50]: ContextUpgradeable.__gap (1600) } | { unallocated (31) | bool: PausableUpgradeable._paused (1) } | { <104> uint256[49]: PausableUpgradeable.__gap (1568) } | { unallocated (16) | uint64: RollupCore.extraChallengeTimeBlocks (8) | uint64: RollupCore.confirmPeriodBlocks (8) } | { uint256: RollupCore.chainId (32) } | { uint256: RollupCore.baseStake (32) } | { bytes32: RollupCore.wasmModuleRoot (32) } | { unallocated (12) | IInboxBase: RollupCore.inbox (20) } | { unallocated (12) | IBridge: RollupCore.bridge (20) } | { unallocated (12) | IOutbox: RollupCore.outbox (20) } | { unallocated (12) | ISequencerInbox: RollupCore.sequencerInbox (20) } | { unallocated (12) | IRollupEventInbox: RollupCore.rollupEventInbox (20) } | { unallocated (12) | IChallengeManager: RollupCore.challengeManager (20) } | { unallocated (12) | address: RollupCore.validatorUtils (20) } | { unallocated (12) | address: RollupCore.validatorWalletCreator (20) } | { unallocated (12) | address: RollupCore.loserStakeEscrow (20) } | { unallocated (12) | address: RollupCore.stakeToken (20) } | { uint256: RollupCore.minimumAssertionPeriod (32) } | { mapping\(address=\>bool\): RollupCore.isValidator (32) } | { uint64: RollupCore._lastStakeBlock (8) | uint64: RollupCore._latestNodeCreated (8) | uint64: RollupCore._firstUnresolvedNode (8) | uint64: RollupCore._latestConfirmed (8) } | { <138> mapping\(uint64=\>Node\): RollupCore._nodes (32) } | { mapping\(uint64=\>mapping\(address=\>bool\)\): RollupCore._nodeStakers (32) } | { <141> address[]: RollupCore._stakerList (32) } | { <147> mapping\(address=\>Staker\): RollupCore._stakerMap (32) } | { <151> Zombie[]: RollupCore._zombies (32) } | { mapping\(address=\>uint256\): RollupCore._withdrawableFunds (32) } | { uint256: RollupCore.totalWithdrawableFunds (32) } | { uint256: RollupCore.rollupDeploymentBlock (32) } | { unallocated (31) | bool: RollupCore.validatorWhitelistDisabled (1) } | { mapping\(uint64=\>uint256\): RollupCore._nodeCreatedAtArbSysBlock (32) }}}"] - -1 [label="uint256[50]: __gap \<\\>\n | {{ slot| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - -2 [label="uint256[49]: __gap \<\\>\n | {{ slot| 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 } | { type: variable (bytes) | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) } | { uint256 (32) }}}"] - -3 [label="Node \<\\>\n | {{ slot| 0 | 1 | 2 | 3 | 4 | 5 } | { type: variable (bytes) | { bytes32: stateHash (32) } | { bytes32: challengeHash (32) } | { bytes32: confirmData (32) } | { uint64: stakerCount (8) | uint64: noChildConfirmedBeforeBlock (8) | uint64: deadlineBlock (8) | uint64: prevNum (8) } | { uint64: createdAtBlock (8) | uint64: latestChildNumber (8) | uint64: firstChildBlock (8) | uint64: childStakerCount (8) } | { bytes32: nodeHash (32) }}}"] - -4 [label="address[]: _stakerList \<\\>\n0x315040cf50a9fea58aa3302eb9bbbb1153c7ed7311c4e1c76711b1190d535025 | {{ slot| 0 } | { type: variable (bytes) | { unallocated (12) | address (20) }}}"] - -5 [label="Staker \<\\>\n | {{ slot| 0 | 1 } | { type: variable (bytes) | { uint256: amountStaked (32) } | { unallocated (7) | bool: isStaked (1) | uint64: currentChallenge (8) | uint64: latestStakedNode (8) | uint64: index (8) }}}"] - -6 [label="Zombie \<\\>\n | {{ slot| 0 } | { type: variable (bytes) | { unallocated (4) | uint64: latestStakedNode (8) | address: stakerAddress (20) }}}"] - -7 [label="Zombie[]: _zombies \<\\>\n0x8e4a4be60bf9672655845da331c63e49fa2a771e90e72dc554369cbb34aae7b8 | {{ slot| 0 } | { type: variable (bytes) | { <148> Zombie (32) }}}"] - - 8:53 -> 1 - 8:104 -> 2 - 8:138 -> 3 - 8:141 -> 4 - 8:147 -> 5 - 8:151 -> 7 - 7:148 -> 6 -} \ No newline at end of file diff --git a/test/storage/SequencerInbox b/test/storage/SequencerInbox new file mode 100644 index 00000000..67b25863 --- /dev/null +++ b/test/storage/SequencerInbox @@ -0,0 +1,8 @@ +| Name | Type | Slot | Offset | Bytes | Contract | +|--------------------------|----------------------------------------------------------|------|--------|-------|----------------------------------------------| +| totalDelayedMessagesRead | uint256 | 0 | 0 | 32 | src/bridge/SequencerInbox.sol:SequencerInbox | +| rollup | contract IOwnable | 1 | 0 | 20 | src/bridge/SequencerInbox.sol:SequencerInbox | +| isBatchPoster | mapping(address => bool) | 2 | 0 | 32 | src/bridge/SequencerInbox.sol:SequencerInbox | +| dasKeySetInfo | mapping(bytes32 => struct ISequencerInbox.DasKeySetInfo) | 3 | 0 | 32 | src/bridge/SequencerInbox.sol:SequencerInbox | +| isSequencer | mapping(address => bool) | 4 | 0 | 32 | src/bridge/SequencerInbox.sol:SequencerInbox | +| batchPosterManager | address | 5 | 0 | 20 | src/bridge/SequencerInbox.sol:SequencerInbox | diff --git a/test/storage/SequencerInbox.dot b/test/storage/SequencerInbox.dot deleted file mode 100644 index e1846d17..00000000 --- a/test/storage/SequencerInbox.dot +++ /dev/null @@ -1,15 +0,0 @@ - -digraph StorageDiagram { -rankdir=LR -color=black -arrowhead=open -node [shape=record, style=filled, fillcolor=gray95 fontname="Courier New"] -3 [label="SequencerInbox \<\\>\n | {{ slot| 0 | 1 | 2 | 3 | 4-7 | 8 | 9 | 10 } | { type: \.variable (bytes) | { uint256: totalDelayedMessagesRead (32) } | { unallocated (12) | IBridge: bridge (20) } | { unallocated (12) | IOwnable: rollup (20) } | { mapping\(address=\>bool\): isBatchPoster (32) } | { <9> ISequencerInbox.MaxTimeVariation: maxTimeVariation (128) } | { <12> mapping\(bytes32=\>DasKeySetInfo\): dasKeySetInfo (32) } | { mapping\(address=\>bool\): isSequencer (32) } | { unallocated (12) | address: batchPosterManager (20) }}}"] - -1 [label="ISequencerInbox.MaxTimeVariation \<\\>\n | {{ slot| 4 | 5 | 6 | 7 } | { type: variable (bytes) | { uint256: MaxTimeVariation.delayBlocks (32) } | { uint256: MaxTimeVariation.futureBlocks (32) } | { uint256: MaxTimeVariation.delaySeconds (32) } | { uint256: MaxTimeVariation.futureSeconds (32) }}}"] - -2 [label="DasKeySetInfo \<\\>\n | {{ slot| 0 } | { type: variable (bytes) | { unallocated (23) | uint64: creationBlock (8) | bool: isValidKeyset (1) }}}"] - - 3:9 -> 1 - 3:12 -> 2 -} \ No newline at end of file diff --git a/test/storage/test.bash b/test/storage/test.bash index 430750b5..562deb0f 100755 --- a/test/storage/test.bash +++ b/test/storage/test.bash @@ -1,10 +1,11 @@ #!/bin/bash -for CONTRACTNAME in Bridge Inbox Outbox RollupCore RollupUserLogic RollupAdminLogic ChallengeManager +output_dir="./test/storage" +for CONTRACTNAME in Bridge Inbox Outbox RollupCore RollupUserLogic RollupAdminLogic SequencerInbox ChallengeManager ERC20Bridge ERC20Inbox ERC20Outbox do echo "Checking storage change of $CONTRACTNAME" - [ -f "./test/storage/$CONTRACTNAME.dot" ] && mv "./test/storage/$CONTRACTNAME.dot" "./test/storage/$CONTRACTNAME-old.dot" - yarn sol2uml storage ./ -c "$CONTRACTNAME" -o "./test/storage/$CONTRACTNAME.dot" -f dot - diff "./test/storage/$CONTRACTNAME-old.dot" "./test/storage/$CONTRACTNAME.dot" + [ -f "$output_dir/$CONTRACTNAME" ] && mv "$output_dir/$CONTRACTNAME" "$output_dir/$CONTRACTNAME-old" + forge inspect "$CONTRACTNAME" --pretty storage > "$output_dir/$CONTRACTNAME" + diff "$output_dir/$CONTRACTNAME-old" "$output_dir/$CONTRACTNAME" if [[ $? != "0" ]] then CHANGED=1 From 11b105af231a863bd717e7803d0f1643d6868963 Mon Sep 17 00:00:00 2001 From: gzeon Date: Fri, 19 Jan 2024 20:05:36 +0800 Subject: [PATCH 13/15] fix: various --- src/bridge/ISequencerInbox.sol | 2 ++ src/bridge/SequencerInbox.sol | 21 ++++++++++++++++----- test/contract/arbRollup.spec.ts | 12 ++++++++++-- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/bridge/ISequencerInbox.sol b/src/bridge/ISequencerInbox.sol index bcb17dd7..fd0c1d18 100644 --- a/src/bridge/ISequencerInbox.sol +++ b/src/bridge/ISequencerInbox.sol @@ -85,6 +85,8 @@ interface ISequencerInbox is IDelayedMessageProvider { function maxDataSize() external view returns (uint256); + /// @notice The batch poster manager has the ability to change the batch poster addresses + /// This enables the batch poster to do key rotation function batchPosterManager() external view returns (address); struct DasKeySetInfo { diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index 01b01dfc..dbe5d59e 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -89,6 +89,13 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox _; } + modifier onlyRollupOwnerOrBatchPosterManager() { + if (msg.sender != rollup.owner() && msg.sender != batchPosterManager) { + revert NotBatchPosterManager(msg.sender); + } + _; + } + mapping(address => bool) public isSequencer; IDataHashReader immutable dataHashReader; IBlobBasefeeReader immutable blobBasefeeReader; @@ -99,8 +106,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox uint64 internal delaySeconds; uint64 internal futureSeconds; - /// @notice The batch poster manager has the ability to change the batch poster addresses - /// This enables the batch poster to do key rotation + /// @inheritdoc ISequencerInbox address public batchPosterManager; // On L1 this should be set to 117964: 90% of Geth's 128KB tx size limit, leaving ~13KB for proving @@ -726,7 +732,10 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox } /// @inheritdoc ISequencerInbox - function setIsBatchPoster(address addr, bool isBatchPoster_) external onlyRollupOwner { + function setIsBatchPoster(address addr, bool isBatchPoster_) + external + onlyRollupOwnerOrBatchPosterManager + { isBatchPoster[addr] = isBatchPoster_; emit OwnerFunctionCalled(1); } @@ -762,8 +771,10 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox } /// @inheritdoc ISequencerInbox - function setIsSequencer(address addr, bool isSequencer_) external { - if (msg.sender != batchPosterManager) revert NotBatchPosterManager(msg.sender); + function setIsSequencer(address addr, bool isSequencer_) + external + onlyRollupOwnerOrBatchPosterManager + { isSequencer[addr] = isSequencer_; emit OwnerFunctionCalled(4); } diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index 2dd1393a..f5e78404 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -319,6 +319,10 @@ const setup = async () => { )) as SequencerInbox__factory ).attach(rollupCreatedEvent.sequencerInbox) + await sequencerInbox + .connect(await impersonateAccount(rollupCreatedEvent.upgradeExecutor)) + .setBatchPosterManager(await batchPosterManager.getAddress()) + challengeManager = ( (await ethers.getContractFactory( 'ChallengeManager' @@ -1446,12 +1450,16 @@ describe('ArbRollup', () => { ) await expect( sequencerInbox.connect(accounts[8]).setBatchPosterManager(testManager) - ).to.revertedWith(`NotOwner("${testManager}", "${rollupUser.address}")`) + ).to.revertedWith(`NotOwner("${testManager}", "${upgradeExecutor}")`) expect(await sequencerInbox.batchPosterManager()).to.eq( await batchPosterManager.getAddress() ) - await (await sequencerInbox.setBatchPosterManager(testManager)).wait() + await ( + await sequencerInbox + .connect(await impersonateAccount(upgradeExecutor)) + .setBatchPosterManager(testManager) + ).wait() expect(await sequencerInbox.batchPosterManager()).to.eq(testManager) }) From d843ac7dfc0fbaafb54bea541e28e491a1660f3e Mon Sep 17 00:00:00 2001 From: gzeon Date: Fri, 19 Jan 2024 20:10:54 +0800 Subject: [PATCH 14/15] fix: set batch poster manager in rollup creator --- src/rollup/RollupCreator.sol | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index 62258f92..5145a6c6 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -188,6 +188,14 @@ contract RollupCreator is Ownable { }) ); + // Setting batch posters and batch poster manager + for (uint256 i = 0; i < deployParams.batchPosters.length; i++) { + bridgeContracts.sequencerInbox.setIsBatchPoster(deployParams.batchPosters[i], true); + } + if (deployParams.batchPosterManager != address(0)) { + bridgeContracts.sequencerInbox.setBatchPosterManager(deployParams.batchPosterManager); + } + // Call setValidator on the newly created rollup contract just if validator set is not empty if (deployParams.validators.length != 0) { bool[] memory _vals = new bool[](deployParams.validators.length); From b43718a3ca74508a4e6eb5f4e5a9e8fb3b21c25a Mon Sep 17 00:00:00 2001 From: Chris Buckland Date: Mon, 22 Jan 2024 10:17:35 +0000 Subject: [PATCH 15/15] Update src/bridge/SequencerInbox.sol Co-authored-by: gzeon --- src/bridge/SequencerInbox.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index dbe5d59e..98da468d 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -776,7 +776,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox onlyRollupOwnerOrBatchPosterManager { isSequencer[addr] = isSequencer_; - emit OwnerFunctionCalled(4); + emit OwnerFunctionCalled(4); // Owner in this context can also be batch poster manager } /// @inheritdoc ISequencerInbox