From 91a01a952260870feef0d13f755dad8db935a10a Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Mon, 13 Apr 2026 10:50:37 +0100 Subject: [PATCH 01/17] Add new MEL-related variables and functions to Rollup contracts --- src/rollup/IRollupAdmin.sol | 25 ++++++++++++++++++++++ src/rollup/IRollupCore.sol | 11 ++++++++++ src/rollup/RollupAdminLogic.sol | 37 +++++++++++++++++++++++++++++++-- src/rollup/RollupCore.sol | 7 +++++++ 4 files changed, 78 insertions(+), 2 deletions(-) diff --git a/src/rollup/IRollupAdmin.sol b/src/rollup/IRollupAdmin.sol index 9bb48c5f2..4de11d4ae 100644 --- a/src/rollup/IRollupAdmin.sol +++ b/src/rollup/IRollupAdmin.sol @@ -65,6 +65,11 @@ interface IRollupAdmin { /// @dev Challenge manager was set event ChallengeManagerSet(address challengeManager); + /// @dev MELConfig was set + event MELConfigSet( + uint64 indexed melVersion, address indexed inbox, address indexed sequencerInbox, uint64 activationBlock + ); + function initialize( Config calldata config, ContractDependencies calldata connectedContracts @@ -206,6 +211,14 @@ interface IRollupAdmin { address _sequencerInbox ) external; + /** + * @notice sets the rollup's inbox reference. Does not update the bridge's view. + * @param newInbox new address of inbox + */ + function setInbox( + IInboxBase newInbox + ) external; + /** * @notice set the validatorWhitelistDisabled flag * @param _validatorWhitelistDisabled new value of validatorWhitelistDisabled, i.e. true = disabled @@ -229,4 +242,16 @@ interface IRollupAdmin { function setChallengeManager( address _challengeManager ) external; + + /** + * @notice set a new MELConfig which updates the current version and sets new Inbox and Bridge contracts + * @param _melVersion new MEL Version + * @param _inbox new address of the inbox contract + * @param _sequencerInbox new address of sequencer inbox + */ + function setMELConfig( + uint64 _melVersion, + address _inbox, + address _sequencerInbox + ) external; } diff --git a/src/rollup/IRollupCore.sol b/src/rollup/IRollupCore.sol index 9376a73d3..a170f18f7 100644 --- a/src/rollup/IRollupCore.sol +++ b/src/rollup/IRollupCore.sol @@ -21,6 +21,17 @@ interface IRollupCore is IAssertionChain { address withdrawalAddress; } + struct MELConfig { + // MEL version + uint64 melVersion; + // Inbox contract that MEL will use from this moment on + address inbox; + // SequencerInbox contract that MEL will use from this moment on + address sequencerInbox; + // The block number at which this MEL version was activated + uint64 activationBlockNumber; + } + event RollupInitialized(bytes32 machineHash, uint256 chainId); event AssertionCreated( diff --git a/src/rollup/RollupAdminLogic.sol b/src/rollup/RollupAdminLogic.sol index bb875aa27..3fb450fdc 100644 --- a/src/rollup/RollupAdminLogic.sol +++ b/src/rollup/RollupAdminLogic.sol @@ -414,7 +414,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl */ function setSequencerInbox( address _sequencerInbox - ) external override { + ) public { bridge.setSequencerInbox(_sequencerInbox); emit SequencerInboxSet(_sequencerInbox); // previously: emit OwnerFunctionCalled(27); @@ -426,7 +426,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl */ function setInbox( IInboxBase newInbox - ) external { + ) public { inbox = newInbox; emit InboxSet(address(newInbox)); // previously: emit OwnerFunctionCalled(28); @@ -467,4 +467,37 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl emit ChallengeManagerSet(_challengeManager); // previously: emit OwnerFunctionCalled(32); } + + /** + * @inheritdoc IRollupAdmin + */ + function setMELConfig( + uint64 _melVersion, + address _inbox, + address _sequencerInbox + ) external { + // MEL versions can only be increased + require(_melVersion > melVersion, "INVALID_MEL_VERSION"); + + // Setting the contracts + setInbox(IInboxBase(_inbox)); + setSequencerInbox(_sequencerInbox); + + // Set the new MEL version + melVersion = _melVersion; + + // Save the new MELConfig + MELConfig memory _melConfig = MELConfig({ + melVersion: _melVersion, + inbox: _inbox, + sequencerInbox: _sequencerInbox, + activationBlockNumber: uint64(block.number) + }); + + bytes32 melConfigHash = keccak256(abi.encode(_melConfig)); + melConfig[melConfigHash] = _melConfig; + + // Emit event to signal the update to nitro + emit MELConfigSet(_melVersion, _inbox, _sequencerInbox, uint64(block.number)); + } } diff --git a/src/rollup/RollupCore.sol b/src/rollup/RollupCore.sol index 035c9a0e7..cec8a2af9 100644 --- a/src/rollup/RollupCore.sol +++ b/src/rollup/RollupCore.sol @@ -117,6 +117,13 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { // If the chain RollupCore is deployed on, this will contain the ArbSys.blockNumber() at each node's creation. mapping(bytes32 => uint256) internal _assertionCreatedAtArbSysBlock; + // Message Extraction Layer (MEL) version + uint64 public melVersion; + + // Message Extraction Layer (MEL) config history + // MELConfig hash => MELConfig + mapping (bytes32 => MELConfig) public melConfig; + function sequencerInbox() public view virtual returns (ISequencerInbox) { return ISequencerInbox(bridge.sequencerInbox()); } From 1fc9408b672d765f38cfc085e5d56341d5e37d26 Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Wed, 22 Apr 2026 14:37:20 +0100 Subject: [PATCH 02/17] Add initial changes to Rollup contracts --- src/challengeV2/EdgeChallengeManager.sol | 9 +- src/challengeV2/IAssertionChain.sol | 3 +- src/rollup/Assertion.sol | 5 +- src/rollup/IRollupAdmin.sol | 7 +- src/rollup/IRollupCore.sol | 3 +- src/rollup/IRollupLogic.sol | 3 +- src/rollup/MELState.sol | 46 +++++++++ src/rollup/RollupAdminLogic.sol | 26 ++--- src/rollup/RollupCore.sol | 120 ++++++----------------- src/rollup/RollupLib.sol | 17 ++-- src/rollup/RollupUserLogic.sol | 39 +++----- src/state/Deserialize.sol | 16 ++- src/state/GlobalState.sol | 52 +++++++++- 13 files changed, 186 insertions(+), 160 deletions(-) create mode 100644 src/rollup/MELState.sol diff --git a/src/challengeV2/EdgeChallengeManager.sol b/src/challengeV2/EdgeChallengeManager.sol index be1e736e7..098c3c2af 100644 --- a/src/challengeV2/EdgeChallengeManager.sol +++ b/src/challengeV2/EdgeChallengeManager.sol @@ -224,15 +224,13 @@ contract EdgeChallengeManager is IEdgeChallengeManager, Initializable { assertionChain.validateAssertionHash( args.claimId, claimStateData.assertionState, - claimStateData.prevAssertionHash, - claimStateData.inboxAcc + claimStateData.prevAssertionHash ); assertionChain.validateAssertionHash( claimStateData.prevAssertionHash, predecessorStateData.assertionState, - predecessorStateData.prevAssertionHash, - predecessorStateData.inboxAcc + predecessorStateData.prevAssertionHash ); if (args.endHistoryRoot != claimStateData.assertionState.endHistoryRoot) { @@ -376,8 +374,7 @@ contract EdgeChallengeManager is IEdgeChallengeManager, Initializable { assertionChain.validateAssertionHash( topEdge.claimId, claimStateData.assertionState, - claimStateData.prevAssertionHash, - claimStateData.inboxAcc + claimStateData.prevAssertionHash ); assertionBlocks = assertionChain.getSecondChildCreationBlock( claimStateData.prevAssertionHash diff --git a/src/challengeV2/IAssertionChain.sol b/src/challengeV2/IAssertionChain.sol index 0a1bf52d2..3b799cfbb 100644 --- a/src/challengeV2/IAssertionChain.sol +++ b/src/challengeV2/IAssertionChain.sol @@ -15,8 +15,7 @@ interface IAssertionChain { function validateAssertionHash( bytes32 assertionHash, AssertionState calldata state, - bytes32 prevAssertionHash, - bytes32 inboxAcc + bytes32 prevAssertionHash ) external view; function validateConfig(bytes32 assertionHash, ConfigData calldata configData) external view; function getFirstChildCreationBlock( diff --git a/src/rollup/Assertion.sol b/src/rollup/Assertion.sol index 89705653e..4b3d7ac71 100644 --- a/src/rollup/Assertion.sol +++ b/src/rollup/Assertion.sol @@ -5,6 +5,7 @@ pragma solidity ^0.8.0; import "./AssertionState.sol"; +import "./MELState.sol"; enum AssertionStatus { // No assertion at this index @@ -50,6 +51,7 @@ struct AssertionInputs { BeforeStateData beforeStateData; AssertionState beforeState; AssertionState afterState; + MELState afterMELState; } struct ConfigData { @@ -57,7 +59,8 @@ struct ConfigData { uint256 requiredStake; address challengeManager; uint64 confirmPeriodBlocks; - uint64 nextInboxPosition; + // The next assertion should process parent chain blocks up to this one + bytes32 nextParentChainBlockHash; } /** diff --git a/src/rollup/IRollupAdmin.sol b/src/rollup/IRollupAdmin.sol index 4de11d4ae..1f9cbe79d 100644 --- a/src/rollup/IRollupAdmin.sol +++ b/src/rollup/IRollupAdmin.sol @@ -162,9 +162,9 @@ interface IRollupAdmin { * After decreasing the base stake the current staker will still have full stake locked up. They can release it by creating a new staker with the * new smaller amount, and using it to create a child of the latest pending assertion. This will make the old staker inactive and withdrawable. * @param newBaseStake New base stake to be set. Must be less than current base stake, otherwise use increaseBaseStake - * @param latestNextInboxPosition The nextInboxPosition of the only pending latestStakedAssertion + * @param latestNextParentChainBlockHash The nextParentChainBlockHash of the only pending latestStakedAssertion */ - function decreaseBaseStake(uint256 newBaseStake, uint64 latestNextInboxPosition) external; + function decreaseBaseStake(uint256 newBaseStake, bytes32 latestNextParentChainBlockHash) external; /** * @notice Increase the base stake required for creating an assertion @@ -187,8 +187,7 @@ interface IRollupAdmin { function forceConfirmAssertion( bytes32 assertionHash, bytes32 parentAssertionHash, - AssertionState calldata confirmState, - bytes32 inboxAcc + AssertionState calldata confirmState ) external; function setLoserStakeEscrow( diff --git a/src/rollup/IRollupCore.sol b/src/rollup/IRollupCore.sol index a170f18f7..ea638324a 100644 --- a/src/rollup/IRollupCore.sol +++ b/src/rollup/IRollupCore.sol @@ -38,8 +38,7 @@ interface IRollupCore is IAssertionChain { bytes32 indexed assertionHash, bytes32 indexed parentAssertionHash, AssertionInputs assertion, - bytes32 afterInboxBatchAcc, - uint256 inboxMaxCount, + bytes32 nextParentChainBlockHash, bytes32 wasmModuleRoot, uint256 requiredStake, address challengeManager, diff --git a/src/rollup/IRollupLogic.sol b/src/rollup/IRollupLogic.sol index b3f825fd2..b5762cdb8 100644 --- a/src/rollup/IRollupLogic.sol +++ b/src/rollup/IRollupLogic.sol @@ -25,8 +25,7 @@ interface IRollupUser is IRollupCore, IOwnable { bytes32 prevAssertionHash, AssertionState calldata confirmState, bytes32 winningEdgeId, - ConfigData calldata prevConfig, - bytes32 inboxAcc + ConfigData calldata prevConfig ) external; function stakeOnNewAssertion( diff --git a/src/rollup/MELState.sol b/src/rollup/MELState.sol new file mode 100644 index 000000000..42d43184e --- /dev/null +++ b/src/rollup/MELState.sol @@ -0,0 +1,46 @@ +// Copyright 2021-2026, Offchain Labs, Inc. +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE +// SPDX-License-Identifier: BUSL-1.1 + +pragma solidity ^0.8.0; + +struct MELState { + // Versioning struct for the state, starting at 0. + uint16 version; + // The parent chain block number where MEL becomes part of the Arbitrum chain's consensus. + uint64 versionActivationBlockNumber; + + // Parent chain ID of the Arbitrum chain that is running MEL. + uint64 parentChainId; + // The latest parent chain block fields processed by MEL. + uint64 parentChainBlockNumber; + bytes32 parentChainBlockHash; + bytes32 parentChainPreviousBlockHash; + + // Address of the contract where batches are posted to. + address batchPostingTargetAddress; + // Address of the contract where delayed messages are posted to. + address delayedMessagePostingTargetAddress; + + // Number of batches observed when extracting with MEL. + uint64 batchCount; + + // Local accumulators related to messsages and delayed messages. + uint64 msgCount; + bytes32 localMsgAccumulator; + + // Accumulators and numbers related to delayed messages. + uint64 delayedMessagesRead; + uint64 delayedMessagesSeen; + bytes32 delayedMessageInboxAcc; + bytes32 delayedMessageOutboxAcc; +} + +/** + * @notice Utility functions for MELState + */ +library MELStateLib { + function hash(MELState memory state) internal pure returns (bytes32) { + return keccak256(abi.encode(state)); + } +} diff --git a/src/rollup/RollupAdminLogic.sol b/src/rollup/RollupAdminLogic.sol index 3fb450fdc..4f50cc400 100644 --- a/src/rollup/RollupAdminLogic.sol +++ b/src/rollup/RollupAdminLogic.sol @@ -69,18 +69,12 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl anyTrustFastConfirmer = config.anyTrustFastConfirmer; bytes32 parentAssertionHash = bytes32(0); - bytes32 inboxAcc = bytes32(0); bytes32 genesisHash = RollupLib.assertionHash({ parentAssertionHash: parentAssertionHash, - afterStateHash: config.genesisAssertionState.hash(), - inboxAcc: inboxAcc + afterStateHash: config.genesisAssertionState.hash() }); - uint256 currentInboxCount = bridge.sequencerMessageCount(); - // ensure to move the inbox forward by at least one message - if (currentInboxCount == config.genesisInboxCount) { - currentInboxCount += 1; - } + bytes32 nextParentChainBlockHash = blockhash(block.number - 1); AssertionNode memory initialAssertion = AssertionNodeLib.createAssertion( true, RollupLib.configHash({ @@ -88,7 +82,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl requiredStake: baseStake, challengeManager: address(challengeManager), confirmPeriodBlocks: confirmPeriodBlocks, - nextInboxPosition: uint64(currentInboxCount) + nextParentChainBlockHash: nextParentChainBlockHash }) ); initializeCore(initialAssertion, genesisHash); @@ -99,8 +93,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl genesisHash, parentAssertionHash, assertionInputs, - inboxAcc, - currentInboxCount, + nextParentChainBlockHash, wasmModuleRoot, baseStake, address(challengeManager), @@ -267,7 +260,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl */ function decreaseBaseStake( uint256 newBaseStake, - uint64 latestNextInboxPosition + bytes32 latestNextParentChainBlockHash ) external override { require(newBaseStake < baseStake, "BASE_STAKE_NOT_DECREASED"); @@ -292,7 +285,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl requiredStake: baseStake, challengeManager: address(challengeManager), confirmPeriodBlocks: confirmPeriodBlocks, - nextInboxPosition: uint64(latestNextInboxPosition) + nextParentChainBlockHash: latestNextParentChainBlockHash }); uint256 pendingCount = 0; @@ -313,7 +306,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl requiredStake: newBaseStake, challengeManager: address(challengeManager), confirmPeriodBlocks: confirmPeriodBlocks, - nextInboxPosition: uint64(latestNextInboxPosition) + nextParentChainBlockHash: latestNextParentChainBlockHash }); pendingCount++; @@ -376,11 +369,10 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl function forceConfirmAssertion( bytes32 assertionHash, bytes32 parentAssertionHash, - AssertionState calldata confirmState, - bytes32 inboxAcc + AssertionState calldata confirmState ) external override whenPaused { // this skip deadline, prev, challenge validations - confirmAssertionInternal(assertionHash, parentAssertionHash, confirmState, inboxAcc); + confirmAssertionInternal(assertionHash, parentAssertionHash, confirmState); emit AssertionForceConfirmed(assertionHash); // previously: emit OwnerFunctionCalled(24); } diff --git a/src/rollup/RollupCore.sol b/src/rollup/RollupCore.sol index cec8a2af9..91ab716c0 100644 --- a/src/rollup/RollupCore.sol +++ b/src/rollup/RollupCore.sol @@ -9,6 +9,7 @@ import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeab import "./Assertion.sol"; import "./RollupLib.sol"; +import "./MELState.sol"; import "./IRollupEventInbox.sol"; import "./IRollupCore.sol"; @@ -23,6 +24,7 @@ import "../libraries/ArbitrumChecker.sol"; abstract contract RollupCore is IRollupCore, PausableUpgradeable { using AssertionNodeLib for AssertionNode; using GlobalStateLib for GlobalState; + using MELStateLib for MELState; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; // Rollup Config @@ -279,8 +281,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { function confirmAssertionInternal( bytes32 assertionHash, bytes32 parentAssertionHash, - AssertionState calldata confirmState, - bytes32 inboxAcc + AssertionState calldata confirmState ) internal { AssertionNode storage assertion = getAssertionStorage(assertionHash); // Check that assertion is pending, this also checks that assertion exists @@ -291,8 +292,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { assertionHash == RollupLib.assertionHash({ parentAssertionHash: parentAssertionHash, - afterState: confirmState, - inboxAcc: inboxAcc + afterState: confirmState }), "CONFIRM_DATA" ); @@ -420,7 +420,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { AssertionInputs calldata assertion, bytes32 prevAssertionHash, bytes32 expectedAssertionHash - ) internal returns (bytes32 newAssertionHash, bool overflowAssertion) { + ) internal returns (bytes32 newAssertionHash) { // Validate the config hash RollupLib.validateConfigHash( assertion.beforeStateData.configData, getAssertionStorage(prevAssertionHash).configHash @@ -439,12 +439,17 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { require( RollupLib.assertionHash( assertion.beforeStateData.prevPrevAssertionHash, - assertion.beforeState, - assertion.beforeStateData.sequencerBatchAcc + assertion.beforeState ) == prevAssertionHash, "INVALID_BEFORE_STATE" ); + // validate the MELState hash provided + require( + assertion.afterMELState.hash() == assertion.afterState.globalState.getMELStateHash(), + "INVALID_MEL_STATE" + ); + // The rollup cannot advance from an errored state // If it reaches an errored state it must be corrected by an administrator // This will involve updating the wasm root and creating an alternative assertion @@ -453,88 +458,24 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { require(assertion.beforeState.machineStatus == MachineStatus.FINISHED, "BAD_PREV_STATUS"); AssertionNode storage prevAssertion = getAssertionStorage(prevAssertionHash); - // Required inbox position through which the next assertion (the one after this new assertion) must consume - uint256 nextInboxPosition; - bytes32 sequencerBatchAcc; { - // This new assertion consumes the messages from prevInboxPosition to afterInboxPosition + // This new assertion consumes the messages from prevParentChainBlockHash to afterParentChainBlockHash GlobalState calldata afterGS = assertion.afterState.globalState; GlobalState calldata beforeGS = assertion.beforeState.globalState; + MELState calldata afterMELState = assertion.afterMELState; + + // AfterState must have executed at least as many messages as beforeState + require(afterGS.compareExecutedMessages(beforeGS) >= 0, "INBOX_BACKWARDS"); - // there are 3 kinds of assertions that can be made. Assertions must be made when they fill the maximum number - // of blocks, or when they process all messages up to prev.nextInboxPosition. When they fill the max - // blocks, but dont manage to process all messages, we call this an "overflow" assertion. - // 1. ERRORED assertion - // The machine finished in an ERRORED state. This can happen with processing any - // messages, or moving the position in the message. - // 2. FINISHED assertion that did not overflow - // The machine finished as normal, and fully processed all the messages up to prev.nextInboxPosition. - // In this case the inbox position must equal prev.nextInboxPosition and position in message must be 0 - // 3. FINISHED assertion that did overflow - // The machine finished as normal, but didn't process all messages in the inbox. - // The inbox can be anywhere between the previous assertion's position and the nextInboxPosition, exclusive. - - // All types of assertion must have inbox position in the range prev.inboxPosition <= x <= prev.nextInboxPosition - require(afterGS.comparePositions(beforeGS) >= 0, "INBOX_BACKWARDS"); - int256 afterStateCmpMaxInbox = afterGS.comparePositionsAgainstStartOfBatch( - assertion.beforeStateData.configData.nextInboxPosition - ); - require(afterStateCmpMaxInbox <= 0, "INBOX_TOO_FAR"); - - if ( - assertion.afterState.machineStatus != MachineStatus.ERRORED - && afterStateCmpMaxInbox < 0 - ) { - // If we didn't reach the target next inbox position, this is an overflow assertion. - overflowAssertion = true; - // This shouldn't be necessary, but might as well constrain the assertion to be non-empty - require(afterGS.comparePositions(beforeGS) > 0, "OVERFLOW_STANDSTILL"); - } - // Inbox position at the time of this assertion being created - uint256 currentInboxPosition = bridge.sequencerMessageCount(); - // Cannot read more messages than currently exist in the inbox - require( - afterGS.comparePositionsAgainstStartOfBatch(currentInboxPosition) <= 0, - "INBOX_PAST_END" - ); - - // under normal circumstances prev.nextInboxPosition is guaranteed to exist - // because we populate it from bridge.sequencerMessageCount(). However, when - // the inbox message count doesnt change we artificially increase it by 1 as explained below - // in this case we need to ensure when the assertion is made the inbox messages are available - // to ensure that a valid assertion can actually be made. + // Checking the last processed block hash (we won't check for overflowing assertions) require( - assertion.beforeStateData.configData.nextInboxPosition <= currentInboxPosition, - "INBOX_NOT_POPULATED" + afterMELState.parentChainBlockHash == assertion.beforeStateData.configData.nextParentChainBlockHash, + "BAD_PARENT_CHAIN_BLOCK_HASH" ); - - // The next assertion must consume all the messages that are currently found in the inbox - uint256 afterInboxPosition = afterGS.getInboxPosition(); - if (afterInboxPosition == currentInboxPosition) { - // No new messages have been added to the inbox since the last assertion - // In this case if we set the next inbox position to the current one we would be insisting that - // the next assertion process no messages. So instead we increment the next inbox position to current - // plus one, so that the next assertion will process exactly one message. - // Thus, no assertion can be empty (except the genesis assertion, which is created - // via a different codepath). - nextInboxPosition = currentInboxPosition + 1; - } else { - nextInboxPosition = currentInboxPosition; - } - - // only the genesis assertion processes no messages, and that assertion is created - // when we initialize this contract. Therefore, all assertions created here should have a non - // zero inbox position. - require(afterInboxPosition != 0, "EMPTY_INBOX_COUNT"); - - // Fetch the inbox accumulator for this message count. Fetching this and checking against it - // allows the assertion creator to ensure they're creating an assertion against the expected - // inbox messages - sequencerBatchAcc = bridge.sequencerInboxAccs(afterInboxPosition - 1); } - newAssertionHash = - RollupLib.assertionHash(prevAssertionHash, assertion.afterState, sequencerBatchAcc); + // AfterState includes the hash of the MELState up to which messages have been processed + newAssertionHash = RollupLib.assertionHash(prevAssertionHash, assertion.afterState); // allow an assertion creator to ensure that they're creating their assertion against the expected state require( @@ -550,6 +491,9 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { "ASSERTION_SEEN" ); + // Next assertion will have to process messages from blocks up to the previous one + bytes32 nextParentChainBlockHash = blockhash(block.number - 1); + // state updates AssertionNode memory newAssertion = AssertionNodeLib.createAssertion( prevAssertion.firstChildBlock == 0, // assumes block 0 is impossible @@ -558,7 +502,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { requiredStake: baseStake, challengeManager: address(challengeManager), confirmPeriodBlocks: confirmPeriodBlocks, - nextInboxPosition: uint64(nextInboxPosition) + nextParentChainBlockHash: nextParentChainBlockHash }) ); @@ -571,8 +515,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { newAssertionHash, prevAssertionHash, assertion, - sequencerBatchAcc, - nextInboxPosition, + nextParentChainBlockHash, wasmModuleRoot, baseStake, address(challengeManager), @@ -593,11 +536,9 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { AssertionState memory emptyAssertionState = AssertionState(emptyGlobalState, MachineStatus.FINISHED, bytes32(0)); bytes32 parentAssertionHash = bytes32(0); - bytes32 inboxAcc = bytes32(0); return RollupLib.assertionHash({ parentAssertionHash: parentAssertionHash, - afterState: emptyAssertionState, - inboxAcc: inboxAcc + afterState: emptyAssertionState }); } @@ -616,11 +557,10 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { function validateAssertionHash( bytes32 assertionHash, AssertionState calldata state, - bytes32 prevAssertionHash, - bytes32 inboxAcc + bytes32 prevAssertionHash ) external pure { require( - assertionHash == RollupLib.assertionHash(prevAssertionHash, state, inboxAcc), + assertionHash == RollupLib.assertionHash(prevAssertionHash, state), "INVALID_ASSERTION_HASH" ); } diff --git a/src/rollup/RollupLib.sol b/src/rollup/RollupLib.sol index 83a069a3e..448157ad1 100644 --- a/src/rollup/RollupLib.sol +++ b/src/rollup/RollupLib.sol @@ -20,23 +20,22 @@ library RollupLib { // The `assertionHash` contains all the information needed to determine an assertion's validity. // This helps protect validators against reorgs by letting them bind their assertion to the current chain state. + // `afterState` includes a hash of the MELState up to which messages have been processed. function assertionHash( bytes32 parentAssertionHash, - AssertionState memory afterState, - bytes32 inboxAcc + AssertionState memory afterState ) internal pure returns (bytes32) { // we can no longer have `hasSibling` in the assertion hash as it would allow identical assertions - return assertionHash(parentAssertionHash, afterState.hash(), inboxAcc); + return assertionHash(parentAssertionHash, afterState.hash()); } // Takes in a hash of the afterState instead of the afterState itself function assertionHash( bytes32 parentAssertionHash, - bytes32 afterStateHash, - bytes32 inboxAcc + bytes32 afterStateHash ) internal pure returns (bytes32) { // we can no longer have `hasSibling` in the assertion hash as it would allow identical assertions - return keccak256(abi.encodePacked(parentAssertionHash, afterStateHash, inboxAcc)); + return keccak256(abi.encodePacked(parentAssertionHash, afterStateHash)); } // All these should be emited in AssertionCreated event @@ -45,7 +44,7 @@ library RollupLib { uint256 requiredStake, address challengeManager, uint64 confirmPeriodBlocks, - uint64 nextInboxPosition + bytes32 nextParentChainBlockHash ) internal pure returns (bytes32) { return keccak256( abi.encodePacked( @@ -53,7 +52,7 @@ library RollupLib { requiredStake, challengeManager, confirmPeriodBlocks, - nextInboxPosition + nextParentChainBlockHash ) ); } @@ -69,7 +68,7 @@ library RollupLib { configData.requiredStake, configData.challengeManager, configData.confirmPeriodBlocks, - configData.nextInboxPosition + configData.nextParentChainBlockHash ), "CONFIG_HASH_MISMATCH" ); diff --git a/src/rollup/RollupUserLogic.sol b/src/rollup/RollupUserLogic.sol index fdfca221d..3595f222e 100644 --- a/src/rollup/RollupUserLogic.sol +++ b/src/rollup/RollupUserLogic.sol @@ -77,8 +77,7 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { bytes32 prevAssertionHash, AssertionState calldata confirmState, bytes32 winningEdgeId, - ConfigData calldata prevConfig, - bytes32 inboxAcc + ConfigData calldata prevConfig ) external onlyValidator(msg.sender) whenNotPaused { /* * To confirm an assertion, the following must be true: @@ -124,7 +123,7 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { ); } - confirmAssertionInternal(assertionHash, prevAssertionHash, confirmState, inboxAcc); + confirmAssertionInternal(assertionHash, prevAssertionHash, confirmState); } /** @@ -146,14 +145,12 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { * @notice Computes the hash of an assertion * @param state The execution state for the assertion * @param prevAssertionHash The hash of the assertion's parent - * @param inboxAcc The inbox batch accumulator */ function computeAssertionHash( bytes32 prevAssertionHash, - AssertionState calldata state, - bytes32 inboxAcc + AssertionState calldata state ) external pure returns (bytes32) { - return RollupLib.assertionHash(prevAssertionHash, state, inboxAcc); + return RollupLib.assertionHash(prevAssertionHash, state); } /** @@ -192,8 +189,7 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { bytes32 prevAssertion = RollupLib.assertionHash( assertion.beforeStateData.prevPrevAssertionHash, - assertion.beforeState, - assertion.beforeStateData.sequencerBatchAcc + assertion.beforeState ); getAssertionStorage(prevAssertion).requireExists(); @@ -206,15 +202,12 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { "STAKED_ON_ANOTHER_BRANCH" ); - (bytes32 newAssertionHash, bool overflowAssertion) = - createNewAssertion(assertion, prevAssertion, expectedAssertionHash); + bytes32 newAssertionHash = createNewAssertion(assertion, prevAssertion, expectedAssertionHash); _stakerMap[msg.sender].latestStakedAssertion = newAssertionHash; - if (!overflowAssertion) { - uint256 timeSincePrev = block.number - getAssertionStorage(prevAssertion).createdAtBlock; - // Verify that assertion meets the minimum Delta time requirement - require(timeSincePrev >= minimumAssertionPeriod, "TIME_DELTA"); - } + uint256 timeSincePrev = block.number - getAssertionStorage(prevAssertion).createdAtBlock; + // Verify that assertion meets the minimum Delta time requirement + require(timeSincePrev >= minimumAssertionPeriod, "TIME_DELTA"); if (!getAssertionStorage(newAssertionHash).isFirstChild) { // We assume assertion.beforeStateData is valid here as it will be validated in createNewAssertion @@ -293,12 +286,11 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { function fastConfirmAssertion( bytes32 assertionHash, bytes32 parentAssertionHash, - AssertionState calldata confirmState, - bytes32 inboxAcc + AssertionState calldata confirmState ) public whenNotPaused { require(msg.sender == anyTrustFastConfirmer, "NOT_FAST_CONFIRMER"); // this skip deadline, prev, challenge validations - confirmAssertionInternal(assertionHash, parentAssertionHash, confirmState, inboxAcc); + confirmAssertionInternal(assertionHash, parentAssertionHash, confirmState); } /** @@ -321,15 +313,13 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { bytes32 prevAssertion = RollupLib.assertionHash( assertion.beforeStateData.prevPrevAssertionHash, - assertion.beforeState, - assertion.beforeStateData.sequencerBatchAcc + assertion.beforeState ); getAssertionStorage(prevAssertion).requireExists(); if (status == AssertionStatus.NoAssertion) { // If not exists, we create the new assertion - (bytes32 newAssertionHash,) = - createNewAssertion(assertion, prevAssertion, expectedAssertionHash); + bytes32 newAssertionHash = createNewAssertion(assertion, prevAssertion, expectedAssertionHash); if (!getAssertionStorage(newAssertionHash).isFirstChild) { // only 1 of the children can be confirmed and get their stake refunded // so we send the other children's stake to the loserStakeEscrow @@ -344,8 +334,7 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { fastConfirmAssertion( expectedAssertionHash, prevAssertion, - assertion.afterState, - bridge.sequencerInboxAccs(assertion.afterState.globalState.getInboxPosition() - 1) + assertion.afterState ); } diff --git a/src/state/Deserialize.sol b/src/state/Deserialize.sol index e77eff2f2..84c22147e 100644 --- a/src/state/Deserialize.sol +++ b/src/state/Deserialize.sol @@ -242,6 +242,8 @@ library Deserialize { // using constant ints for array size requires newer solidity bytes32[2] memory bytes32Vals; uint64[2] memory u64Vals; + bytes32[2] memory melBytes32Vals; + uint64[2] memory melU64Vals; for (uint8 i = 0; i < GlobalStateLib.BYTES32_VALS_NUM; i++) { (bytes32Vals[i], offset) = b32(proof, offset); @@ -249,7 +251,19 @@ library Deserialize { for (uint8 i = 0; i < GlobalStateLib.U64_VALS_NUM; i++) { (u64Vals[i], offset) = u64(proof, offset); } - state = GlobalState({bytes32Vals: bytes32Vals, u64Vals: u64Vals}); + for (uint8 i = 0; i < GlobalStateLib.BYTES32_VALS_NUM; i++) { + (melBytes32Vals[i], offset) = b32(proof, offset); + } + for (uint8 i = 0; i < GlobalStateLib.U64_VALS_NUM; i++) { + (melU64Vals[i], offset) = u64(proof, offset); + } + + state = GlobalState({ + bytes32Vals: bytes32Vals, + u64Vals: u64Vals, + melBytes32Vals: melBytes32Vals, + melU64Vals: melU64Vals + }); } function machine( diff --git a/src/state/GlobalState.sol b/src/state/GlobalState.sol index fb4505302..57d262961 100644 --- a/src/state/GlobalState.sol +++ b/src/state/GlobalState.sol @@ -5,8 +5,15 @@ pragma solidity ^0.8.0; struct GlobalState { + // BlockHash and SendRoot bytes32[2] bytes32Vals; + // Deprecated after MEL: Batch (InboxPosition) and PositionInBatch (PositionInMessage) uint64[2] u64Vals; + + // MELState hash and NextMsg hash + bytes32[2] melBytes32Vals; + // MsgCount and ExecutedMsgCount + uint64[2] melU64Vals; } library GlobalStateLib { @@ -24,7 +31,11 @@ library GlobalStateLib { state.bytes32Vals[0], state.bytes32Vals[1], state.u64Vals[0], - state.u64Vals[1] + state.u64Vals[1], + state.melBytes32Vals[0], + state.melBytes32Vals[1], + state.melU64Vals[0], + state.melU64Vals[1] ) ); } @@ -53,6 +64,30 @@ library GlobalStateLib { return state.u64Vals[1]; } + function getMELStateHash( + GlobalState memory state + ) internal pure returns (bytes32) { + return state.melBytes32Vals[0]; + } + + function getMELNextMsgHash( + GlobalState memory state + ) internal pure returns (bytes32) { + return state.melBytes32Vals[1]; + } + + function getMELMsgCount( + GlobalState memory state + ) internal pure returns (uint64) { + return state.melU64Vals[0]; + } + + function getMELExecutedMsgCount( + GlobalState memory state + ) internal pure returns (uint64) { + return state.melU64Vals[1]; + } + function isEmpty( GlobalState calldata state ) internal pure returns (bool) { @@ -102,4 +137,19 @@ library GlobalStateLib { } } } + + function compareExecutedMessages( + GlobalState calldata a, + GlobalState calldata b + ) internal pure returns (int256) { + uint64 aPos = a.getMELExecutedMsgCount(); + uint64 bPos = b.getMELExecutedMsgCount(); + if (aPos < bPos) { + return -1; + } else if (aPos > bPos) { + return 1; + } else { + return 0; + } + } } From 7788919287ca065de7700db102d3c013c3b632de Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Thu, 23 Apr 2026 11:16:47 +0100 Subject: [PATCH 03/17] Update MELState structure --- src/rollup/IRollupAdmin.sol | 4 ++-- src/rollup/MELState.sol | 20 +++++++++++--------- src/rollup/RollupAdminLogic.sol | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/rollup/IRollupAdmin.sol b/src/rollup/IRollupAdmin.sol index 1f9cbe79d..de980e343 100644 --- a/src/rollup/IRollupAdmin.sol +++ b/src/rollup/IRollupAdmin.sol @@ -67,7 +67,7 @@ interface IRollupAdmin { /// @dev MELConfig was set event MELConfigSet( - uint64 indexed melVersion, address indexed inbox, address indexed sequencerInbox, uint64 activationBlock + uint16 indexed melVersion, address indexed inbox, address indexed sequencerInbox, uint64 activationBlock ); function initialize( @@ -249,7 +249,7 @@ interface IRollupAdmin { * @param _sequencerInbox new address of sequencer inbox */ function setMELConfig( - uint64 _melVersion, + uint16 _melVersion, address _inbox, address _sequencerInbox ) external; diff --git a/src/rollup/MELState.sol b/src/rollup/MELState.sol index 42d43184e..065b38a38 100644 --- a/src/rollup/MELState.sol +++ b/src/rollup/MELState.sol @@ -7,28 +7,30 @@ pragma solidity ^0.8.0; struct MELState { // Versioning struct for the state, starting at 0. uint16 version; - // The parent chain block number where MEL becomes part of the Arbitrum chain's consensus. - uint64 versionActivationBlockNumber; - + // Parent chain ID of the Arbitrum chain that is running MEL. uint64 parentChainId; // The latest parent chain block fields processed by MEL. uint64 parentChainBlockNumber; - bytes32 parentChainBlockHash; - bytes32 parentChainPreviousBlockHash; - + // Address of the contract where batches are posted to. address batchPostingTargetAddress; // Address of the contract where delayed messages are posted to. address delayedMessagePostingTargetAddress; - + + // The latest parent chain block hash observed by MEL and the hash of its parent + bytes32 parentChainBlockHash; + bytes32 parentChainPreviousBlockHash; + // Number of batches observed when extracting with MEL. uint64 batchCount; - // Local accumulators related to messsages and delayed messages. + // Total messages extracted by MEL uint64 msgCount; + + // Represents messages accumulated during processing of this specific parent chain block bytes32 localMsgAccumulator; - + // Accumulators and numbers related to delayed messages. uint64 delayedMessagesRead; uint64 delayedMessagesSeen; diff --git a/src/rollup/RollupAdminLogic.sol b/src/rollup/RollupAdminLogic.sol index 4f50cc400..b59605a91 100644 --- a/src/rollup/RollupAdminLogic.sol +++ b/src/rollup/RollupAdminLogic.sol @@ -464,7 +464,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl * @inheritdoc IRollupAdmin */ function setMELConfig( - uint64 _melVersion, + uint16 _melVersion, address _inbox, address _sequencerInbox ) external { From d7f4c6a5b57b80064a31673a69d3f8fd556ca1c1 Mon Sep 17 00:00:00 2001 From: ganeshvanahalli Date: Fri, 24 Apr 2026 12:55:03 +0530 Subject: [PATCH 04/17] minimal change to make this branch work with nitro --- src/challengeV2/EdgeChallengeManager.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/challengeV2/EdgeChallengeManager.sol b/src/challengeV2/EdgeChallengeManager.sol index 098c3c2af..0d7de3e53 100644 --- a/src/challengeV2/EdgeChallengeManager.sol +++ b/src/challengeV2/EdgeChallengeManager.sol @@ -399,8 +399,11 @@ contract EdgeChallengeManager is IEdgeChallengeManager, Initializable { assertionChain.validateConfig(prevAssertionHash, prevConfig); + // TODO(PR 427): OSP contracts are marked as pending work in the PR. + // Inbox-position-based checks no longer apply; use type(uint256).max as + // a stopgap until OSP is rewired against `nextParentChainBlockHash`. ExecutionContext memory execCtx = ExecutionContext({ - maxInboxMessagesRead: prevConfig.nextInboxPosition, + maxInboxMessagesRead: type(uint256).max, bridge: assertionChain.bridge(), initialWasmModuleRoot: prevConfig.wasmModuleRoot }); From 6ef1a11357ea4214fce9b03666141a5ef2176c51 Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Mon, 27 Apr 2026 13:02:00 +0100 Subject: [PATCH 05/17] Allow for setting melVersion=0, and modify GlobalState structure --- src/rollup/RollupAdminLogic.sol | 26 ++++++++--------- src/rollup/RollupCore.sol | 16 +++++------ src/state/Deserialize.sol | 19 ++---------- src/state/GlobalState.sol | 51 +++++++++++++++------------------ 4 files changed, 46 insertions(+), 66 deletions(-) diff --git a/src/rollup/RollupAdminLogic.sol b/src/rollup/RollupAdminLogic.sol index b59605a91..2cf1144d5 100644 --- a/src/rollup/RollupAdminLogic.sol +++ b/src/rollup/RollupAdminLogic.sol @@ -463,20 +463,13 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl /** * @inheritdoc IRollupAdmin */ - function setMELConfig( - uint16 _melVersion, - address _inbox, - address _sequencerInbox - ) external { - // MEL versions can only be increased - require(_melVersion > melVersion, "INVALID_MEL_VERSION"); - - // Setting the contracts - setInbox(IInboxBase(_inbox)); - setSequencerInbox(_sequencerInbox); - - // Set the new MEL version - melVersion = _melVersion; + function setMELConfig(uint16 _melVersion, address _inbox, address _sequencerInbox) external { + // MEL versions can only be increased, except for the initial version, which must be version 0 + if (currentMelConfigHash == bytes32(0)) { + require(_melVersion == 0, "INVALID_MEL_VERSION"); + } else { + require(_melVersion > melConfig[currentMelConfigHash].melVersion, "INVALID_MEL_VERSION"); + } // Save the new MELConfig MELConfig memory _melConfig = MELConfig({ @@ -488,6 +481,11 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl bytes32 melConfigHash = keccak256(abi.encode(_melConfig)); melConfig[melConfigHash] = _melConfig; + currentMelConfigHash = melConfigHash; + + // Setting the contracts + setInbox(IInboxBase(_inbox)); + setSequencerInbox(_sequencerInbox); // Emit event to signal the update to nitro emit MELConfigSet(_melVersion, _inbox, _sequencerInbox, uint64(block.number)); diff --git a/src/rollup/RollupCore.sol b/src/rollup/RollupCore.sol index 91ab716c0..110ff44f2 100644 --- a/src/rollup/RollupCore.sol +++ b/src/rollup/RollupCore.sol @@ -119,12 +119,12 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { // If the chain RollupCore is deployed on, this will contain the ArbSys.blockNumber() at each node's creation. mapping(bytes32 => uint256) internal _assertionCreatedAtArbSysBlock; - // Message Extraction Layer (MEL) version - uint64 public melVersion; + // Message Extraction Layer (MEL) current config hash + bytes32 public currentMelConfigHash; // Message Extraction Layer (MEL) config history // MELConfig hash => MELConfig - mapping (bytes32 => MELConfig) public melConfig; + mapping(bytes32 => MELConfig) public melConfig; function sequencerInbox() public view virtual returns (ISequencerInbox) { return ISequencerInbox(bridge.sequencerInbox()); @@ -438,8 +438,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { // validate the provided before state is correct by checking that it's part of the prev assertion hash require( RollupLib.assertionHash( - assertion.beforeStateData.prevPrevAssertionHash, - assertion.beforeState + assertion.beforeStateData.prevPrevAssertionHash, assertion.beforeState ) == prevAssertionHash, "INVALID_BEFORE_STATE" ); @@ -463,18 +462,19 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { GlobalState calldata afterGS = assertion.afterState.globalState; GlobalState calldata beforeGS = assertion.beforeState.globalState; MELState calldata afterMELState = assertion.afterMELState; - + // AfterState must have executed at least as many messages as beforeState require(afterGS.compareExecutedMessages(beforeGS) >= 0, "INBOX_BACKWARDS"); // Checking the last processed block hash (we won't check for overflowing assertions) require( - afterMELState.parentChainBlockHash == assertion.beforeStateData.configData.nextParentChainBlockHash, + afterMELState.parentChainBlockHash + == assertion.beforeStateData.configData.nextParentChainBlockHash, "BAD_PARENT_CHAIN_BLOCK_HASH" ); } - // AfterState includes the hash of the MELState up to which messages have been processed + // AfterState includes the hash of the MELState up to which messages have been read newAssertionHash = RollupLib.assertionHash(prevAssertionHash, assertion.afterState); // allow an assertion creator to ensure that they're creating their assertion against the expected state diff --git a/src/state/Deserialize.sol b/src/state/Deserialize.sol index 84c22147e..7c7a9ac6e 100644 --- a/src/state/Deserialize.sol +++ b/src/state/Deserialize.sol @@ -240,10 +240,8 @@ library Deserialize { offset = startOffset; // using constant ints for array size requires newer solidity - bytes32[2] memory bytes32Vals; + bytes32[4] memory bytes32Vals; uint64[2] memory u64Vals; - bytes32[2] memory melBytes32Vals; - uint64[2] memory melU64Vals; for (uint8 i = 0; i < GlobalStateLib.BYTES32_VALS_NUM; i++) { (bytes32Vals[i], offset) = b32(proof, offset); @@ -251,19 +249,8 @@ library Deserialize { for (uint8 i = 0; i < GlobalStateLib.U64_VALS_NUM; i++) { (u64Vals[i], offset) = u64(proof, offset); } - for (uint8 i = 0; i < GlobalStateLib.BYTES32_VALS_NUM; i++) { - (melBytes32Vals[i], offset) = b32(proof, offset); - } - for (uint8 i = 0; i < GlobalStateLib.U64_VALS_NUM; i++) { - (melU64Vals[i], offset) = u64(proof, offset); - } - - state = GlobalState({ - bytes32Vals: bytes32Vals, - u64Vals: u64Vals, - melBytes32Vals: melBytes32Vals, - melU64Vals: melU64Vals - }); + + state = GlobalState({bytes32Vals: bytes32Vals, u64Vals: u64Vals}); } function machine( diff --git a/src/state/GlobalState.sol b/src/state/GlobalState.sol index 57d262961..0d41c2117 100644 --- a/src/state/GlobalState.sol +++ b/src/state/GlobalState.sol @@ -5,21 +5,17 @@ pragma solidity ^0.8.0; struct GlobalState { - // BlockHash and SendRoot - bytes32[2] bytes32Vals; - // Deprecated after MEL: Batch (InboxPosition) and PositionInBatch (PositionInMessage) + // BlockHash, SendRoot, MELState hash and NextMsg hash + bytes32[4] bytes32Vals; + // TBD: Batch (InboxPosition) and PositionInBatch (PositionInMessage) + // or MsgCount and ExecutedMsgCount uint64[2] u64Vals; - - // MELState hash and NextMsg hash - bytes32[2] melBytes32Vals; - // MsgCount and ExecutedMsgCount - uint64[2] melU64Vals; } library GlobalStateLib { using GlobalStateLib for GlobalState; - uint16 internal constant BYTES32_VALS_NUM = 2; + uint16 internal constant BYTES32_VALS_NUM = 4; uint16 internal constant U64_VALS_NUM = 2; function hash( @@ -30,12 +26,10 @@ library GlobalStateLib { "Global state:", state.bytes32Vals[0], state.bytes32Vals[1], + state.bytes32Vals[2], + state.bytes32Vals[3], state.u64Vals[0], - state.u64Vals[1], - state.melBytes32Vals[0], - state.melBytes32Vals[1], - state.melU64Vals[0], - state.melU64Vals[1] + state.u64Vals[1] ) ); } @@ -52,40 +46,40 @@ library GlobalStateLib { return state.bytes32Vals[1]; } - function getInboxPosition( + function getMELStateHash( GlobalState memory state - ) internal pure returns (uint64) { - return state.u64Vals[0]; + ) internal pure returns (bytes32) { + return state.bytes32Vals[2]; } - function getPositionInMessage( + function getMELNextMsgHash( GlobalState memory state - ) internal pure returns (uint64) { - return state.u64Vals[1]; + ) internal pure returns (bytes32) { + return state.bytes32Vals[3]; } - function getMELStateHash( + function getInboxPosition( GlobalState memory state - ) internal pure returns (bytes32) { - return state.melBytes32Vals[0]; + ) internal pure returns (uint64) { + return state.u64Vals[0]; } - function getMELNextMsgHash( + function getPositionInMessage( GlobalState memory state - ) internal pure returns (bytes32) { - return state.melBytes32Vals[1]; + ) internal pure returns (uint64) { + return state.u64Vals[1]; } function getMELMsgCount( GlobalState memory state ) internal pure returns (uint64) { - return state.melU64Vals[0]; + return state.u64Vals[0]; } function getMELExecutedMsgCount( GlobalState memory state ) internal pure returns (uint64) { - return state.melU64Vals[1]; + return state.u64Vals[1]; } function isEmpty( @@ -93,6 +87,7 @@ library GlobalStateLib { ) internal pure returns (bool) { return ( state.bytes32Vals[0] == bytes32(0) && state.bytes32Vals[1] == bytes32(0) + && state.bytes32Vals[2] == bytes32(0) && state.bytes32Vals[3] == bytes32(0) && state.u64Vals[0] == 0 && state.u64Vals[1] == 0 ); } From 3e4d0c20d30ec8b2e02931796a26c699d9ebe933 Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Mon, 18 May 2026 09:20:33 +0100 Subject: [PATCH 06/17] Clean structs and functions --- src/challengeV2/libraries/Structs.sol | 4 --- src/state/GlobalState.sol | 41 --------------------------- 2 files changed, 45 deletions(-) diff --git a/src/challengeV2/libraries/Structs.sol b/src/challengeV2/libraries/Structs.sol index 481613d83..cd8dae149 100644 --- a/src/challengeV2/libraries/Structs.sol +++ b/src/challengeV2/libraries/Structs.sol @@ -13,8 +13,6 @@ struct AssertionStateData { AssertionState assertionState; /// @notice assertion Hash of the prev assertion bytes32 prevAssertionHash; - /// @notice Inbox accumulator of the assertion - bytes32 inboxAcc; } /// @notice Data for creating a layer zero edge @@ -44,8 +42,6 @@ struct CreateEdgeArgs { /// bytes32[]: Inclusion proof - proof to show that the end state is the last state in the end history root /// AssertionStateData: the before state of the edge /// AssertionStateData: the after state of the edge - /// bytes32 predecessorId: id of the prev assertion - /// bytes32 inboxAcc: the inbox accumulator of the assertion /// For BigStep and SmallStep edges this is the abi encoding of: /// bytes32: Start state - first state the edge commits to /// bytes32: End state - last state the edge commits to diff --git a/src/state/GlobalState.sol b/src/state/GlobalState.sol index 0d41c2117..de97090d5 100644 --- a/src/state/GlobalState.sol +++ b/src/state/GlobalState.sol @@ -92,47 +92,6 @@ library GlobalStateLib { ); } - function comparePositions( - GlobalState calldata a, - GlobalState calldata b - ) internal pure returns (int256) { - uint64 aPos = a.getInboxPosition(); - uint64 bPos = b.getInboxPosition(); - if (aPos < bPos) { - return -1; - } else if (aPos > bPos) { - return 1; - } else { - uint64 aMsg = a.getPositionInMessage(); - uint64 bMsg = b.getPositionInMessage(); - if (aMsg < bMsg) { - return -1; - } else if (aMsg > bMsg) { - return 1; - } else { - return 0; - } - } - } - - function comparePositionsAgainstStartOfBatch( - GlobalState calldata a, - uint256 bPos - ) internal pure returns (int256) { - uint64 aPos = a.getInboxPosition(); - if (aPos < bPos) { - return -1; - } else if (aPos > bPos) { - return 1; - } else { - if (a.getPositionInMessage() > 0) { - return 1; - } else { - return 0; - } - } - } - function compareExecutedMessages( GlobalState calldata a, GlobalState calldata b From 02b14b02f951d17ebddea5a349c433f6a361cd79 Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Tue, 19 May 2026 10:35:36 +0100 Subject: [PATCH 07/17] Relocate MELState --- src/rollup/Assertion.sol | 2 +- src/rollup/RollupCore.sol | 2 +- src/{rollup => state}/MELState.sol | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename src/{rollup => state}/MELState.sol (100%) diff --git a/src/rollup/Assertion.sol b/src/rollup/Assertion.sol index 4b3d7ac71..9d9553d35 100644 --- a/src/rollup/Assertion.sol +++ b/src/rollup/Assertion.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; import "./AssertionState.sol"; -import "./MELState.sol"; +import "../state/MELState.sol"; enum AssertionStatus { // No assertion at this index diff --git a/src/rollup/RollupCore.sol b/src/rollup/RollupCore.sol index 110ff44f2..e68edab1d 100644 --- a/src/rollup/RollupCore.sol +++ b/src/rollup/RollupCore.sol @@ -9,11 +9,11 @@ import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeab import "./Assertion.sol"; import "./RollupLib.sol"; -import "./MELState.sol"; import "./IRollupEventInbox.sol"; import "./IRollupCore.sol"; import "../state/Machine.sol"; +import "../state/MELState.sol"; import "../bridge/ISequencerInbox.sol"; import "../bridge/IBridge.sol"; diff --git a/src/rollup/MELState.sol b/src/state/MELState.sol similarity index 100% rename from src/rollup/MELState.sol rename to src/state/MELState.sol From 85bd3df449cce53821e7da23c9326b1b074ae10f Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Thu, 21 May 2026 12:57:09 +0100 Subject: [PATCH 08/17] Format and signatures and storage --- src/challengeV2/EdgeChallengeManager.sol | 8 +- src/rollup/IRollupAdmin.sol | 16 +- src/rollup/RollupUserLogic.sol | 18 +- src/state/MELState.sol | 57 +++--- test/signatures/EdgeChallengeManager | 134 ++++++------ test/signatures/OneStepProofEntry | 2 +- test/signatures/RollupAdminLogic | 18 +- test/signatures/RollupCore | 178 ++++++++-------- test/signatures/RollupCreator | 2 +- test/signatures/RollupUserLogic | 250 ++++++++++++----------- test/storage/RollupAdminLogic | 134 ++++++------ test/storage/RollupCore | 134 ++++++------ test/storage/RollupUserLogic | 134 ++++++------ 13 files changed, 550 insertions(+), 535 deletions(-) diff --git a/src/challengeV2/EdgeChallengeManager.sol b/src/challengeV2/EdgeChallengeManager.sol index 0d7de3e53..7e51ad9f2 100644 --- a/src/challengeV2/EdgeChallengeManager.sol +++ b/src/challengeV2/EdgeChallengeManager.sol @@ -222,9 +222,7 @@ contract EdgeChallengeManager is IEdgeChallengeManager, Initializable { ) = abi.decode(args.proof, (bytes32[], AssertionStateData, AssertionStateData)); assertionChain.validateAssertionHash( - args.claimId, - claimStateData.assertionState, - claimStateData.prevAssertionHash + args.claimId, claimStateData.assertionState, claimStateData.prevAssertionHash ); assertionChain.validateAssertionHash( @@ -372,9 +370,7 @@ contract EdgeChallengeManager is IEdgeChallengeManager, Initializable { ChallengeEdgeLib.levelToType(topEdge.level, NUM_BIGSTEP_LEVEL) == EdgeType.Block; if (isBlockLevel && assertionChain.isFirstChild(topEdge.claimId)) { assertionChain.validateAssertionHash( - topEdge.claimId, - claimStateData.assertionState, - claimStateData.prevAssertionHash + topEdge.claimId, claimStateData.assertionState, claimStateData.prevAssertionHash ); assertionBlocks = assertionChain.getSecondChildCreationBlock( claimStateData.prevAssertionHash diff --git a/src/rollup/IRollupAdmin.sol b/src/rollup/IRollupAdmin.sol index de980e343..569e42d98 100644 --- a/src/rollup/IRollupAdmin.sol +++ b/src/rollup/IRollupAdmin.sol @@ -67,7 +67,10 @@ interface IRollupAdmin { /// @dev MELConfig was set event MELConfigSet( - uint16 indexed melVersion, address indexed inbox, address indexed sequencerInbox, uint64 activationBlock + uint16 indexed melVersion, + address indexed inbox, + address indexed sequencerInbox, + uint64 activationBlock ); function initialize( @@ -164,7 +167,10 @@ interface IRollupAdmin { * @param newBaseStake New base stake to be set. Must be less than current base stake, otherwise use increaseBaseStake * @param latestNextParentChainBlockHash The nextParentChainBlockHash of the only pending latestStakedAssertion */ - function decreaseBaseStake(uint256 newBaseStake, bytes32 latestNextParentChainBlockHash) external; + function decreaseBaseStake( + uint256 newBaseStake, + bytes32 latestNextParentChainBlockHash + ) external; /** * @notice Increase the base stake required for creating an assertion @@ -248,9 +254,5 @@ interface IRollupAdmin { * @param _inbox new address of the inbox contract * @param _sequencerInbox new address of sequencer inbox */ - function setMELConfig( - uint16 _melVersion, - address _inbox, - address _sequencerInbox - ) external; + function setMELConfig(uint16 _melVersion, address _inbox, address _sequencerInbox) external; } diff --git a/src/rollup/RollupUserLogic.sol b/src/rollup/RollupUserLogic.sol index 3595f222e..e6b75c33a 100644 --- a/src/rollup/RollupUserLogic.sol +++ b/src/rollup/RollupUserLogic.sol @@ -188,8 +188,7 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { require(baseStake >= assertion.beforeStateData.configData.requiredStake, "STAKE_TOO_LOW"); bytes32 prevAssertion = RollupLib.assertionHash( - assertion.beforeStateData.prevPrevAssertionHash, - assertion.beforeState + assertion.beforeStateData.prevPrevAssertionHash, assertion.beforeState ); getAssertionStorage(prevAssertion).requireExists(); @@ -202,7 +201,8 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { "STAKED_ON_ANOTHER_BRANCH" ); - bytes32 newAssertionHash = createNewAssertion(assertion, prevAssertion, expectedAssertionHash); + bytes32 newAssertionHash = + createNewAssertion(assertion, prevAssertion, expectedAssertionHash); _stakerMap[msg.sender].latestStakedAssertion = newAssertionHash; uint256 timeSincePrev = block.number - getAssertionStorage(prevAssertion).createdAtBlock; @@ -312,14 +312,14 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { AssertionStatus status = getAssertionStorage(expectedAssertionHash).status; bytes32 prevAssertion = RollupLib.assertionHash( - assertion.beforeStateData.prevPrevAssertionHash, - assertion.beforeState + assertion.beforeStateData.prevPrevAssertionHash, assertion.beforeState ); getAssertionStorage(prevAssertion).requireExists(); if (status == AssertionStatus.NoAssertion) { // If not exists, we create the new assertion - bytes32 newAssertionHash = createNewAssertion(assertion, prevAssertion, expectedAssertionHash); + bytes32 newAssertionHash = + createNewAssertion(assertion, prevAssertion, expectedAssertionHash); if (!getAssertionStorage(newAssertionHash).isFirstChild) { // only 1 of the children can be confirmed and get their stake refunded // so we send the other children's stake to the loserStakeEscrow @@ -331,11 +331,7 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { } // This would revert if the assertion is already confirmed - fastConfirmAssertion( - expectedAssertionHash, - prevAssertion, - assertion.afterState - ); + fastConfirmAssertion(expectedAssertionHash, prevAssertion, assertion.afterState); } function owner() external view returns (address) { diff --git a/src/state/MELState.sol b/src/state/MELState.sol index 065b38a38..21ecf4e34 100644 --- a/src/state/MELState.sol +++ b/src/state/MELState.sol @@ -6,43 +6,38 @@ pragma solidity ^0.8.0; struct MELState { // Versioning struct for the state, starting at 0. - uint16 version; - - // Parent chain ID of the Arbitrum chain that is running MEL. - uint64 parentChainId; - // The latest parent chain block fields processed by MEL. - uint64 parentChainBlockNumber; - - // Address of the contract where batches are posted to. - address batchPostingTargetAddress; - // Address of the contract where delayed messages are posted to. - address delayedMessagePostingTargetAddress; - - // The latest parent chain block hash observed by MEL and the hash of its parent - bytes32 parentChainBlockHash; - bytes32 parentChainPreviousBlockHash; - - // Number of batches observed when extracting with MEL. - uint64 batchCount; - - // Total messages extracted by MEL - uint64 msgCount; - - // Represents messages accumulated during processing of this specific parent chain block - bytes32 localMsgAccumulator; - - // Accumulators and numbers related to delayed messages. - uint64 delayedMessagesRead; - uint64 delayedMessagesSeen; - bytes32 delayedMessageInboxAcc; - bytes32 delayedMessageOutboxAcc; + uint16 version; + // Parent chain ID of the Arbitrum chain that is running MEL. + uint64 parentChainId; + // The latest parent chain block fields processed by MEL. + uint64 parentChainBlockNumber; + // Address of the contract where batches are posted to. + address batchPostingTargetAddress; + // Address of the contract where delayed messages are posted to. + address delayedMessagePostingTargetAddress; + // The latest parent chain block hash observed by MEL and the hash of its parent + bytes32 parentChainBlockHash; + bytes32 parentChainPreviousBlockHash; + // Number of batches observed when extracting with MEL. + uint64 batchCount; + // Total messages extracted by MEL + uint64 msgCount; + // Represents messages accumulated during processing of this specific parent chain block + bytes32 localMsgAccumulator; + // Accumulators and numbers related to delayed messages. + uint64 delayedMessagesRead; + uint64 delayedMessagesSeen; + bytes32 delayedMessageInboxAcc; + bytes32 delayedMessageOutboxAcc; } /** * @notice Utility functions for MELState */ library MELStateLib { - function hash(MELState memory state) internal pure returns (bytes32) { + function hash( + MELState memory state + ) internal pure returns (bytes32) { return keccak256(abi.encode(state)); } } diff --git a/test/signatures/EdgeChallengeManager b/test/signatures/EdgeChallengeManager index f90494506..3642b4c69 100644 --- a/test/signatures/EdgeChallengeManager +++ b/test/signatures/EdgeChallengeManager @@ -1,69 +1,69 @@ -╭----------------------------------------------------------------------------------------------------------------+------------╮ -| Method | Identifier | -+=============================================================================================================================+ -| LAYERZERO_BIGSTEPEDGE_HEIGHT() | 416e6657 | -|----------------------------------------------------------------------------------------------------------------+------------| -| LAYERZERO_BLOCKEDGE_HEIGHT() | 1dce5166 | -|----------------------------------------------------------------------------------------------------------------+------------| -| LAYERZERO_SMALLSTEPEDGE_HEIGHT() | f8ee77d6 | -|----------------------------------------------------------------------------------------------------------------+------------| -| NUM_BIGSTEP_LEVEL() | 5d9e2444 | -|----------------------------------------------------------------------------------------------------------------+------------| -| assertionChain() | 48dd2924 | -|----------------------------------------------------------------------------------------------------------------+------------| -| bisectEdge(bytes32,bytes32,bytes) | c8bc4e43 | -|----------------------------------------------------------------------------------------------------------------+------------| -| calculateEdgeId(uint8,bytes32,uint256,bytes32,uint256,bytes32) | 004d8efe | -|----------------------------------------------------------------------------------------------------------------+------------| -| calculateMutualId(uint8,bytes32,uint256,bytes32,uint256) | c32d8c63 | -|----------------------------------------------------------------------------------------------------------------+------------| -| challengePeriodBlocks() | 46c2781a | -|----------------------------------------------------------------------------------------------------------------+------------| -| confirmEdgeByOneStepProof(bytes32,(bytes32,bytes),(bytes32,uint256,address,uint64,uint64),bytes32[],bytes32[]) | 8c1b3a40 | -|----------------------------------------------------------------------------------------------------------------+------------| -| confirmEdgeByTime(bytes32,(((bytes32[2],uint64[2]),uint8,bytes32),bytes32,bytes32)) | b2a1408e | -|----------------------------------------------------------------------------------------------------------------+------------| -| confirmedRival(bytes32) | e5b123da | -|----------------------------------------------------------------------------------------------------------------+------------| -| createLayerZeroEdge((uint8,bytes32,uint256,bytes32,bytes,bytes)) | 05fae141 | -|----------------------------------------------------------------------------------------------------------------+------------| -| edgeExists(bytes32) | 750e0c0f | -|----------------------------------------------------------------------------------------------------------------+------------| -| edgeLength(bytes32) | eae0328b | -|----------------------------------------------------------------------------------------------------------------+------------| -| excessStakeReceiver() | e94e051e | -|----------------------------------------------------------------------------------------------------------------+------------| -| firstRival(bytes32) | bce6f54f | -|----------------------------------------------------------------------------------------------------------------+------------| -| getEdge(bytes32) | fda2892e | -|----------------------------------------------------------------------------------------------------------------+------------| -| getLayerZeroEndHeight(uint8) | 42e1aaa8 | -|----------------------------------------------------------------------------------------------------------------+------------| -| getPrevAssertionHash(bytes32) | 5a48e0f4 | -|----------------------------------------------------------------------------------------------------------------+------------| -| hasLengthOneRival(bytes32) | 54b64151 | -|----------------------------------------------------------------------------------------------------------------+------------| -| hasMadeLayerZeroRival(address,bytes32) | 655b42f3 | -|----------------------------------------------------------------------------------------------------------------+------------| -| hasRival(bytes32) | 908517e9 | -|----------------------------------------------------------------------------------------------------------------+------------| -| initialize(address,uint64,address,uint256,uint256,uint256,address,address,uint8,uint256[]) | 1a72d54c | -|----------------------------------------------------------------------------------------------------------------+------------| -| multiUpdateTimeCacheByChildren(bytes32[],uint256) | 432bb78a | -|----------------------------------------------------------------------------------------------------------------+------------| -| oneStepProofEntry() | 48923bc5 | -|----------------------------------------------------------------------------------------------------------------+------------| -| refundStake(bytes32) | 748926f3 | -|----------------------------------------------------------------------------------------------------------------+------------| -| stakeAmounts(uint256) | 1c1b4f3a | -|----------------------------------------------------------------------------------------------------------------+------------| -| stakeToken() | 51ed6a30 | -|----------------------------------------------------------------------------------------------------------------+------------| -| timeUnrivaled(bytes32) | 3e35f5e8 | -|----------------------------------------------------------------------------------------------------------------+------------| -| updateTimerCacheByChildren(bytes32,uint256) | edaab54a | -|----------------------------------------------------------------------------------------------------------------+------------| -| updateTimerCacheByClaim(bytes32,bytes32,uint256) | 8826a370 | -╰----------------------------------------------------------------------------------------------------------------+------------╯ +╭-----------------------------------------------------------------------------------------------------------------+------------╮ +| Method | Identifier | ++==============================================================================================================================+ +| LAYERZERO_BIGSTEPEDGE_HEIGHT() | 416e6657 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| LAYERZERO_BLOCKEDGE_HEIGHT() | 1dce5166 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| LAYERZERO_SMALLSTEPEDGE_HEIGHT() | f8ee77d6 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| NUM_BIGSTEP_LEVEL() | 5d9e2444 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| assertionChain() | 48dd2924 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| bisectEdge(bytes32,bytes32,bytes) | c8bc4e43 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| calculateEdgeId(uint8,bytes32,uint256,bytes32,uint256,bytes32) | 004d8efe | +|-----------------------------------------------------------------------------------------------------------------+------------| +| calculateMutualId(uint8,bytes32,uint256,bytes32,uint256) | c32d8c63 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| challengePeriodBlocks() | 46c2781a | +|-----------------------------------------------------------------------------------------------------------------+------------| +| confirmEdgeByOneStepProof(bytes32,(bytes32,bytes),(bytes32,uint256,address,uint64,bytes32),bytes32[],bytes32[]) | d863f8ac | +|-----------------------------------------------------------------------------------------------------------------+------------| +| confirmEdgeByTime(bytes32,(((bytes32[4],uint64[2]),uint8,bytes32),bytes32)) | 5a7f2fb2 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| confirmedRival(bytes32) | e5b123da | +|-----------------------------------------------------------------------------------------------------------------+------------| +| createLayerZeroEdge((uint8,bytes32,uint256,bytes32,bytes,bytes)) | 05fae141 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| edgeExists(bytes32) | 750e0c0f | +|-----------------------------------------------------------------------------------------------------------------+------------| +| edgeLength(bytes32) | eae0328b | +|-----------------------------------------------------------------------------------------------------------------+------------| +| excessStakeReceiver() | e94e051e | +|-----------------------------------------------------------------------------------------------------------------+------------| +| firstRival(bytes32) | bce6f54f | +|-----------------------------------------------------------------------------------------------------------------+------------| +| getEdge(bytes32) | fda2892e | +|-----------------------------------------------------------------------------------------------------------------+------------| +| getLayerZeroEndHeight(uint8) | 42e1aaa8 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| getPrevAssertionHash(bytes32) | 5a48e0f4 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| hasLengthOneRival(bytes32) | 54b64151 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| hasMadeLayerZeroRival(address,bytes32) | 655b42f3 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| hasRival(bytes32) | 908517e9 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| initialize(address,uint64,address,uint256,uint256,uint256,address,address,uint8,uint256[]) | 1a72d54c | +|-----------------------------------------------------------------------------------------------------------------+------------| +| multiUpdateTimeCacheByChildren(bytes32[],uint256) | 432bb78a | +|-----------------------------------------------------------------------------------------------------------------+------------| +| oneStepProofEntry() | 48923bc5 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| refundStake(bytes32) | 748926f3 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| stakeAmounts(uint256) | 1c1b4f3a | +|-----------------------------------------------------------------------------------------------------------------+------------| +| stakeToken() | 51ed6a30 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| timeUnrivaled(bytes32) | 3e35f5e8 | +|-----------------------------------------------------------------------------------------------------------------+------------| +| updateTimerCacheByChildren(bytes32,uint256) | edaab54a | +|-----------------------------------------------------------------------------------------------------------------+------------| +| updateTimerCacheByClaim(bytes32,bytes32,uint256) | 8826a370 | +╰-----------------------------------------------------------------------------------------------------------------+------------╯ diff --git a/test/signatures/OneStepProofEntry b/test/signatures/OneStepProofEntry index f7ddf4201..274bb5af6 100644 --- a/test/signatures/OneStepProofEntry +++ b/test/signatures/OneStepProofEntry @@ -2,7 +2,7 @@ ╭---------------------------------------------------------------+------------╮ | Method | Identifier | +============================================================================+ -| getMachineHash(((bytes32[2],uint64[2]),uint8)) | c39619c4 | +| getMachineHash(((bytes32[4],uint64[2]),uint8)) | c0f88fa6 | |---------------------------------------------------------------+------------| | getStartMachineHash(bytes32,bytes32) | 04997be4 | |---------------------------------------------------------------+------------| diff --git a/test/signatures/RollupAdminLogic b/test/signatures/RollupAdminLogic index 0785cecfb..1bea2fe35 100644 --- a/test/signatures/RollupAdminLogic +++ b/test/signatures/RollupAdminLogic @@ -20,11 +20,13 @@ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | confirmPeriodBlocks() | 2e7acfa6 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| decreaseBaseStake(uint256,uint64) | 089a5d99 | +| currentMelConfigHash() | 010816fb | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| forceConfirmAssertion(bytes32,bytes32,((bytes32[2],uint64[2]),uint8,bytes32),bytes32) | 5bf03833 | +| decreaseBaseStake(uint256,bytes32) | 3d64074a | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| forceCreateAssertion(bytes32,((bytes32,bytes32,(bytes32,uint256,address,uint64,uint64)),((bytes32[2],uint64[2]),uint8,bytes32),((bytes32[2],uint64[2]),uint8,bytes32)),bytes32) | 9a7b4556 | +| forceConfirmAssertion(bytes32,bytes32,((bytes32[4],uint64[2]),uint8,bytes32)) | e6cf817d | +|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| forceCreateAssertion(bytes32,((bytes32,bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 8fe07f10 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | forceRefundStaker(address[]) | 7c75c298 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| @@ -48,7 +50,7 @@ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | increaseBaseStake(uint256) | 8c69f782 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| initialize((uint64,address,uint256,bytes32,address,address,uint256,string,uint256,uint64,uint256[],(uint256,uint256,uint256,uint256),uint256,uint256,uint256,((bytes32[2],uint64[2]),uint8,bytes32),uint256,address,uint8,uint64,(uint64,uint64,uint64),uint256),(address,address,address,address,address,address,address,address,address)) | 10fb7a50 | +| initialize((uint64,address,uint256,bytes32,address,address,uint256,string,uint256,uint64,uint256[],(uint256,uint256,uint256,uint256),uint256,uint256,uint256,((bytes32[4],uint64[2]),uint8,bytes32),uint256,address,uint8,uint64,(uint64,uint64,uint64),uint256),(address,address,address,address,address,address,address,address,address)) | 94d9dbea | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | isFirstChild(bytes32) | 30836228 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| @@ -64,6 +66,8 @@ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | loserStakeEscrow() | f065de3f | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| melConfig(bytes32) | 13f1e3fa | +|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | minimumAssertionPeriod() | 45e38b64 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | outbox() | ce11e6ab | @@ -96,6 +100,8 @@ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | setLoserStakeEscrow(address) | fc8ffa03 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setMELConfig(uint16,address,address) | a96d44ea | +|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | setMinimumAssertionPeriod(uint256) | 948d6588 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | setOutbox(address) | ff204f3b | @@ -126,9 +132,9 @@ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | upgradeToAndCall(address,bytes) | 4f1ef286 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validateAssertionHash(bytes32,((bytes32[2],uint64[2]),uint8,bytes32),bytes32,bytes32) | e51019a6 | +| validateAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32) | 7e356e9b | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validateConfig(bytes32,(bytes32,uint256,address,uint64,uint64)) | 04972af9 | +| validateConfig(bytes32,(bytes32,uint256,address,uint64,bytes32)) | d13666eb | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | validatorAfkBlocks() | e6b3082c | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| diff --git a/test/signatures/RollupCore b/test/signatures/RollupCore index 965917474..de3dc208a 100644 --- a/test/signatures/RollupCore +++ b/test/signatures/RollupCore @@ -1,89 +1,93 @@ -╭---------------------------------------------------------------------------------------+------------╮ -| Method | Identifier | -+====================================================================================================+ -| _stakerMap(address) | e8bd4922 | -|---------------------------------------------------------------------------------------+------------| -| amountStaked(address) | ef40a670 | -|---------------------------------------------------------------------------------------+------------| -| anyTrustFastConfirmer() | 55840a58 | -|---------------------------------------------------------------------------------------+------------| -| baseStake() | 76e7e23b | -|---------------------------------------------------------------------------------------+------------| -| bridge() | e78cea92 | -|---------------------------------------------------------------------------------------+------------| -| chainId() | 9a8a0592 | -|---------------------------------------------------------------------------------------+------------| -| challengeGracePeriodBlocks() | 3be680ea | -|---------------------------------------------------------------------------------------+------------| -| challengeManager() | 023a96fe | -|---------------------------------------------------------------------------------------+------------| -| confirmPeriodBlocks() | 2e7acfa6 | -|---------------------------------------------------------------------------------------+------------| -| genesisAssertionHash() | 353325e0 | -|---------------------------------------------------------------------------------------+------------| -| getAssertion(bytes32) | 88302884 | -|---------------------------------------------------------------------------------------+------------| -| getAssertionCreationBlockForLogLookup(bytes32) | 13c56ca7 | -|---------------------------------------------------------------------------------------+------------| -| getFirstChildCreationBlock(bytes32) | 11715585 | -|---------------------------------------------------------------------------------------+------------| -| getSecondChildCreationBlock(bytes32) | 56bbc9e6 | -|---------------------------------------------------------------------------------------+------------| -| getStaker(address) | a23c44b1 | -|---------------------------------------------------------------------------------------+------------| -| getStakerAddress(uint64) | 6ddd3744 | -|---------------------------------------------------------------------------------------+------------| -| getValidators() | b7ab4db5 | -|---------------------------------------------------------------------------------------+------------| -| inbox() | fb0e722b | -|---------------------------------------------------------------------------------------+------------| -| isFirstChild(bytes32) | 30836228 | -|---------------------------------------------------------------------------------------+------------| -| isPending(bytes32) | e531d8c7 | -|---------------------------------------------------------------------------------------+------------| -| isStaked(address) | 6177fd18 | -|---------------------------------------------------------------------------------------+------------| -| isValidator(address) | facd743b | -|---------------------------------------------------------------------------------------+------------| -| latestConfirmed() | 65f7f80d | -|---------------------------------------------------------------------------------------+------------| -| latestStakedAssertion(address) | 2abdd230 | -|---------------------------------------------------------------------------------------+------------| -| loserStakeEscrow() | f065de3f | -|---------------------------------------------------------------------------------------+------------| -| minimumAssertionPeriod() | 45e38b64 | -|---------------------------------------------------------------------------------------+------------| -| outbox() | ce11e6ab | -|---------------------------------------------------------------------------------------+------------| -| paused() | 5c975abb | -|---------------------------------------------------------------------------------------+------------| -| rollupDeploymentBlock() | 1b1689e9 | -|---------------------------------------------------------------------------------------+------------| -| rollupEventInbox() | aa38a6e7 | -|---------------------------------------------------------------------------------------+------------| -| sequencerInbox() | ee35f327 | -|---------------------------------------------------------------------------------------+------------| -| stakeToken() | 51ed6a30 | -|---------------------------------------------------------------------------------------+------------| -| stakerCount() | dff69787 | -|---------------------------------------------------------------------------------------+------------| -| totalWithdrawableFunds() | 71ef232c | -|---------------------------------------------------------------------------------------+------------| -| validateAssertionHash(bytes32,((bytes32[2],uint64[2]),uint8,bytes32),bytes32,bytes32) | e51019a6 | -|---------------------------------------------------------------------------------------+------------| -| validateConfig(bytes32,(bytes32,uint256,address,uint64,uint64)) | 04972af9 | -|---------------------------------------------------------------------------------------+------------| -| validatorAfkBlocks() | e6b3082c | -|---------------------------------------------------------------------------------------+------------| -| validatorWalletCreator() | bc45e0ae | -|---------------------------------------------------------------------------------------+------------| -| validatorWhitelistDisabled() | 12ab3d3b | -|---------------------------------------------------------------------------------------+------------| -| wasmModuleRoot() | 8ee1a126 | -|---------------------------------------------------------------------------------------+------------| -| withdrawableFunds(address) | 2f30cabd | -|---------------------------------------------------------------------------------------+------------| -| withdrawalAddress(address) | 84728cd0 | -╰---------------------------------------------------------------------------------------+------------╯ +╭-------------------------------------------------------------------------------+------------╮ +| Method | Identifier | ++============================================================================================+ +| _stakerMap(address) | e8bd4922 | +|-------------------------------------------------------------------------------+------------| +| amountStaked(address) | ef40a670 | +|-------------------------------------------------------------------------------+------------| +| anyTrustFastConfirmer() | 55840a58 | +|-------------------------------------------------------------------------------+------------| +| baseStake() | 76e7e23b | +|-------------------------------------------------------------------------------+------------| +| bridge() | e78cea92 | +|-------------------------------------------------------------------------------+------------| +| chainId() | 9a8a0592 | +|-------------------------------------------------------------------------------+------------| +| challengeGracePeriodBlocks() | 3be680ea | +|-------------------------------------------------------------------------------+------------| +| challengeManager() | 023a96fe | +|-------------------------------------------------------------------------------+------------| +| confirmPeriodBlocks() | 2e7acfa6 | +|-------------------------------------------------------------------------------+------------| +| currentMelConfigHash() | 010816fb | +|-------------------------------------------------------------------------------+------------| +| genesisAssertionHash() | 353325e0 | +|-------------------------------------------------------------------------------+------------| +| getAssertion(bytes32) | 88302884 | +|-------------------------------------------------------------------------------+------------| +| getAssertionCreationBlockForLogLookup(bytes32) | 13c56ca7 | +|-------------------------------------------------------------------------------+------------| +| getFirstChildCreationBlock(bytes32) | 11715585 | +|-------------------------------------------------------------------------------+------------| +| getSecondChildCreationBlock(bytes32) | 56bbc9e6 | +|-------------------------------------------------------------------------------+------------| +| getStaker(address) | a23c44b1 | +|-------------------------------------------------------------------------------+------------| +| getStakerAddress(uint64) | 6ddd3744 | +|-------------------------------------------------------------------------------+------------| +| getValidators() | b7ab4db5 | +|-------------------------------------------------------------------------------+------------| +| inbox() | fb0e722b | +|-------------------------------------------------------------------------------+------------| +| isFirstChild(bytes32) | 30836228 | +|-------------------------------------------------------------------------------+------------| +| isPending(bytes32) | e531d8c7 | +|-------------------------------------------------------------------------------+------------| +| isStaked(address) | 6177fd18 | +|-------------------------------------------------------------------------------+------------| +| isValidator(address) | facd743b | +|-------------------------------------------------------------------------------+------------| +| latestConfirmed() | 65f7f80d | +|-------------------------------------------------------------------------------+------------| +| latestStakedAssertion(address) | 2abdd230 | +|-------------------------------------------------------------------------------+------------| +| loserStakeEscrow() | f065de3f | +|-------------------------------------------------------------------------------+------------| +| melConfig(bytes32) | 13f1e3fa | +|-------------------------------------------------------------------------------+------------| +| minimumAssertionPeriod() | 45e38b64 | +|-------------------------------------------------------------------------------+------------| +| outbox() | ce11e6ab | +|-------------------------------------------------------------------------------+------------| +| paused() | 5c975abb | +|-------------------------------------------------------------------------------+------------| +| rollupDeploymentBlock() | 1b1689e9 | +|-------------------------------------------------------------------------------+------------| +| rollupEventInbox() | aa38a6e7 | +|-------------------------------------------------------------------------------+------------| +| sequencerInbox() | ee35f327 | +|-------------------------------------------------------------------------------+------------| +| stakeToken() | 51ed6a30 | +|-------------------------------------------------------------------------------+------------| +| stakerCount() | dff69787 | +|-------------------------------------------------------------------------------+------------| +| totalWithdrawableFunds() | 71ef232c | +|-------------------------------------------------------------------------------+------------| +| validateAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32) | 7e356e9b | +|-------------------------------------------------------------------------------+------------| +| validateConfig(bytes32,(bytes32,uint256,address,uint64,bytes32)) | d13666eb | +|-------------------------------------------------------------------------------+------------| +| validatorAfkBlocks() | e6b3082c | +|-------------------------------------------------------------------------------+------------| +| validatorWalletCreator() | bc45e0ae | +|-------------------------------------------------------------------------------+------------| +| validatorWhitelistDisabled() | 12ab3d3b | +|-------------------------------------------------------------------------------+------------| +| wasmModuleRoot() | 8ee1a126 | +|-------------------------------------------------------------------------------+------------| +| withdrawableFunds(address) | 2f30cabd | +|-------------------------------------------------------------------------------+------------| +| withdrawalAddress(address) | 84728cd0 | +╰-------------------------------------------------------------------------------+------------╯ diff --git a/test/signatures/RollupCreator b/test/signatures/RollupCreator index de9b35f9d..201abf38a 100644 --- a/test/signatures/RollupCreator +++ b/test/signatures/RollupCreator @@ -6,7 +6,7 @@ |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | challengeManagerTemplate() | 9c683d10 | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| createRollup(((uint64,address,uint256,bytes32,address,address,uint256,string,uint256,uint64,uint256[],(uint256,uint256,uint256,uint256),uint256,uint256,uint256,((bytes32[2],uint64[2]),uint8,bytes32),uint256,address,uint8,uint64,(uint64,uint64,uint64),uint256),address[],uint256,address,bool,uint256,address[],address,address,address)) | 2d12e32c | +| createRollup(((uint64,address,uint256,bytes32,address,address,uint256,string,uint256,uint64,uint256[],(uint256,uint256,uint256,uint256),uint256,uint256,uint256,((bytes32[4],uint64[2]),uint8,bytes32),uint256,address,uint8,uint64,(uint64,uint64,uint64),uint256),address[],uint256,address,bool,uint256,address[],address,address,address)) | a73e3440 | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | l2FactoriesDeployer() | ac0425bc | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| diff --git a/test/signatures/RollupUserLogic b/test/signatures/RollupUserLogic index 522238a66..7b36a26c0 100644 --- a/test/signatures/RollupUserLogic +++ b/test/signatures/RollupUserLogic @@ -1,125 +1,129 @@ -╭-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╮ -| Method | Identifier | -+========================================================================================================================================================================================================+ -| _stakerMap(address) | e8bd4922 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| addToDeposit(address,address,uint256) | 685f5ecc | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| amountStaked(address) | ef40a670 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| anyTrustFastConfirmer() | 55840a58 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| baseStake() | 76e7e23b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| bridge() | e78cea92 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| chainId() | 9a8a0592 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| challengeGracePeriodBlocks() | 3be680ea | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| challengeManager() | 023a96fe | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| computeAssertionHash(bytes32,((bytes32[2],uint64[2]),uint8,bytes32),bytes32) | 33635fc2 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| confirmAssertion(bytes32,bytes32,((bytes32[2],uint64[2]),uint8,bytes32),bytes32,(bytes32,uint256,address,uint64,uint64),bytes32) | 10b98a35 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| confirmPeriodBlocks() | 2e7acfa6 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| fastConfirmAssertion(bytes32,bytes32,((bytes32[2],uint64[2]),uint8,bytes32),bytes32) | 6096686d | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| fastConfirmNewAssertion(((bytes32,bytes32,(bytes32,uint256,address,uint64,uint64)),((bytes32[2],uint64[2]),uint8,bytes32),((bytes32[2],uint64[2]),uint8,bytes32)),bytes32) | 6420fb9f | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| genesisAssertionHash() | 353325e0 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getAssertion(bytes32) | 88302884 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getAssertionCreationBlockForLogLookup(bytes32) | 13c56ca7 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getFirstChildCreationBlock(bytes32) | 11715585 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getSecondChildCreationBlock(bytes32) | 56bbc9e6 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getStaker(address) | a23c44b1 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getStakerAddress(uint64) | 6ddd3744 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getValidators() | b7ab4db5 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| inbox() | fb0e722b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| initialize(address) | c4d66de8 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isFirstChild(bytes32) | 30836228 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isPending(bytes32) | e531d8c7 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isStaked(address) | 6177fd18 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isValidator(address) | facd743b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| latestConfirmed() | 65f7f80d | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| latestStakedAssertion(address) | 2abdd230 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| loserStakeEscrow() | f065de3f | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| minimumAssertionPeriod() | 45e38b64 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| newStake(uint256,address) | 68129b14 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| newStakeOnNewAssertion(uint256,((bytes32,bytes32,(bytes32,uint256,address,uint64,uint64)),((bytes32[2],uint64[2]),uint8,bytes32),((bytes32[2],uint64[2]),uint8,bytes32)),bytes32) | 7300201c | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| newStakeOnNewAssertion(uint256,((bytes32,bytes32,(bytes32,uint256,address,uint64,uint64)),((bytes32[2],uint64[2]),uint8,bytes32),((bytes32[2],uint64[2]),uint8,bytes32)),bytes32,address) | 50f32f68 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| outbox() | ce11e6ab | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| owner() | 8da5cb5b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| paused() | 5c975abb | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| proxiableUUID() | 52d1902d | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| reduceDeposit(uint256) | 1e83d30f | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| removeWhitelistAfterFork() | c2c2e68e | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| removeWhitelistAfterValidatorAfk() | 18baaab9 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| returnOldDeposit() | 57ef4ab9 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| returnOldDepositFor(address) | 588c7a16 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| rollupDeploymentBlock() | 1b1689e9 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| rollupEventInbox() | aa38a6e7 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| sequencerInbox() | ee35f327 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| stakeOnNewAssertion(((bytes32,bytes32,(bytes32,uint256,address,uint64,uint64)),((bytes32[2],uint64[2]),uint8,bytes32),((bytes32[2],uint64[2]),uint8,bytes32)),bytes32) | 3b86de19 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| stakeToken() | 51ed6a30 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| stakerCount() | dff69787 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| totalWithdrawableFunds() | 71ef232c | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validateAssertionHash(bytes32,((bytes32[2],uint64[2]),uint8,bytes32),bytes32,bytes32) | e51019a6 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validateConfig(bytes32,(bytes32,uint256,address,uint64,uint64)) | 04972af9 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validatorAfkBlocks() | e6b3082c | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validatorWalletCreator() | bc45e0ae | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validatorWhitelistDisabled() | 12ab3d3b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| wasmModuleRoot() | 8ee1a126 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| withdrawStakerFunds() | 61373919 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| withdrawableFunds(address) | 2f30cabd | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| withdrawalAddress(address) | 84728cd0 | -╰-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╯ +╭-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╮ +| Method | Identifier | ++====================================================================================================================================================================================================================================================================================================================+ +| _stakerMap(address) | e8bd4922 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| addToDeposit(address,address,uint256) | 685f5ecc | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| amountStaked(address) | ef40a670 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| anyTrustFastConfirmer() | 55840a58 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| baseStake() | 76e7e23b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| bridge() | e78cea92 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| chainId() | 9a8a0592 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| challengeGracePeriodBlocks() | 3be680ea | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| challengeManager() | 023a96fe | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| computeAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32)) | e05b0a7b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| confirmAssertion(bytes32,bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32,(bytes32,uint256,address,uint64,bytes32)) | 4c10ee51 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| confirmPeriodBlocks() | 2e7acfa6 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| currentMelConfigHash() | 010816fb | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| fastConfirmAssertion(bytes32,bytes32,((bytes32[4],uint64[2]),uint8,bytes32)) | abc4dd38 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| fastConfirmNewAssertion(((bytes32,bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 7f34fd33 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| genesisAssertionHash() | 353325e0 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getAssertion(bytes32) | 88302884 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getAssertionCreationBlockForLogLookup(bytes32) | 13c56ca7 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getFirstChildCreationBlock(bytes32) | 11715585 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getSecondChildCreationBlock(bytes32) | 56bbc9e6 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getStaker(address) | a23c44b1 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getStakerAddress(uint64) | 6ddd3744 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getValidators() | b7ab4db5 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| inbox() | fb0e722b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| initialize(address) | c4d66de8 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isFirstChild(bytes32) | 30836228 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isPending(bytes32) | e531d8c7 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isStaked(address) | 6177fd18 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isValidator(address) | facd743b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| latestConfirmed() | 65f7f80d | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| latestStakedAssertion(address) | 2abdd230 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| loserStakeEscrow() | f065de3f | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| melConfig(bytes32) | 13f1e3fa | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| minimumAssertionPeriod() | 45e38b64 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| newStake(uint256,address) | 68129b14 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| newStakeOnNewAssertion(uint256,((bytes32,bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 7f62c2af | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| newStakeOnNewAssertion(uint256,((bytes32,bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32,address) | efa4cb29 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| outbox() | ce11e6ab | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| owner() | 8da5cb5b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| paused() | 5c975abb | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| proxiableUUID() | 52d1902d | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| reduceDeposit(uint256) | 1e83d30f | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| removeWhitelistAfterFork() | c2c2e68e | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| removeWhitelistAfterValidatorAfk() | 18baaab9 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| returnOldDeposit() | 57ef4ab9 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| returnOldDepositFor(address) | 588c7a16 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| rollupDeploymentBlock() | 1b1689e9 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| rollupEventInbox() | aa38a6e7 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| sequencerInbox() | ee35f327 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| stakeOnNewAssertion(((bytes32,bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 550dc268 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| stakeToken() | 51ed6a30 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| stakerCount() | dff69787 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| totalWithdrawableFunds() | 71ef232c | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validateAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32) | 7e356e9b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validateConfig(bytes32,(bytes32,uint256,address,uint64,bytes32)) | d13666eb | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validatorAfkBlocks() | e6b3082c | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validatorWalletCreator() | bc45e0ae | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validatorWhitelistDisabled() | 12ab3d3b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| wasmModuleRoot() | 8ee1a126 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| withdrawStakerFunds() | 61373919 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| withdrawableFunds(address) | 2f30cabd | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| withdrawalAddress(address) | 84728cd0 | +╰-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╯ diff --git a/test/storage/RollupAdminLogic b/test/storage/RollupAdminLogic index 8f53588e8..03cd85e86 100644 --- a/test/storage/RollupAdminLogic +++ b/test/storage/RollupAdminLogic @@ -1,67 +1,71 @@ -╭--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------╮ -| Name | Type | Slot | Offset | Bytes | Contract | -+===========================================================================================================================================================+ -| _initialized | uint8 | 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 | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| chainId | uint256 | 101 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| confirmPeriodBlocks | uint64 | 102 | 0 | 8 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| validatorAfkBlocks | uint64 | 102 | 8 | 8 | 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 | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| challengeManager | contract IEdgeChallengeManager | 105 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| challengeGracePeriodBlocks | uint64 | 105 | 20 | 8 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| inbox | contract IInboxBase | 106 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| bridge | contract IBridge | 107 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| outbox | contract IOutbox | 108 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| rollupEventInbox | contract IRollupEventInbox | 109 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| validatorWalletCreator | address | 110 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| loserStakeEscrow | address | 111 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| stakeToken | address | 112 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| minimumAssertionPeriod | uint256 | 113 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| validators | struct EnumerableSetUpgradeable.AddressSet | 114 | 0 | 64 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| _latestConfirmed | bytes32 | 116 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| _assertions | mapping(bytes32 => struct AssertionNode) | 117 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| _stakerList | address[] | 118 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| _stakerMap | mapping(address => struct IRollupCore.Staker) | 119 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| _withdrawableFunds | mapping(address => uint256) | 120 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| totalWithdrawableFunds | uint256 | 121 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| rollupDeploymentBlock | uint256 | 122 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| validatorWhitelistDisabled | bool | 123 | 0 | 1 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| anyTrustFastConfirmer | address | 123 | 1 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------| -| _assertionCreatedAtArbSysBlock | mapping(bytes32 => uint256) | 124 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | -╰--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------------------╯ +╭--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------╮ +| Name | Type | Slot | Offset | Bytes | Contract | ++==============================================================================================================================================================+ +| _initialized | uint8 | 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 | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| chainId | uint256 | 101 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| confirmPeriodBlocks | uint64 | 102 | 0 | 8 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| validatorAfkBlocks | uint64 | 102 | 8 | 8 | 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 | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| challengeManager | contract IEdgeChallengeManager | 105 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| challengeGracePeriodBlocks | uint64 | 105 | 20 | 8 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| inbox | contract IInboxBase | 106 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| bridge | contract IBridge | 107 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| outbox | contract IOutbox | 108 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| rollupEventInbox | contract IRollupEventInbox | 109 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| validatorWalletCreator | address | 110 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| loserStakeEscrow | address | 111 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| stakeToken | address | 112 | 0 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| minimumAssertionPeriod | uint256 | 113 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| validators | struct EnumerableSetUpgradeable.AddressSet | 114 | 0 | 64 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| _latestConfirmed | bytes32 | 116 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| _assertions | mapping(bytes32 => struct AssertionNode) | 117 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| _stakerList | address[] | 118 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| _stakerMap | mapping(address => struct IRollupCore.Staker) | 119 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| _withdrawableFunds | mapping(address => uint256) | 120 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| totalWithdrawableFunds | uint256 | 121 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| rollupDeploymentBlock | uint256 | 122 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| validatorWhitelistDisabled | bool | 123 | 0 | 1 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| anyTrustFastConfirmer | address | 123 | 1 | 20 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| _assertionCreatedAtArbSysBlock | mapping(bytes32 => uint256) | 124 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| currentMelConfigHash | bytes32 | 125 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------| +| melConfig | mapping(bytes32 => struct IRollupCore.MELConfig) | 126 | 0 | 32 | src/rollup/RollupAdminLogic.sol:RollupAdminLogic | +╰--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------------------╯ diff --git a/test/storage/RollupCore b/test/storage/RollupCore index e493175c1..848153a39 100644 --- a/test/storage/RollupCore +++ b/test/storage/RollupCore @@ -1,67 +1,71 @@ -╭--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------╮ -| Name | Type | Slot | Offset | Bytes | Contract | -+===============================================================================================================================================+ -| _initialized | uint8 | 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 | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| chainId | uint256 | 101 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| confirmPeriodBlocks | uint64 | 102 | 0 | 8 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| validatorAfkBlocks | uint64 | 102 | 8 | 8 | 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 | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| challengeManager | contract IEdgeChallengeManager | 105 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| challengeGracePeriodBlocks | uint64 | 105 | 20 | 8 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| inbox | contract IInboxBase | 106 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| bridge | contract IBridge | 107 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| outbox | contract IOutbox | 108 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| rollupEventInbox | contract IRollupEventInbox | 109 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| validatorWalletCreator | address | 110 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| loserStakeEscrow | address | 111 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| stakeToken | address | 112 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| minimumAssertionPeriod | uint256 | 113 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| validators | struct EnumerableSetUpgradeable.AddressSet | 114 | 0 | 64 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| _latestConfirmed | bytes32 | 116 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| _assertions | mapping(bytes32 => struct AssertionNode) | 117 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| _stakerList | address[] | 118 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| _stakerMap | mapping(address => struct IRollupCore.Staker) | 119 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| _withdrawableFunds | mapping(address => uint256) | 120 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| totalWithdrawableFunds | uint256 | 121 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| rollupDeploymentBlock | uint256 | 122 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| validatorWhitelistDisabled | bool | 123 | 0 | 1 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| anyTrustFastConfirmer | address | 123 | 1 | 20 | src/rollup/RollupCore.sol:RollupCore | -|--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------| -| _assertionCreatedAtArbSysBlock | mapping(bytes32 => uint256) | 124 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | -╰--------------------------------+-----------------------------------------------+------+--------+-------+--------------------------------------╯ +╭--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------╮ +| Name | Type | Slot | Offset | Bytes | Contract | ++==================================================================================================================================================+ +| _initialized | uint8 | 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 | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| chainId | uint256 | 101 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| confirmPeriodBlocks | uint64 | 102 | 0 | 8 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| validatorAfkBlocks | uint64 | 102 | 8 | 8 | 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 | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| challengeManager | contract IEdgeChallengeManager | 105 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| challengeGracePeriodBlocks | uint64 | 105 | 20 | 8 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| inbox | contract IInboxBase | 106 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| bridge | contract IBridge | 107 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| outbox | contract IOutbox | 108 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| rollupEventInbox | contract IRollupEventInbox | 109 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| validatorWalletCreator | address | 110 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| loserStakeEscrow | address | 111 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| stakeToken | address | 112 | 0 | 20 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| minimumAssertionPeriod | uint256 | 113 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| validators | struct EnumerableSetUpgradeable.AddressSet | 114 | 0 | 64 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| _latestConfirmed | bytes32 | 116 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| _assertions | mapping(bytes32 => struct AssertionNode) | 117 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| _stakerList | address[] | 118 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| _stakerMap | mapping(address => struct IRollupCore.Staker) | 119 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| _withdrawableFunds | mapping(address => uint256) | 120 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| totalWithdrawableFunds | uint256 | 121 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| rollupDeploymentBlock | uint256 | 122 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| validatorWhitelistDisabled | bool | 123 | 0 | 1 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| anyTrustFastConfirmer | address | 123 | 1 | 20 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| _assertionCreatedAtArbSysBlock | mapping(bytes32 => uint256) | 124 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| currentMelConfigHash | bytes32 | 125 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +|--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------| +| melConfig | mapping(bytes32 => struct IRollupCore.MELConfig) | 126 | 0 | 32 | src/rollup/RollupCore.sol:RollupCore | +╰--------------------------------+--------------------------------------------------+------+--------+-------+--------------------------------------╯ diff --git a/test/storage/RollupUserLogic b/test/storage/RollupUserLogic index b2edbafb4..d43220420 100644 --- a/test/storage/RollupUserLogic +++ b/test/storage/RollupUserLogic @@ -1,67 +1,71 @@ -╭--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------╮ -| Name | Type | Slot | Offset | Bytes | Contract | -+=========================================================================================================================================================+ -| _initialized | uint8 | 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 | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| chainId | uint256 | 101 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| confirmPeriodBlocks | uint64 | 102 | 0 | 8 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| validatorAfkBlocks | uint64 | 102 | 8 | 8 | 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 | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| challengeManager | contract IEdgeChallengeManager | 105 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| challengeGracePeriodBlocks | uint64 | 105 | 20 | 8 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| inbox | contract IInboxBase | 106 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| bridge | contract IBridge | 107 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| outbox | contract IOutbox | 108 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| rollupEventInbox | contract IRollupEventInbox | 109 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| validatorWalletCreator | address | 110 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| loserStakeEscrow | address | 111 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| stakeToken | address | 112 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| minimumAssertionPeriod | uint256 | 113 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| validators | struct EnumerableSetUpgradeable.AddressSet | 114 | 0 | 64 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| _latestConfirmed | bytes32 | 116 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| _assertions | mapping(bytes32 => struct AssertionNode) | 117 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| _stakerList | address[] | 118 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| _stakerMap | mapping(address => struct IRollupCore.Staker) | 119 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| _withdrawableFunds | mapping(address => uint256) | 120 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| totalWithdrawableFunds | uint256 | 121 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| rollupDeploymentBlock | uint256 | 122 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| validatorWhitelistDisabled | bool | 123 | 0 | 1 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| anyTrustFastConfirmer | address | 123 | 1 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -|--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------| -| _assertionCreatedAtArbSysBlock | mapping(bytes32 => uint256) | 124 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | -╰--------------------------------+-----------------------------------------------+------+--------+-------+------------------------------------------------╯ +╭--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------╮ +| Name | Type | Slot | Offset | Bytes | Contract | ++============================================================================================================================================================+ +| _initialized | uint8 | 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 | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| chainId | uint256 | 101 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| confirmPeriodBlocks | uint64 | 102 | 0 | 8 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| validatorAfkBlocks | uint64 | 102 | 8 | 8 | 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 | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| challengeManager | contract IEdgeChallengeManager | 105 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| challengeGracePeriodBlocks | uint64 | 105 | 20 | 8 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| inbox | contract IInboxBase | 106 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| bridge | contract IBridge | 107 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| outbox | contract IOutbox | 108 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| rollupEventInbox | contract IRollupEventInbox | 109 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| validatorWalletCreator | address | 110 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| loserStakeEscrow | address | 111 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| stakeToken | address | 112 | 0 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| minimumAssertionPeriod | uint256 | 113 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| validators | struct EnumerableSetUpgradeable.AddressSet | 114 | 0 | 64 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| _latestConfirmed | bytes32 | 116 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| _assertions | mapping(bytes32 => struct AssertionNode) | 117 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| _stakerList | address[] | 118 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| _stakerMap | mapping(address => struct IRollupCore.Staker) | 119 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| _withdrawableFunds | mapping(address => uint256) | 120 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| totalWithdrawableFunds | uint256 | 121 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| rollupDeploymentBlock | uint256 | 122 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| validatorWhitelistDisabled | bool | 123 | 0 | 1 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| anyTrustFastConfirmer | address | 123 | 1 | 20 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| _assertionCreatedAtArbSysBlock | mapping(bytes32 => uint256) | 124 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| currentMelConfigHash | bytes32 | 125 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +|--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------| +| melConfig | mapping(bytes32 => struct IRollupCore.MELConfig) | 126 | 0 | 32 | src/rollup/RollupUserLogic.sol:RollupUserLogic | +╰--------------------------------+--------------------------------------------------+------+--------+-------+------------------------------------------------╯ From 672435ba779e2cc25efb866897d00efb95b574fb Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Tue, 2 Jun 2026 13:40:32 +0100 Subject: [PATCH 09/17] Remove sequencerBatchAcc from BeforeStateData and fix tests --- scripts/config.example.ts | 2 +- scripts/rollupCreation.ts | 2 +- src/rollup/Assertion.sol | 2 - src/rollup/RollupAdminLogic.sol | 2 +- test/foundry/Rollup.t.sol | 981 +++++++++++++++---------------- test/foundry/RollupCreator.t.sol | 2 +- 6 files changed, 479 insertions(+), 512 deletions(-) diff --git a/scripts/config.example.ts b/scripts/config.example.ts index c0e4534bf..58384ad7d 100644 --- a/scripts/config.example.ts +++ b/scripts/config.example.ts @@ -17,7 +17,7 @@ const chainId = ethers.BigNumber.from('13331370') const genesisAssertionState: AssertionStateStruct = { globalState: { - bytes32Vals: [ethers.constants.HashZero, ethers.constants.HashZero], + bytes32Vals: [ethers.constants.HashZero, ethers.constants.HashZero, ethers.constants.HashZero, ethers.constants.HashZero], u64Vals: [ethers.BigNumber.from('0'), ethers.BigNumber.from('0')], }, machineStatus: 1, // FINISHED diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index 1f2faa460..1869a4f5d 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -315,7 +315,7 @@ async function _getDevRollupConfig( const genesisAssertionState: AssertionStateStruct = { globalState: { - bytes32Vals: [ethers.constants.HashZero, ethers.constants.HashZero], + bytes32Vals: [ethers.constants.HashZero, ethers.constants.HashZero, ethers.constants.HashZero, ethers.constants.HashZero], u64Vals: [ethers.BigNumber.from('0'), ethers.BigNumber.from('0')], }, machineStatus: 1, // FINISHED diff --git a/src/rollup/Assertion.sol b/src/rollup/Assertion.sol index 9d9553d35..b41b944b2 100644 --- a/src/rollup/Assertion.sol +++ b/src/rollup/Assertion.sol @@ -40,8 +40,6 @@ struct AssertionNode { struct BeforeStateData { // The assertion hash of the prev of the beforeState(prev) bytes32 prevPrevAssertionHash; - // The sequencer inbox accumulator asserted by the beforeState(prev) - bytes32 sequencerBatchAcc; // below are the components of config hash ConfigData configData; } diff --git a/src/rollup/RollupAdminLogic.sol b/src/rollup/RollupAdminLogic.sol index 2cf1144d5..be707ebcb 100644 --- a/src/rollup/RollupAdminLogic.sol +++ b/src/rollup/RollupAdminLogic.sol @@ -74,7 +74,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl afterStateHash: config.genesisAssertionState.hash() }); - bytes32 nextParentChainBlockHash = blockhash(block.number - 1); + bytes32 nextParentChainBlockHash = blockhash(block.number); AssertionNode memory initialAssertion = AssertionNodeLib.createAssertion( true, RollupLib.configHash({ diff --git a/test/foundry/Rollup.t.sol b/test/foundry/Rollup.t.sol index 12c1a4533..6532c8039 100644 --- a/test/foundry/Rollup.t.sol +++ b/test/foundry/Rollup.t.sol @@ -29,6 +29,20 @@ import "@openzeppelin/contracts-upgradeable/utils/Create2Upgradeable.sol"; contract RollupTest is Test { using GlobalStateLib for GlobalState; using AssertionStateLib for AssertionState; + using MELStateLib for MELState; + + struct SuccessCreateChallengeData { + AssertionState beforeState; + bytes32 beforeStateParentChainBlockHash; + AssertionState afterState1; + AssertionState afterState2; + MELState afterMELState; + bytes32 afterStateParentChainBlockHash; + bytes32 edge1Id; + bytes32 assertionHash1; + bytes32 assertionHash2; + bytes32 nextParentChainBlockHash; + } address constant owner = address(1337); address constant sequencer = address(7331); @@ -49,8 +63,11 @@ contract RollupTest is Test { uint256 constant MAX_DATA_SIZE = 117964; uint64 constant CHALLENGE_GRACE_PERIOD_BLOCKS = 10; + uint64 constant INITIAL_MSG_COUNT = 1; bytes32 constant FIRST_ASSERTION_BLOCKHASH = keccak256("FIRST_ASSERTION_BLOCKHASH"); bytes32 constant FIRST_ASSERTION_SENDROOT = keccak256("FIRST_ASSERTION_SENDROOT"); + bytes32 constant FIRST_ASSERTION_PARENT_CHAIN_BLOCKHASH = + keccak256("FIRST_ASSERTION_PARENT_CHAIN_BLOCKHASH"); uint256 constant LAYERZERO_BLOCKEDGE_HEIGHT = 2 ** 5; @@ -68,12 +85,12 @@ contract RollupTest is Test { GlobalState emptyGlobalState; AssertionState emptyAssertionState = AssertionState(emptyGlobalState, MachineStatus.FINISHED, bytes32(0)); - bytes32 genesisHash = RollupLib.assertionHash({ - parentAssertionHash: bytes32(0), - afterState: emptyAssertionState, - inboxAcc: bytes32(0) - }); + bytes32 genesisHash = + RollupLib.assertionHash({parentAssertionHash: bytes32(0), afterState: emptyAssertionState}); AssertionState firstState; + MELState firstMELState; + uint64 firstAssertionParentChainBlockNumber; + bytes32 firstAssertionParentChainBlockHash; event RollupCreated( address indexed rollupAddress, @@ -107,6 +124,10 @@ contract RollupTest is Test { outbox: new ERC20Outbox() }); + // need to have these in storage due to stack limit + bytes32[] randomStates1; + bytes32[] randomStates2; + function setUp() public { OneStepProver0 oneStepProver = new OneStepProver0(); OneStepProverMemory oneStepProverMemory = new OneStepProverMemory(); @@ -134,11 +155,8 @@ contract RollupTest is Test { deployHelper ); - AssertionState memory emptyState = AssertionState( - GlobalState([bytes32(0), bytes32(0)], [uint64(0), uint64(0)]), - MachineStatus.FINISHED, - bytes32(0) - ); + // Genesis assertion state, confirmed on rollup creation + AssertionState memory genesisAssertionState = emptyAssertionState; token = new TestWETH9("Test", "TEST"); IWETH9(address(token)).deposit{value: 10 ether}(); @@ -166,7 +184,7 @@ contract RollupTest is Test { stakeToken: address(token), wasmModuleRoot: WASM_MODULE_ROOT, loserStakeEscrow: loserStakeEscrow, - genesisAssertionState: emptyState, + genesisAssertionState: genesisAssertionState, genesisInboxCount: 0, miniStakeValues: miniStakeValues, layerZeroBlockEdgeHeight: 2 ** 5, @@ -222,6 +240,11 @@ contract RollupTest is Test { assertEq(userRollup.sequencerInbox().maxDataSize(), MAX_DATA_SIZE); assertFalse(userRollup.validatorWhitelistDisabled()); + // store the parent chain block information to be used in the next assertion + // (must be consistent with the the implementation of `initialize` in RollupAdminLogic) + firstAssertionParentChainBlockNumber = uint64(block.number); + firstAssertionParentChainBlockHash = blockhash(block.number); + // check upgrade executor owns proxyAdmin address upgradeExecutorExpectedAddress = computeCreateAddress(address(rollupCreator), 4); upgradeExecutorAddr = userRollup.owner(); @@ -240,11 +263,8 @@ contract RollupTest is Test { adminRollup.sequencerInbox().setIsBatchPoster(sequencer, true); vm.stopPrank(); - firstState.machineStatus = MachineStatus.FINISHED; - firstState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // blockhash - firstState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - firstState.globalState.u64Vals[0] = 1; // inbox count - firstState.globalState.u64Vals[1] = 0; // pos in msg + // First assertion to create after the genesis assertion + (firstState, firstMELState) = _mockAssertionState(); // TODO: determine if challengeManager should be permissionless at the stage token.approve(address(challengeManager), type(uint256).max); @@ -275,20 +295,50 @@ contract RollupTest is Test { vm.roll(block.number + 75); } - function _createNewBatch() internal returns (uint256) { - uint256 count = userRollup.bridge().sequencerMessageCount(); - vm.startPrank(sequencer); - userRollup.sequencerInbox().addSequencerL2Batch({ - sequenceNumber: count, - data: "", - afterDelayedMessagesRead: 1, - gasRefunder: IGasRefunder(address(0)), - prevMessageCount: 0, - newMessageCount: 0 - }); - vm.stopPrank(); - assertEq(userRollup.bridge().sequencerMessageCount(), ++count); - return count; + function _mockAssertionState() internal view returns (AssertionState memory, MELState memory) { + MELState memory melState; + melState.version = 0; + melState.parentChainId = uint64(block.chainid); + melState.parentChainBlockNumber = firstAssertionParentChainBlockNumber; + melState.batchPostingTargetAddress = address(0); + melState.delayedMessagePostingTargetAddress = address(0); + melState.parentChainBlockHash = firstAssertionParentChainBlockHash; + melState.parentChainPreviousBlockHash = bytes32(0); + melState.batchCount = 1; + melState.msgCount = INITIAL_MSG_COUNT; + melState.localMsgAccumulator = bytes32(0); + melState.delayedMessagesRead = INITIAL_MSG_COUNT; + melState.delayedMessagesSeen = INITIAL_MSG_COUNT; + melState.delayedMessageInboxAcc = bytes32(0); + melState.delayedMessageOutboxAcc = bytes32(0); + + AssertionState memory assertionState; + assertionState.machineStatus = MachineStatus.FINISHED; + assertionState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // Blockhash + assertionState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // Sendroot + assertionState.globalState.bytes32Vals[2] = melState.hash(); // MELState hash + assertionState.globalState.bytes32Vals[3] = bytes32(0); // MEL NextMsgHash + assertionState.globalState.u64Vals[0] = INITIAL_MSG_COUNT; // MsgCount + assertionState.globalState.u64Vals[1] = INITIAL_MSG_COUNT; // ExecutedMsgCount + + return (assertionState, melState); + } + + function _fillStatesInBetween( + bytes32 start, + bytes32 end, + uint256 totalCount + ) internal returns (bytes32[] memory) { + bytes32[] memory innerStates = rand.hashes(totalCount - 2); + + bytes32[] memory states = new bytes32[](totalCount); + states[0] = start; + for (uint256 i = 0; i < innerStates.length; i++) { + states[i + 1] = innerStates[i]; + } + states[totalCount - 1] = end; + + return states; } function testGenesisAssertionConfirmed() external { @@ -302,31 +352,6 @@ contract RollupTest is Test { adminRollup.pause(); } - function testConfirmAssertionWhenPaused() public { - (bytes32 assertionHash, AssertionState memory state, uint64 inboxcount) = - testSuccessCreateAssertion(); - vm.roll(userRollup.getAssertion(genesisHash).firstChildBlock + CONFIRM_PERIOD_BLOCKS + 1); - bytes32 inboxAccs = userRollup.bridge().sequencerInboxAccs(0); - vm.prank(upgradeExecutorAddr); - adminRollup.pause(); - vm.prank(validator1); - vm.expectRevert("Pausable: paused"); - userRollup.confirmAssertion( - assertionHash, - genesisHash, - firstState, - bytes32(0), - ConfigData({ - wasmModuleRoot: WASM_MODULE_ROOT, - requiredStake: BASE_STAKE, - challengeManager: address(challengeManager), - confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: firstState.globalState.u64Vals[0] - }), - inboxAccs - ); - } - function testSuccessPauseResume() public { testSuccessPause(); vm.prank(upgradeExecutorAddr); @@ -353,67 +378,65 @@ contract RollupTest is Test { userRollup.removeWhitelistAfterFork(); } - function testSuccessCreateAssertion() public returns (bytes32, AssertionState memory, uint64) { - uint64 inboxcount = uint64(_createNewBatch()); + /** + * Creates a new assertion on top of the genesis assertion + * + * Should return: + * - the expected assertion hash + * - the assertion state + * - the MEL state + * - the target parent chain block hash to be used in the next assertion + * + * @dev To be used after `setUp()` + * @dev Test used in multiple other tests + */ + function testSuccessCreateAssertion() + public + returns (bytes32, AssertionState memory, MELState memory, bytes32) + { AssertionState memory beforeState; beforeState.machineStatus = MachineStatus.FINISHED; - AssertionState memory afterState; - afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // blockhash - afterState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - afterState.globalState.u64Vals[0] = 1; // inbox count - afterState.globalState.u64Vals[1] = 0; // pos in msg + AssertionState memory afterState = firstState; + MELState memory afterMELState = firstMELState; - bytes32 expectedAssertionHash = RollupLib.assertionHash({ - parentAssertionHash: genesisHash, - afterState: afterState, - inboxAcc: userRollup.bridge().sequencerInboxAccs(0) - }); + bytes32 expectedAssertionHash = + RollupLib.assertionHash({parentAssertionHash: genesisHash, afterState: afterState}); vm.prank(validator1); userRollup.newStakeOnNewAssertion({ tokenAmount: BASE_STAKE, assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), prevPrevAssertionHash: bytes32(0), configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState.globalState.u64Vals[0] + nextParentChainBlockHash: firstAssertionParentChainBlockHash }) }), beforeState: beforeState, - afterState: afterState + afterState: afterState, + afterMELState: afterMELState }), expectedAssertionHash: expectedAssertionHash, _withdrawalAddress: validator1Withdrawal }); - return (expectedAssertionHash, afterState, inboxcount); + bytes32 nextParentChainBlockHash = blockhash(block.number - 1); + + return (expectedAssertionHash, afterState, afterMELState, nextParentChainBlockHash); } - function testSuccessCreateAssertionUsingAddToDeposit() - public - returns (bytes32, AssertionState memory, uint64) - { - uint64 inboxcount = uint64(_createNewBatch()); + function testSuccessCreateAssertionUsingAddToDeposit() public { AssertionState memory beforeState; beforeState.machineStatus = MachineStatus.FINISHED; - AssertionState memory afterState; - afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // blockhash - afterState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - afterState.globalState.u64Vals[0] = 1; // inbox count - afterState.globalState.u64Vals[1] = 0; // pos in msg + AssertionState memory afterState = firstState; + MELState memory afterMELState = firstMELState; - bytes32 expectedAssertionHash = RollupLib.assertionHash({ - parentAssertionHash: genesisHash, - afterState: afterState, - inboxAcc: userRollup.bridge().sequencerInboxAccs(0) - }); + bytes32 expectedAssertionHash = + RollupLib.assertionHash({parentAssertionHash: genesisHash, afterState: afterState}); vm.prank(validator1); userRollup.newStake(0, validator1Withdrawal); @@ -430,23 +453,21 @@ contract RollupTest is Test { userRollup.stakeOnNewAssertion({ assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), prevPrevAssertionHash: bytes32(0), configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState.globalState.u64Vals[0] + nextParentChainBlockHash: firstAssertionParentChainBlockHash }) }), beforeState: beforeState, - afterState: afterState + afterState: afterState, + afterMELState: afterMELState }), expectedAssertionHash: expectedAssertionHash }); - - return (expectedAssertionHash, afterState, inboxcount); } function testPartialDepositCanWithdraw() public { @@ -484,21 +505,13 @@ contract RollupTest is Test { } function testPartialDepositCannotMakeAssertion() public { - uint64 inboxcount = uint64(_createNewBatch()); AssertionState memory beforeState; beforeState.machineStatus = MachineStatus.FINISHED; - AssertionState memory afterState; - afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // blockhash - afterState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - afterState.globalState.u64Vals[0] = 1; // inbox count - afterState.globalState.u64Vals[1] = 0; // pos in msg + AssertionState memory afterState = firstState; + MELState memory afterMELState = firstMELState; - bytes32 expectedAssertionHash = RollupLib.assertionHash({ - parentAssertionHash: genesisHash, - afterState: afterState, - inboxAcc: userRollup.bridge().sequencerInboxAccs(0) - }); + bytes32 expectedAssertionHash = + RollupLib.assertionHash({parentAssertionHash: genesisHash, afterState: afterState}); vm.prank(validator1); userRollup.newStake(BASE_STAKE - 1, validator1Withdrawal); @@ -508,18 +521,18 @@ contract RollupTest is Test { userRollup.stakeOnNewAssertion({ assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), prevPrevAssertionHash: bytes32(0), configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState.globalState.u64Vals[0] + nextParentChainBlockHash: blockhash(block.number - 1) }) }), beforeState: beforeState, - afterState: afterState + afterState: afterState, + afterMELState: afterMELState }), expectedAssertionHash: expectedAssertionHash }); @@ -532,78 +545,62 @@ contract RollupTest is Test { assertEq(userRollup.getStakerAddress(userRollup.getStaker(validator1).index), validator1); } - function testSuccessCreateErroredAssertions() - public - returns (bytes32, AssertionState memory, uint64) - { - uint64 inboxcount = uint64(_createNewBatch()); + function testSuccessCreateErroredAssertions() public { AssertionState memory beforeState; beforeState.machineStatus = MachineStatus.FINISHED; - AssertionState memory afterState; + AssertionState memory afterState = firstState; afterState.machineStatus = MachineStatus.ERRORED; - afterState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // blockhash - afterState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - afterState.globalState.u64Vals[0] = 1; // inbox count - afterState.globalState.u64Vals[1] = 0; // pos in msg + MELState memory afterMELState = firstMELState; - bytes32 expectedAssertionHash = RollupLib.assertionHash({ - parentAssertionHash: genesisHash, - afterState: afterState, - inboxAcc: userRollup.bridge().sequencerInboxAccs(0) - }); + bytes32 expectedAssertionHash = + RollupLib.assertionHash({parentAssertionHash: genesisHash, afterState: afterState}); vm.prank(validator1); userRollup.newStakeOnNewAssertion({ tokenAmount: BASE_STAKE, assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), prevPrevAssertionHash: bytes32(0), configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState.globalState.u64Vals[0] + nextParentChainBlockHash: firstAssertionParentChainBlockHash }) }), beforeState: beforeState, - afterState: afterState + afterState: afterState, + afterMELState: afterMELState }), expectedAssertionHash: expectedAssertionHash, _withdrawalAddress: validator1Withdrawal }); - - return (expectedAssertionHash, afterState, inboxcount); } function testRevertIdenticalAssertions() public { AssertionState memory beforeState; beforeState.machineStatus = MachineStatus.FINISHED; - AssertionState memory afterState; - afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // blockhash - afterState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - afterState.globalState.u64Vals[0] = 1; // inbox count - afterState.globalState.u64Vals[1] = 0; // pos in msg + AssertionState memory afterState = firstState; + MELState memory afterMELState = firstMELState; vm.prank(validator1); userRollup.newStakeOnNewAssertion({ tokenAmount: BASE_STAKE, assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), prevPrevAssertionHash: bytes32(0), configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState.globalState.u64Vals[0] + nextParentChainBlockHash: firstAssertionParentChainBlockHash }) }), beforeState: beforeState, - afterState: afterState + afterState: afterState, + afterMELState: afterMELState }), expectedAssertionHash: bytes32(0), _withdrawalAddress: validator1Withdrawal @@ -615,18 +612,18 @@ contract RollupTest is Test { tokenAmount: BASE_STAKE, assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), prevPrevAssertionHash: bytes32(0), configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState.globalState.u64Vals[0] + nextParentChainBlockHash: firstAssertionParentChainBlockHash }) }), beforeState: beforeState, - afterState: afterState + afterState: afterState, + afterMELState: afterMELState }), expectedAssertionHash: bytes32(0), _withdrawalAddress: validator2Withdrawal @@ -634,56 +631,23 @@ contract RollupTest is Test { } function testRevertInvalidPrev() public { - uint64 inboxcount = uint64(_createNewBatch()); - AssertionState memory beforeState; - beforeState.machineStatus = MachineStatus.FINISHED; - AssertionState memory afterState; - afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // blockhash - afterState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - afterState.globalState.u64Vals[0] = 1; // inbox count - afterState.globalState.u64Vals[1] = 0; // pos in msg - - bytes32 expectedAssertionHash = RollupLib.assertionHash({ - parentAssertionHash: genesisHash, - afterState: afterState, - inboxAcc: userRollup.bridge().sequencerInboxAccs(0) - }); + (bytes32 assertionHash, AssertionState memory beforeState, MELState memory beforeMELState,) + = testSuccessCreateAssertion(); - vm.prank(validator1); - userRollup.newStakeOnNewAssertion({ - tokenAmount: BASE_STAKE, - assertion: AssertionInputs({ - beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), - prevPrevAssertionHash: bytes32(0), - configData: ConfigData({ - wasmModuleRoot: WASM_MODULE_ROOT, - requiredStake: BASE_STAKE, - challengeManager: address(challengeManager), - confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState.globalState.u64Vals[0] - }) - }), - beforeState: beforeState, - afterState: afterState - }), - expectedAssertionHash: expectedAssertionHash, - _withdrawalAddress: validator1Withdrawal - }); + // Add 1 more message + MELState memory afterMELState = beforeMELState; + afterMELState.msgCount += 1; - AssertionState memory afterState2; - afterState2.machineStatus = MachineStatus.FINISHED; - afterState2.globalState.u64Vals[0] = inboxcount; - bytes32 expectedAssertionHash2 = RollupLib.assertionHash({ - parentAssertionHash: expectedAssertionHash, - afterState: afterState2, - inboxAcc: userRollup.bridge().sequencerInboxAccs(1) // 1 because we moved the position within message - }); - bytes32 prevInboxAcc = userRollup.bridge().sequencerInboxAccs(0); + AssertionState memory afterState; + afterState.machineStatus = MachineStatus.FINISHED; + afterState.globalState.u64Vals[0] += 1; // increase MsgCount + afterState.globalState.u64Vals[1] += 1; // increase ExecutedMsgCount + afterState.globalState.bytes32Vals[2] = afterMELState.hash(); // MEL State hash + bytes32 expectedAssertionHash = + RollupLib.assertionHash({parentAssertionHash: assertionHash, afterState: afterState}); - // set the wrong before state - afterState.globalState.bytes32Vals[0] = FIRST_ASSERTION_SENDROOT; + // set the wrong blockhash on beforeState + beforeState.globalState.bytes32Vals[0] = FIRST_ASSERTION_SENDROOT; vm.roll(block.number + 75); vm.prank(validator1); @@ -691,64 +655,64 @@ contract RollupTest is Test { userRollup.stakeOnNewAssertion({ assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: prevInboxAcc, prevPrevAssertionHash: genesisHash, configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState2.globalState.u64Vals[0] + nextParentChainBlockHash: firstAssertionParentChainBlockHash }) }), - beforeState: afterState, - afterState: afterState2 + beforeState: beforeState, + afterState: afterState, + afterMELState: afterMELState }), - expectedAssertionHash: expectedAssertionHash2 + expectedAssertionHash: expectedAssertionHash }); } - // need to have these in storage due to stack limit - bytes32[] randomStates1; - bytes32[] randomStates2; - + /** + * Creates a competing assertion on top of the genesis assertion, with a different state than the first assertion + * + * Should return: + * - the previous assertion state (same for both assertions) + * - the parent chain block hash last processed in the beforeState assertion (bytes32(0)) + * - the first assertion state + * - the second assertion state + * - the MEL state + * - the parent chain block hash last processed in the afterState assertion (firstAssertionParentChainBlockHash) + * - the edge id of the created challenge + * - the expected assertion hash for the first assertion + * - the expected assertion hash for the second assertion + * - the target parent chain block hash to be used in the next assertion + * + * @dev To be used after `setUp()` + * @dev Test used in multiple other tests + */ function testSuccessCreateSecondChild() public - returns ( - AssertionState memory, - AssertionState memory, - AssertionState memory, - uint256, - uint256, - bytes32, - bytes32 - ) + returns (SuccessCreateChallengeData memory data) { - uint256 genesisInboxCount = 1; - uint64 newInboxCount = uint64(_createNewBatch()); - AssertionState memory beforeState; - beforeState.machineStatus = MachineStatus.FINISHED; - AssertionState memory afterState; - afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // blockhash - afterState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - afterState.globalState.u64Vals[0] = 1; // inbox count - afterState.globalState.u64Vals[1] = 0; // pos in msg + data.beforeState.machineStatus = MachineStatus.FINISHED; + data.afterState1 = firstState; + data.afterMELState = firstMELState; + data.beforeStateParentChainBlockHash = bytes32(0); + data.afterStateParentChainBlockHash = firstAssertionParentChainBlockHash; { IOneStepProofEntry osp = userRollup.challengeManager().oneStepProofEntry(); - bytes32 h0 = osp.getMachineHash(beforeState.toExecutionState()); - bytes32 h1 = osp.getMachineHash(afterState.toExecutionState()); - randomStates1 = fillStatesInBetween(h0, h1, LAYERZERO_BLOCKEDGE_HEIGHT + 1); - afterState.endHistoryRoot = MerkleTreeAccumulatorLib.root( + bytes32 h0 = osp.getMachineHash(data.beforeState.toExecutionState()); + bytes32 h1 = osp.getMachineHash(data.afterState1.toExecutionState()); + randomStates1 = _fillStatesInBetween(h0, h1, LAYERZERO_BLOCKEDGE_HEIGHT + 1); + data.afterState1.endHistoryRoot = MerkleTreeAccumulatorLib.root( ProofUtils.expansionFromLeaves(randomStates1, 0, LAYERZERO_BLOCKEDGE_HEIGHT + 1) ); } - bytes32 expectedAssertionHash = RollupLib.assertionHash({ + data.assertionHash1 = RollupLib.assertionHash({ parentAssertionHash: genesisHash, - afterState: afterState, - inboxAcc: userRollup.bridge().sequencerInboxAccs(0) + afterState: data.afterState1 }); vm.prank(validator1); @@ -756,156 +720,165 @@ contract RollupTest is Test { tokenAmount: BASE_STAKE, assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), prevPrevAssertionHash: bytes32(0), configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState.globalState.u64Vals[0] + nextParentChainBlockHash: firstAssertionParentChainBlockHash }) }), - beforeState: beforeState, - afterState: afterState + beforeState: data.beforeState, + afterState: data.afterState1, + afterMELState: data.afterMELState }), - expectedAssertionHash: expectedAssertionHash, + expectedAssertionHash: data.assertionHash1, _withdrawalAddress: validator1Withdrawal }); - AssertionState memory afterState2; - afterState2.machineStatus = MachineStatus.FINISHED; - afterState2.globalState.bytes32Vals[0] = + data.afterState2 = firstState; + data.afterState2.globalState.bytes32Vals[0] = keccak256(abi.encodePacked(FIRST_ASSERTION_BLOCKHASH)); // blockhash - afterState2.globalState.bytes32Vals[1] = + data.afterState2.globalState.bytes32Vals[1] = keccak256(abi.encodePacked(FIRST_ASSERTION_SENDROOT)); // sendroot - afterState2.globalState.u64Vals[0] = 1; // inbox count - afterState2.globalState.u64Vals[1] = 0; // modify the state { IOneStepProofEntry osp = userRollup.challengeManager().oneStepProofEntry(); - bytes32 h0 = osp.getMachineHash(beforeState.toExecutionState()); - bytes32 h1 = osp.getMachineHash(afterState2.toExecutionState()); - randomStates2 = fillStatesInBetween(h0, h1, LAYERZERO_BLOCKEDGE_HEIGHT + 1); - afterState2.endHistoryRoot = MerkleTreeAccumulatorLib.root( + bytes32 h0 = osp.getMachineHash(data.beforeState.toExecutionState()); + bytes32 h1 = osp.getMachineHash(data.afterState2.toExecutionState()); + randomStates2 = _fillStatesInBetween(h0, h1, LAYERZERO_BLOCKEDGE_HEIGHT + 1); + data.afterState2.endHistoryRoot = MerkleTreeAccumulatorLib.root( ProofUtils.expansionFromLeaves(randomStates2, 0, LAYERZERO_BLOCKEDGE_HEIGHT + 1) ); } - bytes32 expectedAssertionHash2 = RollupLib.assertionHash({ + data.assertionHash2 = RollupLib.assertionHash({ parentAssertionHash: genesisHash, - afterState: afterState2, - inboxAcc: userRollup.bridge().sequencerInboxAccs(0) + afterState: data.afterState2 }); vm.prank(validator2); userRollup.newStakeOnNewAssertion({ tokenAmount: BASE_STAKE, assertion: AssertionInputs({ - beforeState: beforeState, beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), prevPrevAssertionHash: bytes32(0), configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState2.globalState.u64Vals[0] + nextParentChainBlockHash: firstAssertionParentChainBlockHash }) }), - afterState: afterState2 + beforeState: data.beforeState, + afterState: data.afterState2, + afterMELState: data.afterMELState }), - expectedAssertionHash: expectedAssertionHash2, + expectedAssertionHash: data.assertionHash2, _withdrawalAddress: validator2Withdrawal }); assertEq(userRollup.getAssertion(genesisHash).secondChildBlock, block.number); - return ( - beforeState, - afterState, - afterState2, - genesisInboxCount, - newInboxCount, - expectedAssertionHash, - expectedAssertionHash2 - ); + data.nextParentChainBlockHash = blockhash(block.number - 1); } - function testSuccessCreateSecondChildDifferentRoot() - public - returns (SuccessCreateChallengeData memory data) - { - ( - data.beforeState, - data.afterState1, - data.afterState2, - data.genesisInboxCount, - data.newInboxCount, - data.assertionHash, - data.assertionHash2 - ) = testSuccessCreateSecondChild(); + function testSuccessCreateSecondChildDifferentRoot() public { + SuccessCreateChallengeData memory data = testSuccessCreateSecondChild(); AssertionState memory afterState3 = data.afterState2; afterState3.endHistoryRoot = keccak256(abi.encode(afterState3.endHistoryRoot)); - bytes32 expectedAssertionHash3 = RollupLib.assertionHash({ - parentAssertionHash: genesisHash, - afterState: afterState3, - inboxAcc: userRollup.bridge().sequencerInboxAccs(0) - }); + bytes32 expectedAssertionHash3 = + RollupLib.assertionHash({parentAssertionHash: genesisHash, afterState: afterState3}); vm.prank(validator3); userRollup.newStakeOnNewAssertion({ tokenAmount: BASE_STAKE, assertion: AssertionInputs({ - beforeState: data.beforeState, beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), prevPrevAssertionHash: bytes32(0), configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState3.globalState.u64Vals[0] + nextParentChainBlockHash: firstAssertionParentChainBlockHash }) }), - afterState: afterState3 + beforeState: data.beforeState, + afterState: afterState3, + afterMELState: data.afterMELState }), expectedAssertionHash: expectedAssertionHash3, _withdrawalAddress: validator3Withdrawal }); } + function testConfirmAssertionWhenPaused() public { + (bytes32 assertionHash, AssertionState memory afterState,,) = testSuccessCreateAssertion(); + vm.roll(userRollup.getAssertion(genesisHash).firstChildBlock + CONFIRM_PERIOD_BLOCKS + 1); + vm.prank(upgradeExecutorAddr); + adminRollup.pause(); + vm.prank(validator1); + vm.expectRevert("Pausable: paused"); + userRollup.confirmAssertion( + assertionHash, + genesisHash, + afterState, + bytes32(0), + ConfigData({ + wasmModuleRoot: WASM_MODULE_ROOT, + requiredStake: BASE_STAKE, + challengeManager: address(challengeManager), + confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, + nextParentChainBlockHash: blockhash(block.number - 1) + }) + ); + } + function testRevertConfirmWrongInput() public { - (bytes32 assertionHash1,,) = testSuccessCreateAssertion(); + (bytes32 assertionHash,,,) = testSuccessCreateAssertion(); vm.roll(userRollup.getAssertion(genesisHash).firstChildBlock + CONFIRM_PERIOD_BLOCKS + 1); - bytes32 inboxAccs = userRollup.bridge().sequencerInboxAccs(0); vm.prank(validator1); vm.expectRevert("CONFIRM_DATA"); userRollup.confirmAssertion( - assertionHash1, + assertionHash, genesisHash, - emptyAssertionState, + emptyAssertionState, // Wrong assertion state bytes32(0), ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: firstState.globalState.u64Vals[0] - }), - inboxAccs + nextParentChainBlockHash: firstAssertionParentChainBlockHash + }) ); } + /** + * Confirms a new assertion created with `testSuccessCreateAssertion` on top of the genesis assertion + * + * Should return: + * - the assertion hash + * - the assertion state + * - the MEL state + * - the target parent chain block hash to be used in the next assertion + * + * @dev To be used after `testSuccessCreateAssertion()` + * @dev Test used in multiple other tests + */ function testSuccessConfirmUnchallengedAssertions() public - returns (bytes32, AssertionState memory, uint64) + returns (bytes32, AssertionState memory, MELState memory, bytes32) { - (bytes32 assertionHash, AssertionState memory state, uint64 inboxcount) = - testSuccessCreateAssertion(); + ( + bytes32 assertionHash, + AssertionState memory assertionState, + MELState memory melState, + bytes32 nextParentChainBlockHash + ) = testSuccessCreateAssertion(); vm.roll(userRollup.getAssertion(genesisHash).firstChildBlock + CONFIRM_PERIOD_BLOCKS + 1); - bytes32 inboxAccs = userRollup.bridge().sequencerInboxAccs(0); vm.prank(validator1); userRollup.confirmAssertion( assertionHash, @@ -917,15 +890,14 @@ contract RollupTest is Test { requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: firstState.globalState.u64Vals[0] - }), - inboxAccs + nextParentChainBlockHash: firstAssertionParentChainBlockHash + }) ); - return (assertionHash, state, inboxcount); + return (assertionHash, assertionState, melState, nextParentChainBlockHash); } function testSuccessRemoveWhitelistAfterValidatorAfk() public { - (bytes32 assertionHash,,) = testSuccessConfirmUnchallengedAssertions(); + (bytes32 assertionHash,,,) = testSuccessConfirmUnchallengedAssertions(); vm.roll( userRollup.getAssertion(assertionHash).createdAtBlock + userRollup.validatorAfkBlocks() + 1 @@ -937,7 +909,7 @@ contract RollupTest is Test { uint32 x ) public { vm.assume(x > 0); - (bytes32 assertionHash,,) = testSuccessConfirmUnchallengedAssertions(); + (bytes32 assertionHash,,,) = testSuccessConfirmUnchallengedAssertions(); vm.prank(upgradeExecutorAddr); adminRollup.setValidatorAfkBlocks(x); vm.roll(userRollup.getAssertion(assertionHash).createdAtBlock + x); @@ -948,7 +920,7 @@ contract RollupTest is Test { } function testSuccessValidatorAfkDisable() public { - (bytes32 assertionHash,,) = testSuccessConfirmUnchallengedAssertions(); + (bytes32 assertionHash,,,) = testSuccessConfirmUnchallengedAssertions(); vm.prank(upgradeExecutorAddr); adminRollup.setValidatorAfkBlocks(0); // set 0 to disable vm.roll(userRollup.getAssertion(assertionHash).createdAtBlock + 1); @@ -962,14 +934,13 @@ contract RollupTest is Test { } function testRevertConfirmSiblingedAssertions() public { - (,,,,, bytes32 assertionHash,) = testSuccessCreateSecondChild(); + SuccessCreateChallengeData memory data = testSuccessCreateSecondChild(); vm.roll(userRollup.getAssertion(genesisHash).firstChildBlock + CONFIRM_PERIOD_BLOCKS + 1); - bytes32 inboxAccs = userRollup.bridge().sequencerInboxAccs(0); vm.prank(validator1); vm.expectRevert(abi.encodeWithSelector(EdgeNotExists.selector, bytes32(0))); userRollup.confirmAssertion( - assertionHash, + data.assertionHash1, genesisHash, firstState, bytes32(0), @@ -978,44 +949,43 @@ contract RollupTest is Test { requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: firstState.globalState.u64Vals[0] - }), - inboxAccs + nextParentChainBlockHash: firstAssertionParentChainBlockHash + }) ); } - struct SuccessCreateChallengeData { - AssertionState beforeState; - uint256 genesisInboxCount; - AssertionState afterState1; - AssertionState afterState2; - uint256 newInboxCount; - bytes32 e1Id; - bytes32 assertionHash; - bytes32 assertionHash2; - } - + /** + * Creates a challenge between 2 assertions created with `testSuccessCreateAssertion` and `testSuccessCreateSecondChild` on top of the genesis assertion + * + * Should return: + * - the previous assertion state (same for both assertions) + * - the parent chain block hash last processed in the beforeState assertion (bytes32(0)) + * - the first assertion state + * - the second assertion state + * - the MEL state + * - the parent chain block hash last processed in the afterState assertion (firstAssertionParentChainBlockHash) + * - the edge id of the created challenge + * - the expected assertion hash for the first assertion + * - the expected assertion hash for the second assertion + * - the target parent chain block hash to be used in the next assertion + * + * @dev To be used after `testSuccessCreateSecondChild()` + * @dev Test used in multiple other tests + */ function testSuccessCreateChallenge() public returns (SuccessCreateChallengeData memory data) { - ( - data.beforeState, - data.afterState1, - data.afterState2, - data.genesisInboxCount, - data.newInboxCount, - data.assertionHash, - data.assertionHash2 - ) = testSuccessCreateSecondChild(); + data = testSuccessCreateSecondChild(); + // randomStates1 is filled in `testSuccessCreateSecondChild` (corresponds to the states of afterState1) bytes32 root = MerkleTreeAccumulatorLib.root( ProofUtils.expansionFromLeaves(randomStates1, 0, LAYERZERO_BLOCKEDGE_HEIGHT + 1) ); - data.e1Id = challengeManager.createLayerZeroEdge( + data.edge1Id = challengeManager.createLayerZeroEdge( CreateEdgeArgs({ level: 0, endHistoryRoot: root, endHeight: LAYERZERO_BLOCKEDGE_HEIGHT, - claimId: data.assertionHash, + claimId: data.assertionHash1, prefixProof: abi.encode( ProofUtils.expansionFromLeaves(randomStates1, 0, 1), ProofUtils.generatePrefixProof( @@ -1026,10 +996,8 @@ contract RollupTest is Test { ProofUtils.generateInclusionProof( ProofUtils.rehashed(randomStates1), randomStates1.length - 1 ), - AssertionStateData(data.beforeState, bytes32(0), bytes32(0)), - AssertionStateData( - data.afterState1, genesisHash, userRollup.bridge().sequencerInboxAccs(0) - ) + AssertionStateData(data.beforeState, bytes32(0)), + AssertionStateData(data.afterState1, genesisHash) ) }) ); @@ -1037,16 +1005,17 @@ contract RollupTest is Test { function testSuccessCreate2Edge() public returns (bytes32, bytes32) { SuccessCreateChallengeData memory data = testSuccessCreateChallenge(); - require(data.genesisInboxCount == 1, "A"); - require(data.newInboxCount == 2, "B"); + require(data.beforeStateParentChainBlockHash == bytes32(0), "A"); + require(data.afterStateParentChainBlockHash == firstAssertionParentChainBlockHash, "B"); + // randomStates2 is filled in `testSuccessCreateSecondChild` (corresponds to the states of afterState2) bytes32 root = MerkleTreeAccumulatorLib.root( ProofUtils.expansionFromLeaves(randomStates2, 0, LAYERZERO_BLOCKEDGE_HEIGHT + 1) ); token.transfer(validator1, 1 ether); vm.startPrank(validator1); - bytes32 e2Id = challengeManager.createLayerZeroEdge( + bytes32 edge2Id = challengeManager.createLayerZeroEdge( CreateEdgeArgs({ level: 0, endHistoryRoot: root, @@ -1062,64 +1031,49 @@ contract RollupTest is Test { ProofUtils.generateInclusionProof( ProofUtils.rehashed(randomStates2), randomStates2.length - 1 ), - AssertionStateData(data.beforeState, bytes32(0), bytes32(0)), - AssertionStateData( - data.afterState2, genesisHash, userRollup.bridge().sequencerInboxAccs(0) - ) + AssertionStateData(data.beforeState, bytes32(0)), + AssertionStateData(data.afterState2, genesisHash) ) }) ); vm.stopPrank(); - return (data.e1Id, e2Id); - } - - function fillStatesInBetween( - bytes32 start, - bytes32 end, - uint256 totalCount - ) internal returns (bytes32[] memory) { - bytes32[] memory innerStates = rand.hashes(totalCount - 2); - - bytes32[] memory states = new bytes32[](totalCount); - states[0] = start; - for (uint256 i = 0; i < innerStates.length; i++) { - states[i + 1] = innerStates[i]; - } - states[totalCount - 1] = end; - - return states; + return (data.edge1Id, edge2Id); } + /** + * Confirms a challenged assertion by time. The challenge is created with `testSuccessCreateChallenge` + * + * Should return: + * - the winning assertion hash + * + * @dev To be used after `testSuccessCreateChallenge()` + * @dev Test used in multiple other tests + */ function testSuccessConfirmEdgeByTime() public returns (bytes32) { SuccessCreateChallengeData memory data = testSuccessCreateChallenge(); vm.roll(userRollup.getAssertion(genesisHash).firstChildBlock + CONFIRM_PERIOD_BLOCKS + 1); vm.warp(block.timestamp + CONFIRM_PERIOD_BLOCKS * 15); userRollup.challengeManager().confirmEdgeByTime( - data.e1Id, - AssertionStateData( - data.afterState1, genesisHash, userRollup.bridge().sequencerInboxAccs(0) - ) + data.edge1Id, AssertionStateData(data.afterState1, genesisHash) ); - bytes32 inboxAcc = userRollup.bridge().sequencerInboxAccs(0); vm.roll(block.number + userRollup.challengeGracePeriodBlocks()); vm.prank(validator1); userRollup.confirmAssertion( - data.assertionHash, + data.assertionHash1, genesisHash, data.afterState1, - data.e1Id, + data.edge1Id, ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: firstState.globalState.u64Vals[0] - }), - inboxAcc + nextParentChainBlockHash: data.afterStateParentChainBlockHash + }) ); - return data.e1Id; + return data.edge1Id; } function testRevertConfirmBeforeAfterPeriodBlocks() public returns (bytes32) { @@ -1128,30 +1082,25 @@ contract RollupTest is Test { vm.roll(userRollup.getAssertion(genesisHash).firstChildBlock + CONFIRM_PERIOD_BLOCKS + 1); vm.warp(block.timestamp + CONFIRM_PERIOD_BLOCKS * 15); userRollup.challengeManager().confirmEdgeByTime( - data.e1Id, - AssertionStateData( - data.afterState1, genesisHash, userRollup.bridge().sequencerInboxAccs(0) - ) + data.edge1Id, AssertionStateData(data.afterState1, genesisHash) ); - bytes32 inboxAcc = userRollup.bridge().sequencerInboxAccs(0); vm.roll(block.number + userRollup.challengeGracePeriodBlocks() - 1); vm.prank(validator1); vm.expectRevert("CHALLENGE_GRACE_PERIOD_NOT_PASSED"); userRollup.confirmAssertion( - data.assertionHash, + data.assertionHash1, genesisHash, data.afterState1, - data.e1Id, + data.edge1Id, ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: firstState.globalState.u64Vals[0] - }), - inboxAcc + nextParentChainBlockHash: data.afterStateParentChainBlockHash + }) ); - return data.e1Id; + return data.edge1Id; } function testRevertWithdrawStake() public { @@ -1259,160 +1208,203 @@ contract RollupTest is Test { userRollup.addToDeposit(address(this), validator2Withdrawal, 1); } + /** + * Creates a second assertion on top of the one created with `testSuccessCreateAssertion` + * + * Should return: + * - the previous assertion hash + * - the expected assertion hash + * - the assertion state + * - the MEL state + * - the target parent chain block hash to be used in the next assertion + * + * @dev To be used after `testSuccessCreateAssertion()` + * @dev Test used in multiple other tests + */ function testSuccessCreateSecondAssertion() public - returns (bytes32, bytes32, AssertionState memory, bytes32) + returns (bytes32, bytes32, AssertionState memory, MELState memory, bytes32) { - (bytes32 prevHash, AssertionState memory beforeState, uint64 prevInboxCount) = - testSuccessCreateAssertion(); + ( + bytes32 beforeAssertionHash, + AssertionState memory beforeState, + MELState memory beforeMELState, + bytes32 nextParentChainBlockHash + ) = testSuccessCreateAssertion(); + + MELState memory afterMELState = beforeMELState; + // Add one message and update nextParentChainBlockHash + // (the other values in MEL state are not relevant in the Rollup contracts) + afterMELState.msgCount += 1; + afterMELState.parentChainBlockHash = nextParentChainBlockHash; AssertionState memory afterState; afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.u64Vals[0] = prevInboxCount; - bytes32 inboxAcc = userRollup.bridge().sequencerInboxAccs(1); // 1 because we moved the position within message - bytes32 expectedAssertionHash2 = RollupLib.assertionHash({ - parentAssertionHash: prevHash, - afterState: afterState, - inboxAcc: inboxAcc + afterState.globalState.u64Vals[0] += 1; // increase MsgCount + afterState.globalState.u64Vals[1] += 1; // increase ExecutedMsgCount + afterState.globalState.bytes32Vals[2] = afterMELState.hash(); // update MEL State hash + bytes32 expectedAssertionHash = RollupLib.assertionHash({ + parentAssertionHash: beforeAssertionHash, + afterState: afterState }); - bytes32 prevInboxAcc = userRollup.bridge().sequencerInboxAccs(0); + vm.roll(block.number + 75); vm.prank(validator1); userRollup.stakeOnNewAssertion({ assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: prevInboxAcc, prevPrevAssertionHash: genesisHash, configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState.globalState.u64Vals[0] + nextParentChainBlockHash: nextParentChainBlockHash }) }), beforeState: beforeState, - afterState: afterState + afterState: afterState, + afterMELState: afterMELState }), - expectedAssertionHash: expectedAssertionHash2 + expectedAssertionHash: expectedAssertionHash }); - return (prevHash, expectedAssertionHash2, afterState, inboxAcc); + + bytes32 nextParentChainBlockHash2 = blockhash(block.number - 1); + + return ( + beforeAssertionHash, + expectedAssertionHash, + afterState, + afterMELState, + nextParentChainBlockHash2 + ); } function testRevertCreateChildReducedStake() public { - (bytes32 prevHash, AssertionState memory beforeState, uint64 prevInboxCount) = - testSuccessConfirmUnchallengedAssertions(); + ( + bytes32 beforeAssertionHash, + AssertionState memory beforeState, + MELState memory beforeMELState, + bytes32 nextParentChainBlockHash + ) = testSuccessConfirmUnchallengedAssertions(); vm.prank(validator1); userRollup.reduceDeposit(1); + MELState memory afterMELState = beforeMELState; + // Add one message and update nextParentChainBlockHash + // (the other values in MEL state are not relevant in the Rollup contracts) + afterMELState.msgCount += 1; + afterMELState.parentChainBlockHash = nextParentChainBlockHash; + AssertionState memory afterState; afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.u64Vals[0] = prevInboxCount; - bytes32 expectedAssertionHash2 = RollupLib.assertionHash({ - parentAssertionHash: prevHash, - afterState: afterState, - inboxAcc: userRollup.bridge().sequencerInboxAccs(1) // 1 because we moved the position within message + afterState.globalState.u64Vals[0] += 1; // increase MsgCount + afterState.globalState.u64Vals[1] += 1; // increase ExecutedMsgCount + afterState.globalState.bytes32Vals[2] = afterMELState.hash(); // update MEL State hash + bytes32 expectedAssertionHash = RollupLib.assertionHash({ + parentAssertionHash: beforeAssertionHash, + afterState: afterState }); - bytes32 prevInboxAcc = userRollup.bridge().sequencerInboxAccs(0); + vm.roll(block.number + 75); vm.prank(validator1); vm.expectRevert("INSUFFICIENT_STAKE"); userRollup.stakeOnNewAssertion({ assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: prevInboxAcc, prevPrevAssertionHash: genesisHash, configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState.globalState.u64Vals[0] + nextParentChainBlockHash: nextParentChainBlockHash }) }), beforeState: beforeState, - afterState: afterState + afterState: afterState, + afterMELState: afterMELState }), - expectedAssertionHash: expectedAssertionHash2 + expectedAssertionHash: expectedAssertionHash }); } function testSuccessFastConfirmNext() public { - (bytes32 assertionHash,,) = testSuccessCreateAssertion(); - bytes32 inboxAccs = userRollup.bridge().sequencerInboxAccs(0); + (bytes32 assertionHash, AssertionState memory afterState,,) = testSuccessCreateAssertion(); assertEq(userRollup.latestConfirmed(), genesisHash); vm.prank(anyTrustFastConfirmer); - userRollup.fastConfirmAssertion(assertionHash, genesisHash, firstState, inboxAccs); + userRollup.fastConfirmAssertion(assertionHash, genesisHash, afterState); assertEq(userRollup.latestConfirmed(), assertionHash); } function testSuccessFastConfirmSkipOne() public { - ( - bytes32 prevHash, - bytes32 assertionHash, - AssertionState memory afterState, - bytes32 inboxAcc - ) = testSuccessCreateSecondAssertion(); - assertEq(userRollup.latestConfirmed() != prevHash, true); + (bytes32 beforeAssertionHash, bytes32 assertionHash, AssertionState memory afterState,,) = + testSuccessCreateSecondAssertion(); + assertEq(userRollup.latestConfirmed() != beforeAssertionHash, true); vm.prank(anyTrustFastConfirmer); - userRollup.fastConfirmAssertion(assertionHash, prevHash, afterState, inboxAcc); + userRollup.fastConfirmAssertion(assertionHash, beforeAssertionHash, afterState); assertEq(userRollup.latestConfirmed(), assertionHash); } function testRevertFastConfirmNotPending() public { - (bytes32 assertionHash,,) = testSuccessConfirmUnchallengedAssertions(); - bytes32 inboxAccs = userRollup.bridge().sequencerInboxAccs(0); + (bytes32 assertionHash, AssertionState memory afterState,,) = + testSuccessConfirmUnchallengedAssertions(); vm.expectRevert("NOT_PENDING"); vm.prank(anyTrustFastConfirmer); - userRollup.fastConfirmAssertion(assertionHash, genesisHash, firstState, inboxAccs); + userRollup.fastConfirmAssertion(assertionHash, genesisHash, afterState); } function testRevertFastConfirmNotConfirmer() public { - (bytes32 assertionHash,,) = testSuccessCreateAssertion(); - bytes32 inboxAccs = userRollup.bridge().sequencerInboxAccs(0); + (bytes32 assertionHash, AssertionState memory afterState,,) = testSuccessCreateAssertion(); vm.expectRevert("NOT_FAST_CONFIRMER"); - userRollup.fastConfirmAssertion(assertionHash, genesisHash, firstState, inboxAccs); - } - + userRollup.fastConfirmAssertion(assertionHash, genesisHash, afterState); + } + + /** + * Helper function to fast confirm an assertion with `fastConfirmNewAssertion`, and optionally create it beforehand + * + * Should return: + * - the assertion inputs + * - the expected assertion hash + * + * @dev To be used after `setUp()` + * @dev Helper used in multiple other tests + * + * @param fastConfirmer the address used to call `fastConfirmNewAssertion` + * @param expectedErrorMsg the expected error message for the call to `fastConfirmNewAssertion` (empty string if the call is expected to succeed) + * @param createAssertion whether to create the assertion before calling `fastConfirmNewAssertion` (if false, the assertion will not be created, and the call to `fastConfirmNewAssertion` is expected to revert with "ASSERTION_NOT_FOUND") + */ function _testFastConfirmNewAssertion( - address by, - string memory err, - bool isCreated + address fastConfirmer, + string memory expectedErrorMsg, + bool createAssertion ) internal returns (AssertionInputs memory, bytes32) { - uint64 inboxcount = uint64(_createNewBatch()); AssertionState memory beforeState; beforeState.machineStatus = MachineStatus.FINISHED; - AssertionState memory afterState; - afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // blockhash - afterState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - afterState.globalState.u64Vals[0] = 1; // inbox count - afterState.globalState.u64Vals[1] = 0; // pos in msg + AssertionState memory afterState = firstState; + MELState memory afterMELState = firstMELState; - bytes32 expectedAssertionHash = RollupLib.assertionHash({ - parentAssertionHash: genesisHash, - afterState: afterState, - inboxAcc: userRollup.bridge().sequencerInboxAccs(0) - }); + bytes32 expectedAssertionHash = + RollupLib.assertionHash({parentAssertionHash: genesisHash, afterState: afterState}); AssertionInputs memory assertion = AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), prevPrevAssertionHash: bytes32(0), configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: afterState.globalState.u64Vals[0] + nextParentChainBlockHash: firstAssertionParentChainBlockHash }) }), beforeState: beforeState, - afterState: afterState + afterState: afterState, + afterMELState: afterMELState }); - if (isCreated) { + if (createAssertion) { vm.prank(validator1); userRollup.newStakeOnNewAssertion({ tokenAmount: BASE_STAKE, @@ -1422,15 +1414,15 @@ contract RollupTest is Test { }); } - if (bytes(err).length > 0) { - vm.expectRevert(bytes(err)); + if (bytes(expectedErrorMsg).length > 0) { + vm.expectRevert(bytes(expectedErrorMsg)); } - vm.prank(by); + vm.prank(fastConfirmer); userRollup.fastConfirmNewAssertion({ assertion: assertion, expectedAssertionHash: expectedAssertionHash }); - if (bytes(err).length == 0) { + if (bytes(expectedErrorMsg).length == 0) { assertEq(userRollup.latestConfirmed(), expectedAssertionHash); } return (assertion, expectedAssertionHash); @@ -1593,7 +1585,7 @@ contract RollupTest is Test { function testAssertionStateHash() public { AssertionState memory astate = AssertionState( GlobalState( - [rand.hash(), rand.hash()], + [rand.hash(), rand.hash(), rand.hash(), rand.hash()], [uint64(uint256(rand.hash())), uint64(uint256(rand.hash()))] ), MachineStatus.FINISHED, @@ -1607,17 +1599,14 @@ contract RollupTest is Test { bytes32 parentHash = rand.hash(); AssertionState memory astate = AssertionState( GlobalState( - [rand.hash(), rand.hash()], + [rand.hash(), rand.hash(), rand.hash(), rand.hash()], [uint64(uint256(rand.hash())), uint64(uint256(rand.hash()))] ), MachineStatus.FINISHED, bytes32(0) ); - bytes32 inboxAcc = rand.hash(); - bytes32 expectedHash = keccak256(abi.encodePacked(parentHash, astate.hash(), inboxAcc)); - assertEq( - RollupLib.assertionHash(parentHash, astate, inboxAcc), expectedHash, "Unexpected hash" - ); + bytes32 expectedHash = keccak256(abi.encodePacked(parentHash, astate.hash())); + assertEq(RollupLib.assertionHash(parentHash, astate), expectedHash, "Unexpected hash"); } function testIncreaseBaseStake() public { @@ -1664,48 +1653,35 @@ contract RollupTest is Test { vm.prank(upgradeExecutorAddr); adminRollup.decreaseBaseStake(BASE_STAKE - 1, 0); - (bytes32 assertionHash1,,) = testSuccessCreateAssertion(); + ( + bytes32 beforeAssertionHash, + AssertionState memory beforeState, + MELState memory beforeMELState, + bytes32 nextParentChainBlockHash + ) = testSuccessCreateAssertion(); vm.prank(upgradeExecutorAddr); vm.expectRevert("EXPIRED_CONFIG_HASH"); adminRollup.decreaseBaseStake(BASE_STAKE - 1, 0); - uint64 nextInboxPosition = uint64(userRollup.bridge().sequencerMessageCount()); vm.prank(upgradeExecutorAddr); - adminRollup.decreaseBaseStake(BASE_STAKE - 1, nextInboxPosition); + adminRollup.decreaseBaseStake(BASE_STAKE - 1, nextParentChainBlockHash); + + MELState memory afterMELState = beforeMELState; + // Add one message and update nextParentChainBlockHash + // (the other values in MEL state are not relevant in the Rollup contracts) + afterMELState.msgCount += 1; + afterMELState.parentChainBlockHash = nextParentChainBlockHash; - uint64 inboxcount = uint64(_createNewBatch()); - AssertionState memory beforeState; - beforeState.machineStatus = MachineStatus.FINISHED; - beforeState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // blockhash - beforeState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - beforeState.globalState.u64Vals[0] = 1; // inbox count - beforeState.globalState.u64Vals[1] = 0; // pos in msg AssertionState memory afterState; afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.bytes32Vals[0] = FIRST_ASSERTION_BLOCKHASH; // blockhash - afterState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - afterState.globalState.u64Vals[0] = 2; // inbox count - afterState.globalState.u64Vals[1] = 0; // pos in msg - - AssertionState memory emptyState = AssertionState( - GlobalState([bytes32(0), bytes32(0)], [uint64(0), uint64(0)]), - MachineStatus.FINISHED, - bytes32(0) - ); - // genesis hash - bytes32 genesisAssertionHash = RollupLib.assertionHash({ - parentAssertionHash: bytes32(0), - afterState: emptyState, - inboxAcc: bytes32(0) - }); - + afterState.globalState.u64Vals[0] += 1; // increase MsgCount + afterState.globalState.u64Vals[1] += 1; // increase ExecutedMsgCount + afterState.globalState.bytes32Vals[2] = afterMELState.hash(); // update MEL State hash bytes32 expectedAssertionHash = RollupLib.assertionHash({ - parentAssertionHash: assertionHash1, - afterState: afterState, - inboxAcc: userRollup.bridge().sequencerInboxAccs(1) + parentAssertionHash: beforeAssertionHash, + afterState: afterState }); - bytes32 beforeInboxAcc = userRollup.bridge().sequencerInboxAccs(0); vm.roll(block.number + userRollup.minimumAssertionPeriod()); // test that we can create a new assertion after stake reduction @@ -1714,18 +1690,18 @@ contract RollupTest is Test { tokenAmount: BASE_STAKE - 1, assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: beforeInboxAcc, - prevPrevAssertionHash: genesisAssertionHash, + prevPrevAssertionHash: genesisHash, configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE - 1, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: 2 + nextParentChainBlockHash: nextParentChainBlockHash }) }), beforeState: beforeState, - afterState: afterState + afterState: afterState, + afterMELState: afterMELState }), expectedAssertionHash: expectedAssertionHash, _withdrawalAddress: validator1Withdrawal @@ -1736,21 +1712,15 @@ contract RollupTest is Test { function createStakeTooLowAssertion() public { // trying to create an assertion with the genesis as parent will fail with stake too low - AssertionState memory beforeState3; - beforeState3.machineStatus = MachineStatus.FINISHED; - AssertionState memory afterState3; - afterState3.machineStatus = MachineStatus.FINISHED; - afterState3.globalState.bytes32Vals[0] = + AssertionState memory beforeState; + beforeState.machineStatus = MachineStatus.FINISHED; + AssertionState memory afterState = firstState; + afterState.globalState.bytes32Vals[0] = keccak256(abi.encodePacked(FIRST_ASSERTION_BLOCKHASH)); // blockhash - afterState3.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // sendroot - afterState3.globalState.u64Vals[0] = 1; // inbox count - afterState3.globalState.u64Vals[1] = 0; // pos in msg + MELState memory afterMELState = firstMELState; - bytes32 expectedAssertionHash3 = RollupLib.assertionHash({ - parentAssertionHash: genesisHash, - afterState: afterState3, - inboxAcc: userRollup.bridge().sequencerInboxAccs(0) - }); + bytes32 expectedAssertionHash = + RollupLib.assertionHash({parentAssertionHash: genesisHash, afterState: afterState}); vm.expectRevert("STAKE_TOO_LOW"); vm.prank(validator3); @@ -1758,21 +1728,21 @@ contract RollupTest is Test { tokenAmount: BASE_STAKE, assertion: AssertionInputs({ beforeStateData: BeforeStateData({ - sequencerBatchAcc: bytes32(0), prevPrevAssertionHash: bytes32(0), configData: ConfigData({ wasmModuleRoot: WASM_MODULE_ROOT, requiredStake: BASE_STAKE, challengeManager: address(challengeManager), confirmPeriodBlocks: CONFIRM_PERIOD_BLOCKS, - nextInboxPosition: 1 + nextParentChainBlockHash: firstAssertionParentChainBlockHash }) }), - beforeState: beforeState3, - afterState: afterState3 + beforeState: beforeState, + afterState: afterState, + afterMELState: afterMELState }), - expectedAssertionHash: expectedAssertionHash3, - _withdrawalAddress: validator1Withdrawal + expectedAssertionHash: expectedAssertionHash, + _withdrawalAddress: validator3Withdrawal }); } @@ -1781,10 +1751,9 @@ contract RollupTest is Test { SuccessCreateChallengeData memory data = testSuccessCreateChallenge(); - uint64 nextInboxPosition = uint64(userRollup.bridge().sequencerMessageCount()); - userRollup.getAssertion(data.assertionHash); + userRollup.getAssertion(data.assertionHash1); vm.expectRevert("TOO_MANY_PENDING_STAKERS"); vm.prank(upgradeExecutorAddr); - adminRollup.decreaseBaseStake(BASE_STAKE - 1, nextInboxPosition); + adminRollup.decreaseBaseStake(BASE_STAKE - 1, data.nextParentChainBlockHash); } } diff --git a/test/foundry/RollupCreator.t.sol b/test/foundry/RollupCreator.t.sol index 3d88f9e2e..94286e7fd 100644 --- a/test/foundry/RollupCreator.t.sol +++ b/test/foundry/RollupCreator.t.sol @@ -99,7 +99,7 @@ contract RollupCreatorTest is Test { miniStakeValues[1] = 2 ether; miniStakeValues[2] = 3 ether; AssertionState memory emptyState = AssertionState( - GlobalState([bytes32(0), bytes32(0)], [uint64(0), uint64(0)]), + GlobalState([bytes32(0), bytes32(0), bytes32(0), bytes32(0)], [uint64(0), uint64(0)]), MachineStatus.FINISHED, bytes32(0) ); From b6b1141b59f97db11244e412508c80f6f2d7f779 Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Wed, 10 Jun 2026 12:39:26 +0100 Subject: [PATCH 10/17] Fix tests, initialization logic, and overflow assertion detenction --- scripts/config.example.ts | 7 +- scripts/rollupCreation.ts | 7 +- src/rollup/RollupAdminLogic.sol | 2 +- src/rollup/RollupCore.sol | 19 +- src/rollup/RollupUserLogic.sol | 12 +- test/contract/common/globalStateLib.ts | 2 + test/e2e/orbitChain.ts | 7 +- test/foundry/Rollup.t.sol | 16 +- test/signatures/RollupAdminLogic | 2 +- test/signatures/RollupUserLogic | 254 ++++++++++++------------- 10 files changed, 181 insertions(+), 147 deletions(-) diff --git a/scripts/config.example.ts b/scripts/config.example.ts index 58384ad7d..40902cf13 100644 --- a/scripts/config.example.ts +++ b/scripts/config.example.ts @@ -17,7 +17,12 @@ const chainId = ethers.BigNumber.from('13331370') const genesisAssertionState: AssertionStateStruct = { globalState: { - bytes32Vals: [ethers.constants.HashZero, ethers.constants.HashZero, ethers.constants.HashZero, ethers.constants.HashZero], + bytes32Vals: [ + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ], u64Vals: [ethers.BigNumber.from('0'), ethers.BigNumber.from('0')], }, machineStatus: 1, // FINISHED diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index 1869a4f5d..4d7b93f66 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -315,7 +315,12 @@ async function _getDevRollupConfig( const genesisAssertionState: AssertionStateStruct = { globalState: { - bytes32Vals: [ethers.constants.HashZero, ethers.constants.HashZero, ethers.constants.HashZero, ethers.constants.HashZero], + bytes32Vals: [ + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ], u64Vals: [ethers.BigNumber.from('0'), ethers.BigNumber.from('0')], }, machineStatus: 1, // FINISHED diff --git a/src/rollup/RollupAdminLogic.sol b/src/rollup/RollupAdminLogic.sol index be707ebcb..2cf1144d5 100644 --- a/src/rollup/RollupAdminLogic.sol +++ b/src/rollup/RollupAdminLogic.sol @@ -74,7 +74,7 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl afterStateHash: config.genesisAssertionState.hash() }); - bytes32 nextParentChainBlockHash = blockhash(block.number); + bytes32 nextParentChainBlockHash = blockhash(block.number - 1); AssertionNode memory initialAssertion = AssertionNodeLib.createAssertion( true, RollupLib.configHash({ diff --git a/src/rollup/RollupCore.sol b/src/rollup/RollupCore.sol index e68edab1d..d342f8ca3 100644 --- a/src/rollup/RollupCore.sol +++ b/src/rollup/RollupCore.sol @@ -420,7 +420,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { AssertionInputs calldata assertion, bytes32 prevAssertionHash, bytes32 expectedAssertionHash - ) internal returns (bytes32 newAssertionHash) { + ) internal returns (bytes32 newAssertionHash, bool overflowAssertion) { // Validate the config hash RollupLib.validateConfigHash( assertion.beforeStateData.configData, getAssertionStorage(prevAssertionHash).configHash @@ -458,6 +458,10 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { AssertionNode storage prevAssertion = getAssertionStorage(prevAssertionHash); { + // We want to prevent multiple assertions from being created in the same block, as this would allow them to have the same `nextParentChainBlockHash`, + // which would be an already processed block hash by the time the assertions are created. + require((block.number - prevAssertion.createdAtBlock) >= 1, "SAME_BLOCK_ASSERTION"); + // This new assertion consumes the messages from prevParentChainBlockHash to afterParentChainBlockHash GlobalState calldata afterGS = assertion.afterState.globalState; GlobalState calldata beforeGS = assertion.beforeState.globalState; @@ -466,12 +470,23 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable { // AfterState must have executed at least as many messages as beforeState require(afterGS.compareExecutedMessages(beforeGS) >= 0, "INBOX_BACKWARDS"); - // Checking the last processed block hash (we won't check for overflowing assertions) + // Checking the last processed block hash require( afterMELState.parentChainBlockHash == assertion.beforeStateData.configData.nextParentChainBlockHash, "BAD_PARENT_CHAIN_BLOCK_HASH" ); + + // An overflowing assertion is one where there are still messages left to execute while the machine is in a non-errored terminal state. + // This can only happen if the Machine already executed the maximum amount of messages allowed by BoLD + if ( + assertion.afterState.machineStatus != MachineStatus.ERRORED + && (afterMELState.msgCount > afterGS.getMELExecutedMsgCount()) + ) { + overflowAssertion = true; + // This shouldn't be necessary, but might as well constrain the assertion to be non-empty + require(afterGS.compareExecutedMessages(beforeGS) > 0, "OVERFLOW_STANDSTILL"); + } } // AfterState includes the hash of the MELState up to which messages have been read diff --git a/src/rollup/RollupUserLogic.sol b/src/rollup/RollupUserLogic.sol index e6b75c33a..240b8baab 100644 --- a/src/rollup/RollupUserLogic.sol +++ b/src/rollup/RollupUserLogic.sol @@ -201,13 +201,15 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { "STAKED_ON_ANOTHER_BRANCH" ); - bytes32 newAssertionHash = + (bytes32 newAssertionHash, bool overflowAssertion) = createNewAssertion(assertion, prevAssertion, expectedAssertionHash); _stakerMap[msg.sender].latestStakedAssertion = newAssertionHash; - uint256 timeSincePrev = block.number - getAssertionStorage(prevAssertion).createdAtBlock; - // Verify that assertion meets the minimum Delta time requirement - require(timeSincePrev >= minimumAssertionPeriod, "TIME_DELTA"); + if (!overflowAssertion) { + uint256 timeSincePrev = block.number - getAssertionStorage(prevAssertion).createdAtBlock; + // Verify that assertion meets the minimum Delta time requirement + require(timeSincePrev >= minimumAssertionPeriod, "TIME_DELTA"); + } if (!getAssertionStorage(newAssertionHash).isFirstChild) { // We assume assertion.beforeStateData is valid here as it will be validated in createNewAssertion @@ -318,7 +320,7 @@ contract RollupUserLogic is RollupCore, UUPSNotUpgradeable, IRollupUser { if (status == AssertionStatus.NoAssertion) { // If not exists, we create the new assertion - bytes32 newAssertionHash = + (bytes32 newAssertionHash,) = createNewAssertion(assertion, prevAssertion, expectedAssertionHash); if (!getAssertionStorage(newAssertionHash).isFirstChild) { // only 1 of the children can be confirmed and get their stake refunded diff --git a/test/contract/common/globalStateLib.ts b/test/contract/common/globalStateLib.ts index 2f1e34393..513fa4cab 100644 --- a/test/contract/common/globalStateLib.ts +++ b/test/contract/common/globalStateLib.ts @@ -8,6 +8,8 @@ export function hash(state: GlobalStateStruct) { 'Global state:', state.bytes32Vals[0], state.bytes32Vals[1], + state.bytes32Vals[2], + state.bytes32Vals[3], state.u64Vals[0], state.u64Vals[1], ] diff --git a/test/e2e/orbitChain.ts b/test/e2e/orbitChain.ts index b21705dfa..bf1e9085f 100644 --- a/test/e2e/orbitChain.ts +++ b/test/e2e/orbitChain.ts @@ -817,7 +817,12 @@ describe('Orbit Chain', () => { const genesisAssertionState: AssertionStateStruct = { globalState: { - bytes32Vals: [ethers.constants.HashZero, ethers.constants.HashZero], + bytes32Vals: [ + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ], u64Vals: [ethers.BigNumber.from('0'), ethers.BigNumber.from('0')], }, machineStatus: 1, // FINISHED diff --git a/test/foundry/Rollup.t.sol b/test/foundry/Rollup.t.sol index 6532c8039..9a7dde8a0 100644 --- a/test/foundry/Rollup.t.sol +++ b/test/foundry/Rollup.t.sol @@ -242,8 +242,8 @@ contract RollupTest is Test { // store the parent chain block information to be used in the next assertion // (must be consistent with the the implementation of `initialize` in RollupAdminLogic) - firstAssertionParentChainBlockNumber = uint64(block.number); - firstAssertionParentChainBlockHash = blockhash(block.number); + firstAssertionParentChainBlockNumber = uint64(block.number - 1); + firstAssertionParentChainBlockHash = blockhash(block.number - 1); // check upgrade executor owns proxyAdmin address upgradeExecutorExpectedAddress = computeCreateAddress(address(rollupCreator), 4); @@ -1240,8 +1240,8 @@ contract RollupTest is Test { AssertionState memory afterState; afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.u64Vals[0] += 1; // increase MsgCount - afterState.globalState.u64Vals[1] += 1; // increase ExecutedMsgCount + afterState.globalState.u64Vals[0] = beforeState.globalState.u64Vals[0] + 1; // increase MsgCount + afterState.globalState.u64Vals[1] = beforeState.globalState.u64Vals[1] + 1; // increase ExecutedMsgCount afterState.globalState.bytes32Vals[2] = afterMELState.hash(); // update MEL State hash bytes32 expectedAssertionHash = RollupLib.assertionHash({ parentAssertionHash: beforeAssertionHash, @@ -1299,8 +1299,8 @@ contract RollupTest is Test { AssertionState memory afterState; afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.u64Vals[0] += 1; // increase MsgCount - afterState.globalState.u64Vals[1] += 1; // increase ExecutedMsgCount + afterState.globalState.u64Vals[0] = beforeState.globalState.u64Vals[0] + 1; // increase MsgCount + afterState.globalState.u64Vals[1] = beforeState.globalState.u64Vals[1] + 1; // increase ExecutedMsgCount afterState.globalState.bytes32Vals[2] = afterMELState.hash(); // update MEL State hash bytes32 expectedAssertionHash = RollupLib.assertionHash({ parentAssertionHash: beforeAssertionHash, @@ -1674,8 +1674,8 @@ contract RollupTest is Test { AssertionState memory afterState; afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.u64Vals[0] += 1; // increase MsgCount - afterState.globalState.u64Vals[1] += 1; // increase ExecutedMsgCount + afterState.globalState.u64Vals[0] = beforeState.globalState.u64Vals[0] + 1; // increase MsgCount + afterState.globalState.u64Vals[1] = beforeState.globalState.u64Vals[1] + 1; // increase ExecutedMsgCount afterState.globalState.bytes32Vals[2] = afterMELState.hash(); // update MEL State hash bytes32 expectedAssertionHash = RollupLib.assertionHash({ parentAssertionHash: beforeAssertionHash, diff --git a/test/signatures/RollupAdminLogic b/test/signatures/RollupAdminLogic index 1bea2fe35..26ed72751 100644 --- a/test/signatures/RollupAdminLogic +++ b/test/signatures/RollupAdminLogic @@ -26,7 +26,7 @@ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | forceConfirmAssertion(bytes32,bytes32,((bytes32[4],uint64[2]),uint8,bytes32)) | e6cf817d | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| forceCreateAssertion(bytes32,((bytes32,bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 8fe07f10 | +| forceCreateAssertion(bytes32,((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 480029b4 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | forceRefundStaker(address[]) | 7c75c298 | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| diff --git a/test/signatures/RollupUserLogic b/test/signatures/RollupUserLogic index 7b36a26c0..8683130ea 100644 --- a/test/signatures/RollupUserLogic +++ b/test/signatures/RollupUserLogic @@ -1,129 +1,129 @@ -╭-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╮ -| Method | Identifier | -+====================================================================================================================================================================================================================================================================================================================+ -| _stakerMap(address) | e8bd4922 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| addToDeposit(address,address,uint256) | 685f5ecc | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| amountStaked(address) | ef40a670 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| anyTrustFastConfirmer() | 55840a58 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| baseStake() | 76e7e23b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| bridge() | e78cea92 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| chainId() | 9a8a0592 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| challengeGracePeriodBlocks() | 3be680ea | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| challengeManager() | 023a96fe | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| computeAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32)) | e05b0a7b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| confirmAssertion(bytes32,bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32,(bytes32,uint256,address,uint64,bytes32)) | 4c10ee51 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| confirmPeriodBlocks() | 2e7acfa6 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| currentMelConfigHash() | 010816fb | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| fastConfirmAssertion(bytes32,bytes32,((bytes32[4],uint64[2]),uint8,bytes32)) | abc4dd38 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| fastConfirmNewAssertion(((bytes32,bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 7f34fd33 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| genesisAssertionHash() | 353325e0 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getAssertion(bytes32) | 88302884 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getAssertionCreationBlockForLogLookup(bytes32) | 13c56ca7 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getFirstChildCreationBlock(bytes32) | 11715585 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getSecondChildCreationBlock(bytes32) | 56bbc9e6 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getStaker(address) | a23c44b1 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getStakerAddress(uint64) | 6ddd3744 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getValidators() | b7ab4db5 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| inbox() | fb0e722b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| initialize(address) | c4d66de8 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isFirstChild(bytes32) | 30836228 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isPending(bytes32) | e531d8c7 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isStaked(address) | 6177fd18 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isValidator(address) | facd743b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| latestConfirmed() | 65f7f80d | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| latestStakedAssertion(address) | 2abdd230 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| loserStakeEscrow() | f065de3f | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| melConfig(bytes32) | 13f1e3fa | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| minimumAssertionPeriod() | 45e38b64 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| newStake(uint256,address) | 68129b14 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| newStakeOnNewAssertion(uint256,((bytes32,bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 7f62c2af | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| newStakeOnNewAssertion(uint256,((bytes32,bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32,address) | efa4cb29 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| outbox() | ce11e6ab | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| owner() | 8da5cb5b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| paused() | 5c975abb | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| proxiableUUID() | 52d1902d | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| reduceDeposit(uint256) | 1e83d30f | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| removeWhitelistAfterFork() | c2c2e68e | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| removeWhitelistAfterValidatorAfk() | 18baaab9 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| returnOldDeposit() | 57ef4ab9 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| returnOldDepositFor(address) | 588c7a16 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| rollupDeploymentBlock() | 1b1689e9 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| rollupEventInbox() | aa38a6e7 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| sequencerInbox() | ee35f327 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| stakeOnNewAssertion(((bytes32,bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 550dc268 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| stakeToken() | 51ed6a30 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| stakerCount() | dff69787 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| totalWithdrawableFunds() | 71ef232c | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validateAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32) | 7e356e9b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validateConfig(bytes32,(bytes32,uint256,address,uint64,bytes32)) | d13666eb | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validatorAfkBlocks() | e6b3082c | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validatorWalletCreator() | bc45e0ae | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validatorWhitelistDisabled() | 12ab3d3b | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| wasmModuleRoot() | 8ee1a126 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| withdrawStakerFunds() | 61373919 | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| withdrawableFunds(address) | 2f30cabd | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| withdrawalAddress(address) | 84728cd0 | -╰-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╯ +╭-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╮ +| Method | Identifier | ++============================================================================================================================================================================================================================================================================================================+ +| _stakerMap(address) | e8bd4922 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| addToDeposit(address,address,uint256) | 685f5ecc | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| amountStaked(address) | ef40a670 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| anyTrustFastConfirmer() | 55840a58 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| baseStake() | 76e7e23b | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| bridge() | e78cea92 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| chainId() | 9a8a0592 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| challengeGracePeriodBlocks() | 3be680ea | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| challengeManager() | 023a96fe | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| computeAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32)) | e05b0a7b | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| confirmAssertion(bytes32,bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32,(bytes32,uint256,address,uint64,bytes32)) | 4c10ee51 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| confirmPeriodBlocks() | 2e7acfa6 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| currentMelConfigHash() | 010816fb | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| fastConfirmAssertion(bytes32,bytes32,((bytes32[4],uint64[2]),uint8,bytes32)) | abc4dd38 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| fastConfirmNewAssertion(((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 25b0542a | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| genesisAssertionHash() | 353325e0 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getAssertion(bytes32) | 88302884 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getAssertionCreationBlockForLogLookup(bytes32) | 13c56ca7 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getFirstChildCreationBlock(bytes32) | 11715585 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getSecondChildCreationBlock(bytes32) | 56bbc9e6 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getStaker(address) | a23c44b1 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getStakerAddress(uint64) | 6ddd3744 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getValidators() | b7ab4db5 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| inbox() | fb0e722b | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| initialize(address) | c4d66de8 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isFirstChild(bytes32) | 30836228 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isPending(bytes32) | e531d8c7 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isStaked(address) | 6177fd18 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isValidator(address) | facd743b | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| latestConfirmed() | 65f7f80d | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| latestStakedAssertion(address) | 2abdd230 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| loserStakeEscrow() | f065de3f | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| melConfig(bytes32) | 13f1e3fa | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| minimumAssertionPeriod() | 45e38b64 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| newStake(uint256,address) | 68129b14 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| newStakeOnNewAssertion(uint256,((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 33b7ea4e | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| newStakeOnNewAssertion(uint256,((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32,address) | 40ee1a08 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| outbox() | ce11e6ab | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| owner() | 8da5cb5b | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| paused() | 5c975abb | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| proxiableUUID() | 52d1902d | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| reduceDeposit(uint256) | 1e83d30f | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| removeWhitelistAfterFork() | c2c2e68e | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| removeWhitelistAfterValidatorAfk() | 18baaab9 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| returnOldDeposit() | 57ef4ab9 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| returnOldDepositFor(address) | 588c7a16 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| rollupDeploymentBlock() | 1b1689e9 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| rollupEventInbox() | aa38a6e7 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| sequencerInbox() | ee35f327 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| stakeOnNewAssertion(((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 123da921 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| stakeToken() | 51ed6a30 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| stakerCount() | dff69787 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| totalWithdrawableFunds() | 71ef232c | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validateAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32) | 7e356e9b | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validateConfig(bytes32,(bytes32,uint256,address,uint64,bytes32)) | d13666eb | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validatorAfkBlocks() | e6b3082c | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validatorWalletCreator() | bc45e0ae | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validatorWhitelistDisabled() | 12ab3d3b | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| wasmModuleRoot() | 8ee1a126 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| withdrawStakerFunds() | 61373919 | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| withdrawableFunds(address) | 2f30cabd | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| withdrawalAddress(address) | 84728cd0 | +╰-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╯ From 0f87aa3c96e72fd934702402580f3654f3e9a819 Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Wed, 10 Jun 2026 15:46:24 +0100 Subject: [PATCH 11/17] Add comment --- src/state/GlobalState.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/state/GlobalState.sol b/src/state/GlobalState.sol index de97090d5..bb338732a 100644 --- a/src/state/GlobalState.sol +++ b/src/state/GlobalState.sol @@ -70,6 +70,8 @@ library GlobalStateLib { return state.u64Vals[1]; } + /// @dev Unused. MELState.msgCount should be used instead whenever possible, but this is left here + /// to mimic nitro's implementation of GlobalState. function getMELMsgCount( GlobalState memory state ) internal pure returns (uint64) { From 73c34673e79568bae6edcf5637ab55305abc9fd3 Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Tue, 28 Jul 2026 12:33:58 +0100 Subject: [PATCH 12/17] Remove deprecated Config.genesisInboxCount --- src/rollup/BOLDUpgradeAction.sol | 1 - src/rollup/Config.sol | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/rollup/BOLDUpgradeAction.sol b/src/rollup/BOLDUpgradeAction.sol index e744c27ad..588a837d1 100644 --- a/src/rollup/BOLDUpgradeAction.sol +++ b/src/rollup/BOLDUpgradeAction.sol @@ -387,7 +387,6 @@ contract BOLDUpgradeAction { layerZeroBigStepEdgeHeight: BIGSTEP_LEAF_SIZE, layerZeroSmallStepEdgeHeight: SMALLSTEP_LEAF_SIZE, genesisAssertionState: genesisAssertionState, - genesisInboxCount: inboxMaxCount, anyTrustFastConfirmer: address(0), // fast confirmer would be migrated from the old rollup if existed numBigStepLevel: NUM_BIGSTEP_LEVEL, challengeGracePeriodBlocks: CHALLENGE_GRACE_PERIOD_BLOCKS, diff --git a/src/rollup/Config.sol b/src/rollup/Config.sol index 5aafe8523..9f9fcff38 100644 --- a/src/rollup/Config.sol +++ b/src/rollup/Config.sol @@ -32,8 +32,6 @@ struct Config { uint256 layerZeroSmallStepEdgeHeight; /// @notice The execution state to be used in the genesis assertion AssertionState genesisAssertionState; - /// @notice The inbox size at the time the genesis execution state was created - uint256 genesisInboxCount; address anyTrustFastConfirmer; uint8 numBigStepLevel; uint64 challengeGracePeriodBlocks; From 503abe4d0b63140983d8fd3f017f0406ddc1957d Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Tue, 28 Jul 2026 12:47:38 +0100 Subject: [PATCH 13/17] Restructure GlobalState --- src/state/Deserialize.sol | 2 +- src/state/GlobalState.sol | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/state/Deserialize.sol b/src/state/Deserialize.sol index 7c7a9ac6e..f0c20ec8b 100644 --- a/src/state/Deserialize.sol +++ b/src/state/Deserialize.sol @@ -241,7 +241,7 @@ library Deserialize { // using constant ints for array size requires newer solidity bytes32[4] memory bytes32Vals; - uint64[2] memory u64Vals; + uint64[4] memory u64Vals; for (uint8 i = 0; i < GlobalStateLib.BYTES32_VALS_NUM; i++) { (bytes32Vals[i], offset) = b32(proof, offset); diff --git a/src/state/GlobalState.sol b/src/state/GlobalState.sol index bb338732a..f8ae7aa5d 100644 --- a/src/state/GlobalState.sol +++ b/src/state/GlobalState.sol @@ -7,16 +7,16 @@ pragma solidity ^0.8.0; struct GlobalState { // BlockHash, SendRoot, MELState hash and NextMsg hash bytes32[4] bytes32Vals; - // TBD: Batch (InboxPosition) and PositionInBatch (PositionInMessage) - // or MsgCount and ExecutedMsgCount - uint64[2] u64Vals; + // Batch (InboxPosition), PositionInBatch (PositionInMessage), -- deprecated after MEL + // MsgCount and ExecutedMsgCount + uint64[4] u64Vals; } library GlobalStateLib { using GlobalStateLib for GlobalState; uint16 internal constant BYTES32_VALS_NUM = 4; - uint16 internal constant U64_VALS_NUM = 2; + uint16 internal constant U64_VALS_NUM = 4; function hash( GlobalState memory state @@ -29,7 +29,9 @@ library GlobalStateLib { state.bytes32Vals[2], state.bytes32Vals[3], state.u64Vals[0], - state.u64Vals[1] + state.u64Vals[1], + state.u64Vals[2], + state.u64Vals[3] ) ); } @@ -75,13 +77,13 @@ library GlobalStateLib { function getMELMsgCount( GlobalState memory state ) internal pure returns (uint64) { - return state.u64Vals[0]; + return state.u64Vals[2]; } function getMELExecutedMsgCount( GlobalState memory state ) internal pure returns (uint64) { - return state.u64Vals[1]; + return state.u64Vals[3]; } function isEmpty( @@ -91,6 +93,7 @@ library GlobalStateLib { state.bytes32Vals[0] == bytes32(0) && state.bytes32Vals[1] == bytes32(0) && state.bytes32Vals[2] == bytes32(0) && state.bytes32Vals[3] == bytes32(0) && state.u64Vals[0] == 0 && state.u64Vals[1] == 0 + && state.u64Vals[2] == 0 && state.u64Vals[3] == 0 ); } From 9fcde182db20b9f2ce9f8f5949c7c74763fb0c81 Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Tue, 28 Jul 2026 12:48:15 +0100 Subject: [PATCH 14/17] Format --- src/state/GlobalState.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/state/GlobalState.sol b/src/state/GlobalState.sol index f8ae7aa5d..c92afe0d9 100644 --- a/src/state/GlobalState.sol +++ b/src/state/GlobalState.sol @@ -92,8 +92,8 @@ library GlobalStateLib { return ( state.bytes32Vals[0] == bytes32(0) && state.bytes32Vals[1] == bytes32(0) && state.bytes32Vals[2] == bytes32(0) && state.bytes32Vals[3] == bytes32(0) - && state.u64Vals[0] == 0 && state.u64Vals[1] == 0 - && state.u64Vals[2] == 0 && state.u64Vals[3] == 0 + && state.u64Vals[0] == 0 && state.u64Vals[1] == 0 && state.u64Vals[2] == 0 + && state.u64Vals[3] == 0 ); } From f9f8931bda5553ac756f7241ac8011b164d90d40 Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Tue, 28 Jul 2026 16:15:18 +0100 Subject: [PATCH 15/17] Update signatures --- test/signatures/EdgeChallengeManager | 2 +- test/signatures/OneStepProofEntry | 2 +- test/signatures/RollupAdminLogic | 298 +++++++++++++-------------- test/signatures/RollupCore | 2 +- test/signatures/RollupCreator | 58 +++--- test/signatures/RollupUserLogic | 16 +- 6 files changed, 189 insertions(+), 189 deletions(-) diff --git a/test/signatures/EdgeChallengeManager b/test/signatures/EdgeChallengeManager index 3642b4c69..55e0ea869 100644 --- a/test/signatures/EdgeChallengeManager +++ b/test/signatures/EdgeChallengeManager @@ -22,7 +22,7 @@ |-----------------------------------------------------------------------------------------------------------------+------------| | confirmEdgeByOneStepProof(bytes32,(bytes32,bytes),(bytes32,uint256,address,uint64,bytes32),bytes32[],bytes32[]) | d863f8ac | |-----------------------------------------------------------------------------------------------------------------+------------| -| confirmEdgeByTime(bytes32,(((bytes32[4],uint64[2]),uint8,bytes32),bytes32)) | 5a7f2fb2 | +| confirmEdgeByTime(bytes32,(((bytes32[4],uint64[4]),uint8,bytes32),bytes32)) | 6011ddde | |-----------------------------------------------------------------------------------------------------------------+------------| | confirmedRival(bytes32) | e5b123da | |-----------------------------------------------------------------------------------------------------------------+------------| diff --git a/test/signatures/OneStepProofEntry b/test/signatures/OneStepProofEntry index 274bb5af6..e2ab42352 100644 --- a/test/signatures/OneStepProofEntry +++ b/test/signatures/OneStepProofEntry @@ -2,7 +2,7 @@ ╭---------------------------------------------------------------+------------╮ | Method | Identifier | +============================================================================+ -| getMachineHash(((bytes32[4],uint64[2]),uint8)) | c0f88fa6 | +| getMachineHash(((bytes32[4],uint64[4]),uint8)) | 43d43807 | |---------------------------------------------------------------+------------| | getStartMachineHash(bytes32,bytes32) | 04997be4 | |---------------------------------------------------------------+------------| diff --git a/test/signatures/RollupAdminLogic b/test/signatures/RollupAdminLogic index 26ed72751..3eb01fb92 100644 --- a/test/signatures/RollupAdminLogic +++ b/test/signatures/RollupAdminLogic @@ -1,151 +1,151 @@ -╭---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╮ -| Method | Identifier | -+==========================================================================================================================================================================================================================================================================================================================================================+ -| _stakerMap(address) | e8bd4922 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| amountStaked(address) | ef40a670 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| anyTrustFastConfirmer() | 55840a58 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| baseStake() | 76e7e23b | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| bridge() | e78cea92 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| chainId() | 9a8a0592 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| challengeGracePeriodBlocks() | 3be680ea | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| challengeManager() | 023a96fe | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| confirmPeriodBlocks() | 2e7acfa6 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| currentMelConfigHash() | 010816fb | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| decreaseBaseStake(uint256,bytes32) | 3d64074a | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| forceConfirmAssertion(bytes32,bytes32,((bytes32[4],uint64[2]),uint8,bytes32)) | e6cf817d | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| forceCreateAssertion(bytes32,((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 480029b4 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| forceRefundStaker(address[]) | 7c75c298 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| genesisAssertionHash() | 353325e0 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getAssertion(bytes32) | 88302884 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getAssertionCreationBlockForLogLookup(bytes32) | 13c56ca7 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getFirstChildCreationBlock(bytes32) | 11715585 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getSecondChildCreationBlock(bytes32) | 56bbc9e6 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getStaker(address) | a23c44b1 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getStakerAddress(uint64) | 6ddd3744 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| getValidators() | b7ab4db5 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| inbox() | fb0e722b | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| increaseBaseStake(uint256) | 8c69f782 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| initialize((uint64,address,uint256,bytes32,address,address,uint256,string,uint256,uint64,uint256[],(uint256,uint256,uint256,uint256),uint256,uint256,uint256,((bytes32[4],uint64[2]),uint8,bytes32),uint256,address,uint8,uint64,(uint64,uint64,uint64),uint256),(address,address,address,address,address,address,address,address,address)) | 94d9dbea | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isFirstChild(bytes32) | 30836228 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isPending(bytes32) | e531d8c7 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isStaked(address) | 6177fd18 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| isValidator(address) | facd743b | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| latestConfirmed() | 65f7f80d | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| latestStakedAssertion(address) | 2abdd230 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| loserStakeEscrow() | f065de3f | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| melConfig(bytes32) | 13f1e3fa | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| minimumAssertionPeriod() | 45e38b64 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| outbox() | ce11e6ab | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| pause() | 8456cb59 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| paused() | 5c975abb | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| proxiableUUID() | 52d1902d | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| removeOldOutbox(address) | 567ca41b | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| resume() | 046f7da2 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| rollupDeploymentBlock() | 1b1689e9 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| rollupEventInbox() | aa38a6e7 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| sequencerInbox() | ee35f327 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setAnyTrustFastConfirmer(address) | 0d561b37 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setChallengeManager(address) | b7626e73 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setConfirmPeriodBlocks(uint64) | ce66d05c | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setDelayedInbox(address,bool) | 47fb24c5 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setInbox(address) | 53b60c4a | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setLoserStakeEscrow(address) | fc8ffa03 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setMELConfig(uint16,address,address) | a96d44ea | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setMinimumAssertionPeriod(uint256) | 948d6588 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setOutbox(address) | ff204f3b | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setOwner(address) | 13af4035 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setSequencerInbox(address) | 4f61f850 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setValidator(address[],bool[]) | a3ffb772 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setValidatorAfkBlocks(uint64) | f112cea3 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setValidatorWhitelistDisabled(bool) | a2b4f1d8 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setWasmModuleRoot(bytes32) | 89384960 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| stakeToken() | 51ed6a30 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| stakerCount() | dff69787 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| totalWithdrawableFunds() | 71ef232c | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| upgradeSecondaryTo(address) | 0d40a0fd | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| upgradeSecondaryToAndCall(address,bytes) | 9846129a | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| upgradeTo(address) | 3659cfe6 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| upgradeToAndCall(address,bytes) | 4f1ef286 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validateAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32) | 7e356e9b | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validateConfig(bytes32,(bytes32,uint256,address,uint64,bytes32)) | d13666eb | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validatorAfkBlocks() | e6b3082c | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validatorWalletCreator() | bc45e0ae | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validatorWhitelistDisabled() | 12ab3d3b | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| wasmModuleRoot() | 8ee1a126 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| withdrawableFunds(address) | 2f30cabd | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| withdrawalAddress(address) | 84728cd0 | -╰---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╯ +╭-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╮ +| Method | Identifier | ++==================================================================================================================================================================================================================================================================================================================================================+ +| _stakerMap(address) | e8bd4922 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| amountStaked(address) | ef40a670 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| anyTrustFastConfirmer() | 55840a58 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| baseStake() | 76e7e23b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| bridge() | e78cea92 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| chainId() | 9a8a0592 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| challengeGracePeriodBlocks() | 3be680ea | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| challengeManager() | 023a96fe | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| confirmPeriodBlocks() | 2e7acfa6 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| currentMelConfigHash() | 010816fb | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| decreaseBaseStake(uint256,bytes32) | 3d64074a | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| forceConfirmAssertion(bytes32,bytes32,((bytes32[4],uint64[4]),uint8,bytes32)) | a837438e | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| forceCreateAssertion(bytes32,((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[4]),uint8,bytes32),((bytes32[4],uint64[4]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | ed966446 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| forceRefundStaker(address[]) | 7c75c298 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| genesisAssertionHash() | 353325e0 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getAssertion(bytes32) | 88302884 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getAssertionCreationBlockForLogLookup(bytes32) | 13c56ca7 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getFirstChildCreationBlock(bytes32) | 11715585 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getSecondChildCreationBlock(bytes32) | 56bbc9e6 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getStaker(address) | a23c44b1 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getStakerAddress(uint64) | 6ddd3744 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| getValidators() | b7ab4db5 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| inbox() | fb0e722b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| increaseBaseStake(uint256) | 8c69f782 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| initialize((uint64,address,uint256,bytes32,address,address,uint256,string,uint256,uint64,uint256[],(uint256,uint256,uint256,uint256),uint256,uint256,uint256,((bytes32[4],uint64[4]),uint8,bytes32),address,uint8,uint64,(uint64,uint64,uint64),uint256),(address,address,address,address,address,address,address,address,address)) | a7a4c703 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isFirstChild(bytes32) | 30836228 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isPending(bytes32) | e531d8c7 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isStaked(address) | 6177fd18 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| isValidator(address) | facd743b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| latestConfirmed() | 65f7f80d | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| latestStakedAssertion(address) | 2abdd230 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| loserStakeEscrow() | f065de3f | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| melConfig(bytes32) | 13f1e3fa | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| minimumAssertionPeriod() | 45e38b64 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| outbox() | ce11e6ab | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| pause() | 8456cb59 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| paused() | 5c975abb | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| proxiableUUID() | 52d1902d | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| removeOldOutbox(address) | 567ca41b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| resume() | 046f7da2 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| rollupDeploymentBlock() | 1b1689e9 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| rollupEventInbox() | aa38a6e7 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| sequencerInbox() | ee35f327 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setAnyTrustFastConfirmer(address) | 0d561b37 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setChallengeManager(address) | b7626e73 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setConfirmPeriodBlocks(uint64) | ce66d05c | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setDelayedInbox(address,bool) | 47fb24c5 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setInbox(address) | 53b60c4a | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setLoserStakeEscrow(address) | fc8ffa03 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setMELConfig(uint16,address,address) | a96d44ea | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setMinimumAssertionPeriod(uint256) | 948d6588 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setOutbox(address) | ff204f3b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setOwner(address) | 13af4035 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setSequencerInbox(address) | 4f61f850 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setValidator(address[],bool[]) | a3ffb772 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setValidatorAfkBlocks(uint64) | f112cea3 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setValidatorWhitelistDisabled(bool) | a2b4f1d8 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setWasmModuleRoot(bytes32) | 89384960 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| stakeToken() | 51ed6a30 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| stakerCount() | dff69787 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| totalWithdrawableFunds() | 71ef232c | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| upgradeSecondaryTo(address) | 0d40a0fd | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| upgradeSecondaryToAndCall(address,bytes) | 9846129a | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| upgradeTo(address) | 3659cfe6 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| upgradeToAndCall(address,bytes) | 4f1ef286 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validateAssertionHash(bytes32,((bytes32[4],uint64[4]),uint8,bytes32),bytes32) | a388abcf | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validateConfig(bytes32,(bytes32,uint256,address,uint64,bytes32)) | d13666eb | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validatorAfkBlocks() | e6b3082c | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validatorWalletCreator() | bc45e0ae | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validatorWhitelistDisabled() | 12ab3d3b | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| wasmModuleRoot() | 8ee1a126 | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| withdrawableFunds(address) | 2f30cabd | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| withdrawalAddress(address) | 84728cd0 | +╰-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╯ diff --git a/test/signatures/RollupCore b/test/signatures/RollupCore index de3dc208a..f8af8217d 100644 --- a/test/signatures/RollupCore +++ b/test/signatures/RollupCore @@ -74,7 +74,7 @@ |-------------------------------------------------------------------------------+------------| | totalWithdrawableFunds() | 71ef232c | |-------------------------------------------------------------------------------+------------| -| validateAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32) | 7e356e9b | +| validateAssertionHash(bytes32,((bytes32[4],uint64[4]),uint8,bytes32),bytes32) | a388abcf | |-------------------------------------------------------------------------------+------------| | validateConfig(bytes32,(bytes32,uint256,address,uint64,bytes32)) | d13666eb | |-------------------------------------------------------------------------------+------------| diff --git a/test/signatures/RollupCreator b/test/signatures/RollupCreator index 201abf38a..40a849ea5 100644 --- a/test/signatures/RollupCreator +++ b/test/signatures/RollupCreator @@ -1,31 +1,31 @@ -╭------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╮ -| Method | Identifier | -+=============================================================================================================================================================================================================================================================================================================================================================+ -| bridgeCreator() | f860cefa | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| challengeManagerTemplate() | 9c683d10 | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| createRollup(((uint64,address,uint256,bytes32,address,address,uint256,string,uint256,uint64,uint256[],(uint256,uint256,uint256,uint256),uint256,uint256,uint256,((bytes32[4],uint64[2]),uint8,bytes32),uint256,address,uint8,uint64,(uint64,uint64,uint64),uint256),address[],uint256,address,bool,uint256,address[],address,address,address)) | a73e3440 | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| l2FactoriesDeployer() | ac0425bc | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| osp() | f26a62c6 | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| owner() | 8da5cb5b | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| renounceOwnership() | 715018a6 | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| rollupAdminLogic() | 9dba3241 | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| rollupUserLogic() | 9d4798e3 | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| setTemplates(address,address,address,address,address,address,address,address) | f0dae494 | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| transferOwnership(address) | f2fde38b | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| upgradeExecutorLogic() | 030cb85e | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validatorWalletCreator() | bc45e0ae | -╰------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╯ +╭----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╮ +| Method | Identifier | ++=====================================================================================================================================================================================================================================================================================================================================================+ +| bridgeCreator() | f860cefa | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| challengeManagerTemplate() | 9c683d10 | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| createRollup(((uint64,address,uint256,bytes32,address,address,uint256,string,uint256,uint64,uint256[],(uint256,uint256,uint256,uint256),uint256,uint256,uint256,((bytes32[4],uint64[4]),uint8,bytes32),address,uint8,uint64,(uint64,uint64,uint64),uint256),address[],uint256,address,bool,uint256,address[],address,address,address)) | b1a1f5eb | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| l2FactoriesDeployer() | ac0425bc | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| osp() | f26a62c6 | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| owner() | 8da5cb5b | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| renounceOwnership() | 715018a6 | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| rollupAdminLogic() | 9dba3241 | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| rollupUserLogic() | 9d4798e3 | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| setTemplates(address,address,address,address,address,address,address,address) | f0dae494 | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| transferOwnership(address) | f2fde38b | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| upgradeExecutorLogic() | 030cb85e | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| +| validatorWalletCreator() | bc45e0ae | +╰----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------╯ diff --git a/test/signatures/RollupUserLogic b/test/signatures/RollupUserLogic index 8683130ea..ff21d5d76 100644 --- a/test/signatures/RollupUserLogic +++ b/test/signatures/RollupUserLogic @@ -20,17 +20,17 @@ |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | challengeManager() | 023a96fe | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| computeAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32)) | e05b0a7b | +| computeAssertionHash(bytes32,((bytes32[4],uint64[4]),uint8,bytes32)) | 03717f65 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| confirmAssertion(bytes32,bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32,(bytes32,uint256,address,uint64,bytes32)) | 4c10ee51 | +| confirmAssertion(bytes32,bytes32,((bytes32[4],uint64[4]),uint8,bytes32),bytes32,(bytes32,uint256,address,uint64,bytes32)) | 81f1ab20 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | confirmPeriodBlocks() | 2e7acfa6 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | currentMelConfigHash() | 010816fb | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| fastConfirmAssertion(bytes32,bytes32,((bytes32[4],uint64[2]),uint8,bytes32)) | abc4dd38 | +| fastConfirmAssertion(bytes32,bytes32,((bytes32[4],uint64[4]),uint8,bytes32)) | edecdc10 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| fastConfirmNewAssertion(((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 25b0542a | +| fastConfirmNewAssertion(((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[4]),uint8,bytes32),((bytes32[4],uint64[4]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 5c240d40 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | genesisAssertionHash() | 353325e0 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| @@ -72,9 +72,9 @@ |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | newStake(uint256,address) | 68129b14 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| newStakeOnNewAssertion(uint256,((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 33b7ea4e | +| newStakeOnNewAssertion(uint256,((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[4]),uint8,bytes32),((bytes32[4],uint64[4]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | f646be65 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| newStakeOnNewAssertion(uint256,((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32,address) | 40ee1a08 | +| newStakeOnNewAssertion(uint256,((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[4]),uint8,bytes32),((bytes32[4],uint64[4]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32,address) | 1af91acb | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | outbox() | ce11e6ab | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| @@ -100,7 +100,7 @@ |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | sequencerInbox() | ee35f327 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| stakeOnNewAssertion(((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[2]),uint8,bytes32),((bytes32[4],uint64[2]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | 123da921 | +| stakeOnNewAssertion(((bytes32,(bytes32,uint256,address,uint64,bytes32)),((bytes32[4],uint64[4]),uint8,bytes32),((bytes32[4],uint64[4]),uint8,bytes32),(uint16,uint64,uint64,address,address,bytes32,bytes32,uint64,uint64,bytes32,uint64,uint64,bytes32,bytes32)),bytes32) | c6a97b27 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | stakeToken() | 51ed6a30 | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| @@ -108,7 +108,7 @@ |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | totalWithdrawableFunds() | 71ef232c | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| -| validateAssertionHash(bytes32,((bytes32[4],uint64[2]),uint8,bytes32),bytes32) | 7e356e9b | +| validateAssertionHash(bytes32,((bytes32[4],uint64[4]),uint8,bytes32),bytes32) | a388abcf | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| | validateConfig(bytes32,(bytes32,uint256,address,uint64,bytes32)) | d13666eb | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------| From 0c89c6cadf646ef7a59d71e68cadfb084d219f4e Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Tue, 28 Jul 2026 16:27:45 +0100 Subject: [PATCH 16/17] Fix tests --- test/foundry/Rollup.t.sol | 27 ++++++++++++++------------- test/foundry/RollupCreator.t.sol | 3 +-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/foundry/Rollup.t.sol b/test/foundry/Rollup.t.sol index 9a7dde8a0..d8ec1d313 100644 --- a/test/foundry/Rollup.t.sol +++ b/test/foundry/Rollup.t.sol @@ -185,7 +185,6 @@ contract RollupTest is Test { wasmModuleRoot: WASM_MODULE_ROOT, loserStakeEscrow: loserStakeEscrow, genesisAssertionState: genesisAssertionState, - genesisInboxCount: 0, miniStakeValues: miniStakeValues, layerZeroBlockEdgeHeight: 2 ** 5, layerZeroBigStepEdgeHeight: 2 ** 5, @@ -318,8 +317,10 @@ contract RollupTest is Test { assertionState.globalState.bytes32Vals[1] = FIRST_ASSERTION_SENDROOT; // Sendroot assertionState.globalState.bytes32Vals[2] = melState.hash(); // MELState hash assertionState.globalState.bytes32Vals[3] = bytes32(0); // MEL NextMsgHash - assertionState.globalState.u64Vals[0] = INITIAL_MSG_COUNT; // MsgCount - assertionState.globalState.u64Vals[1] = INITIAL_MSG_COUNT; // ExecutedMsgCount + assertionState.globalState.u64Vals[0] = 0; // InboxPosition (deprecated) + assertionState.globalState.u64Vals[1] = 0; // PositionInMessage (deprecated) + assertionState.globalState.u64Vals[2] = INITIAL_MSG_COUNT; // MsgCount + assertionState.globalState.u64Vals[3] = INITIAL_MSG_COUNT; // ExecutedMsgCount return (assertionState, melState); } @@ -640,8 +641,8 @@ contract RollupTest is Test { AssertionState memory afterState; afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.u64Vals[0] += 1; // increase MsgCount - afterState.globalState.u64Vals[1] += 1; // increase ExecutedMsgCount + afterState.globalState.u64Vals[2] += 1; // increase MsgCount + afterState.globalState.u64Vals[3] += 1; // increase ExecutedMsgCount afterState.globalState.bytes32Vals[2] = afterMELState.hash(); // MEL State hash bytes32 expectedAssertionHash = RollupLib.assertionHash({parentAssertionHash: assertionHash, afterState: afterState}); @@ -1240,8 +1241,8 @@ contract RollupTest is Test { AssertionState memory afterState; afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.u64Vals[0] = beforeState.globalState.u64Vals[0] + 1; // increase MsgCount - afterState.globalState.u64Vals[1] = beforeState.globalState.u64Vals[1] + 1; // increase ExecutedMsgCount + afterState.globalState.u64Vals[2] = beforeState.globalState.u64Vals[2] + 1; // increase MsgCount + afterState.globalState.u64Vals[3] = beforeState.globalState.u64Vals[3] + 1; // increase ExecutedMsgCount afterState.globalState.bytes32Vals[2] = afterMELState.hash(); // update MEL State hash bytes32 expectedAssertionHash = RollupLib.assertionHash({ parentAssertionHash: beforeAssertionHash, @@ -1299,8 +1300,8 @@ contract RollupTest is Test { AssertionState memory afterState; afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.u64Vals[0] = beforeState.globalState.u64Vals[0] + 1; // increase MsgCount - afterState.globalState.u64Vals[1] = beforeState.globalState.u64Vals[1] + 1; // increase ExecutedMsgCount + afterState.globalState.u64Vals[2] = beforeState.globalState.u64Vals[2] + 1; // increase MsgCount + afterState.globalState.u64Vals[3] = beforeState.globalState.u64Vals[3] + 1; // increase ExecutedMsgCount afterState.globalState.bytes32Vals[2] = afterMELState.hash(); // update MEL State hash bytes32 expectedAssertionHash = RollupLib.assertionHash({ parentAssertionHash: beforeAssertionHash, @@ -1586,7 +1587,7 @@ contract RollupTest is Test { AssertionState memory astate = AssertionState( GlobalState( [rand.hash(), rand.hash(), rand.hash(), rand.hash()], - [uint64(uint256(rand.hash())), uint64(uint256(rand.hash()))] + [0, 0, uint64(uint256(rand.hash())), uint64(uint256(rand.hash()))] ), MachineStatus.FINISHED, bytes32(0) @@ -1600,7 +1601,7 @@ contract RollupTest is Test { AssertionState memory astate = AssertionState( GlobalState( [rand.hash(), rand.hash(), rand.hash(), rand.hash()], - [uint64(uint256(rand.hash())), uint64(uint256(rand.hash()))] + [0, 0, uint64(uint256(rand.hash())), uint64(uint256(rand.hash()))] ), MachineStatus.FINISHED, bytes32(0) @@ -1674,8 +1675,8 @@ contract RollupTest is Test { AssertionState memory afterState; afterState.machineStatus = MachineStatus.FINISHED; - afterState.globalState.u64Vals[0] = beforeState.globalState.u64Vals[0] + 1; // increase MsgCount - afterState.globalState.u64Vals[1] = beforeState.globalState.u64Vals[1] + 1; // increase ExecutedMsgCount + afterState.globalState.u64Vals[2] = beforeState.globalState.u64Vals[2] + 1; // increase MsgCount + afterState.globalState.u64Vals[3] = beforeState.globalState.u64Vals[3] + 1; // increase ExecutedMsgCount afterState.globalState.bytes32Vals[2] = afterMELState.hash(); // update MEL State hash bytes32 expectedAssertionHash = RollupLib.assertionHash({ parentAssertionHash: beforeAssertionHash, diff --git a/test/foundry/RollupCreator.t.sol b/test/foundry/RollupCreator.t.sol index 94286e7fd..9a2cbfcf7 100644 --- a/test/foundry/RollupCreator.t.sol +++ b/test/foundry/RollupCreator.t.sol @@ -99,7 +99,7 @@ contract RollupCreatorTest is Test { miniStakeValues[1] = 2 ether; miniStakeValues[2] = 3 ether; AssertionState memory emptyState = AssertionState( - GlobalState([bytes32(0), bytes32(0), bytes32(0), bytes32(0)], [uint64(0), uint64(0)]), + GlobalState([bytes32(0), bytes32(0), bytes32(0), bytes32(0)], [uint64(0), uint64(0), uint64(0), uint64(0)]), MachineStatus.FINISHED, bytes32(0) ); @@ -116,7 +116,6 @@ contract RollupCreatorTest is Test { wasmModuleRoot: keccak256("wasm"), loserStakeEscrow: address(200), genesisAssertionState: emptyState, - genesisInboxCount: 0, miniStakeValues: miniStakeValues, layerZeroBlockEdgeHeight: 2 ** 5, layerZeroBigStepEdgeHeight: 2 ** 5, From 55410240d87dffe1784fde0b3fecbbd4eea3291d Mon Sep 17 00:00:00 2001 From: TucksonDev Date: Tue, 28 Jul 2026 16:28:12 +0100 Subject: [PATCH 17/17] Format --- test/foundry/RollupCreator.t.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/foundry/RollupCreator.t.sol b/test/foundry/RollupCreator.t.sol index 9a2cbfcf7..66867ba2d 100644 --- a/test/foundry/RollupCreator.t.sol +++ b/test/foundry/RollupCreator.t.sol @@ -99,7 +99,10 @@ contract RollupCreatorTest is Test { miniStakeValues[1] = 2 ether; miniStakeValues[2] = 3 ether; AssertionState memory emptyState = AssertionState( - GlobalState([bytes32(0), bytes32(0), bytes32(0), bytes32(0)], [uint64(0), uint64(0), uint64(0), uint64(0)]), + GlobalState( + [bytes32(0), bytes32(0), bytes32(0), bytes32(0)], + [uint64(0), uint64(0), uint64(0), uint64(0)] + ), MachineStatus.FINISHED, bytes32(0) );