diff --git a/.github/workflows/contract-tests.yml b/.github/workflows/contract-tests.yml index 2835c5d2..5637607f 100644 --- a/.github/workflows/contract-tests.yml +++ b/.github/workflows/contract-tests.yml @@ -88,6 +88,9 @@ jobs: - name: Test Storage Layouts run: yarn run test:storage + - name: Test function signatures + run: yarn run test:signatures + - name: Run coverage run: yarn hardhat coverage --testfiles "test/contract/*.spec.ts" diff --git a/.gitignore b/.gitignore index 6de9a1bc..62617e35 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ deployments/ /test/prover/proofs/*.json /test/prover/spec-proofs/*.json /test/storage/*-old +/test/signatures/*-old scripts/config.ts forge-cache/ out/ diff --git a/package.json b/package.json index 9680ebe5..475926f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@arbitrum/nitro-contracts", - "version": "1.2.0", + "version": "1.2.1", "description": "Layer 2 precompiles and rollup for Arbitrum Nitro", "author": "Offchain Labs, Inc.", "license": "BUSL-1.1", @@ -11,7 +11,8 @@ "files": [ "src/", "build/contracts/src", - "build/contracts/@openzeppelin" + "build/contracts/@openzeppelin", + "out/yul/Reader4844.yul/Reader4844.json" ], "bugs": { "url": "https://github.com/offchainlabs/nitro-contracts/issues" @@ -19,7 +20,7 @@ "scripts": { "audit:ci": "audit-ci --config ./audit-ci.jsonc", "audit:fix": "yarn-audit-fix", - "prepublishOnly": "hardhat clean && hardhat compile", + "prepublishOnly": "hardhat clean && forge clean && hardhat compile && yarn build:forge:yul", "build:all": "yarn build && yarn build:forge", "build": "hardhat compile", "build:forge:sol": "forge build --skip *.yul", @@ -35,6 +36,7 @@ "test:4844": "DISABLE_GAS_REPORTER=true hardhat --network hardhat test test/contract/*.spec.4844.ts", "test:compatibility": "yarn run build:0.6 && yarn run build:0.7", "test:storage": "./test/storage/test.bash", + "test:signatures": "./test/signatures/test-sigs.bash", "test:e2e": "hardhat test test/e2e/*.ts", "postinstall": "patch-package", "deploy-factory": "hardhat run scripts/deployment.ts", diff --git a/scripts/deployment.ts b/scripts/deployment.ts index 01162c55..fdb51877 100644 --- a/scripts/deployment.ts +++ b/scripts/deployment.ts @@ -1,163 +1,6 @@ import { ethers } from 'hardhat' -import { ContractFactory, Contract } from 'ethers' import '@nomiclabs/hardhat-ethers' -import { run } from 'hardhat' -import { - abi as UpgradeExecutorABI, - bytecode as UpgradeExecutorBytecode, -} from '@offchainlabs/upgrade-executor/build/contracts/src/UpgradeExecutor.sol/UpgradeExecutor.json' -import { maxDataSize } from './config' - -// Define a verification function -async function verifyContract( - contractName: string, - contractAddress: string, - constructorArguments: any[] = [], - contractPathAndName?: string // optional -): Promise { - try { - if (process.env.DISABLE_VERIFICATION) return - // Define the verification options with possible 'contract' property - const verificationOptions: { - contract?: string - address: string - constructorArguments: any[] - } = { - address: contractAddress, - constructorArguments: constructorArguments, - } - - // if contractPathAndName is provided, add it to the verification options - if (contractPathAndName) { - verificationOptions.contract = contractPathAndName - } - - await run('verify:verify', verificationOptions) - console.log(`Verified contract ${contractName} successfully.`) - } catch (error: any) { - if (error.message.includes('Already Verified')) { - console.log(`Contract ${contractName} is already verified.`) - } else { - console.error( - `Verification for ${contractName} failed with the following error: ${error.message}` - ) - } - } -} - -// Function to handle contract deployment -async function deployContract( - contractName: string, - signer: any, - constructorArgs: any[] = [], - verify: boolean = true -): Promise { - const factory: ContractFactory = await ethers.getContractFactory(contractName) - const connectedFactory: ContractFactory = factory.connect(signer) - const contract: Contract = await connectedFactory.deploy(...constructorArgs) - await contract.deployTransaction.wait() - console.log(`New ${contractName} created at address:`, contract.address) - - if (verify) - await verifyContract(contractName, contract.address, constructorArgs) - - return contract -} - -// Deploy upgrade executor from imported bytecode -async function deployUpgradeExecutor(): Promise { - const upgradeExecutorFac = await ethers.getContractFactory( - UpgradeExecutorABI, - UpgradeExecutorBytecode - ) - const upgradeExecutor = await upgradeExecutorFac.deploy() - return upgradeExecutor -} - -// Function to handle all deployments of core contracts using deployContract function -async function deployAllContracts( - signer: any -): Promise> { - const ethBridge = await deployContract('Bridge', signer, []) - const ethSequencerInbox = await deployContract('SequencerInbox', signer, [ - maxDataSize, - false, - ]) - const ethInbox = await deployContract('Inbox', signer, [maxDataSize]) - const ethRollupEventInbox = await deployContract( - 'RollupEventInbox', - signer, - [] - ) - const ethOutbox = await deployContract('Outbox', signer, []) - - const erc20Bridge = await deployContract('ERC20Bridge', signer, []) - const erc20SequencerInbox = await deployContract('SequencerInbox', signer, [ - maxDataSize, - true, - ]) - const erc20Inbox = await deployContract('ERC20Inbox', signer, [maxDataSize]) - const erc20RollupEventInbox = await deployContract( - 'ERC20RollupEventInbox', - signer, - [] - ) - const erc20Outbox = await deployContract('ERC20Outbox', signer, []) - - const bridgeCreator = await deployContract('BridgeCreator', signer, [ - [ - ethBridge.address, - ethSequencerInbox.address, - ethInbox.address, - ethRollupEventInbox.address, - ethOutbox.address, - ], - [ - erc20Bridge.address, - erc20SequencerInbox.address, - erc20Inbox.address, - erc20RollupEventInbox.address, - erc20Outbox.address, - ], - ]) - const prover0 = await deployContract('OneStepProver0', signer) - const proverMem = await deployContract('OneStepProverMemory', signer) - const proverMath = await deployContract('OneStepProverMath', signer) - const proverHostIo = await deployContract('OneStepProverHostIo', signer) - const osp: Contract = await deployContract('OneStepProofEntry', signer, [ - prover0.address, - proverMem.address, - proverMath.address, - proverHostIo.address, - ]) - const challengeManager = await deployContract('ChallengeManager', signer) - const rollupAdmin = await deployContract('RollupAdminLogic', signer) - const rollupUser = await deployContract('RollupUserLogic', signer) - const upgradeExecutor = await deployUpgradeExecutor() - const validatorUtils = await deployContract('ValidatorUtils', signer) - const validatorWalletCreator = await deployContract( - 'ValidatorWalletCreator', - signer - ) - const rollupCreator = await deployContract('RollupCreator', signer) - const deployHelper = await deployContract('DeployHelper', signer) - return { - bridgeCreator, - prover0, - proverMem, - proverMath, - proverHostIo, - osp, - challengeManager, - rollupAdmin, - rollupUser, - upgradeExecutor, - validatorUtils, - validatorWalletCreator, - rollupCreator, - deployHelper, - } -} +import { deployAllContracts } from './deploymentUtils' async function main() { const [signer] = await ethers.getSigners() diff --git a/scripts/deploymentUtils.ts b/scripts/deploymentUtils.ts new file mode 100644 index 00000000..2df51be6 --- /dev/null +++ b/scripts/deploymentUtils.ts @@ -0,0 +1,191 @@ +import { ethers } from 'hardhat' +import { ContractFactory, Contract, Overrides } from 'ethers' +import '@nomiclabs/hardhat-ethers' +import { run } from 'hardhat' +import { + abi as UpgradeExecutorABI, + bytecode as UpgradeExecutorBytecode, +} from '@offchainlabs/upgrade-executor/build/contracts/src/UpgradeExecutor.sol/UpgradeExecutor.json' +import { maxDataSize } from './config' +import { Toolkit4844 } from '../test/contract/toolkit4844' +import { ArbSys__factory } from '../build/types' +import { ARB_SYS_ADDRESS } from '@arbitrum/sdk/dist/lib/dataEntities/constants' + +// Define a verification function +export async function verifyContract( + contractName: string, + contractAddress: string, + constructorArguments: any[] = [], + contractPathAndName?: string // optional +): Promise { + try { + if (process.env.DISABLE_VERIFICATION) return + // Define the verification options with possible 'contract' property + const verificationOptions: { + contract?: string + address: string + constructorArguments: any[] + } = { + address: contractAddress, + constructorArguments: constructorArguments, + } + + // if contractPathAndName is provided, add it to the verification options + if (contractPathAndName) { + verificationOptions.contract = contractPathAndName + } + + await run('verify:verify', verificationOptions) + console.log(`Verified contract ${contractName} successfully.`) + } catch (error: any) { + if (error.message.includes('Already Verified')) { + console.log(`Contract ${contractName} is already verified.`) + } else { + console.error( + `Verification for ${contractName} failed with the following error: ${error.message}` + ) + } + } +} + +// Function to handle contract deployment +export async function deployContract( + contractName: string, + signer: any, + constructorArgs: any[] = [], + verify: boolean = true, + overrides?: Overrides +): Promise { + const factory: ContractFactory = await ethers.getContractFactory(contractName) + const connectedFactory: ContractFactory = factory.connect(signer) + + let deploymentArgs = [...constructorArgs] + if (overrides) { + deploymentArgs.push(overrides) + } + + const contract: Contract = await connectedFactory.deploy(...deploymentArgs) + await contract.deployTransaction.wait() + console.log(`New ${contractName} created at address:`, contract.address) + + if (verify) + await verifyContract(contractName, contract.address, constructorArgs) + + return contract +} + +// Deploy upgrade executor from imported bytecode +export async function deployUpgradeExecutor(signer: any): Promise { + const upgradeExecutorFac = await ethers.getContractFactory( + UpgradeExecutorABI, + UpgradeExecutorBytecode + ) + const connectedFactory: ContractFactory = upgradeExecutorFac.connect(signer) + const upgradeExecutor = await connectedFactory.deploy() + return upgradeExecutor +} + +// Function to handle all deployments of core contracts using deployContract function +export async function deployAllContracts( + signer: any +): Promise> { + const isOnArb = await _isRunningOnArbitrum(signer) + + const ethBridge = await deployContract('Bridge', signer, []) + const reader4844 = isOnArb + ? ethers.constants.AddressZero + : (await Toolkit4844.deployReader4844(signer)).address + + const ethSequencerInbox = await deployContract('SequencerInbox', signer, [ + maxDataSize, + reader4844, + false, + ]) + + const ethInbox = await deployContract('Inbox', signer, [maxDataSize]) + const ethRollupEventInbox = await deployContract( + 'RollupEventInbox', + signer, + [] + ) + const ethOutbox = await deployContract('Outbox', signer, []) + + const erc20Bridge = await deployContract('ERC20Bridge', signer, []) + const erc20SequencerInbox = await deployContract('SequencerInbox', signer, [ + maxDataSize, + reader4844, + true, + ]) + const erc20Inbox = await deployContract('ERC20Inbox', signer, [maxDataSize]) + const erc20RollupEventInbox = await deployContract( + 'ERC20RollupEventInbox', + signer, + [] + ) + const erc20Outbox = await deployContract('ERC20Outbox', signer, []) + + const bridgeCreator = await deployContract('BridgeCreator', signer, [ + [ + ethBridge.address, + ethSequencerInbox.address, + ethInbox.address, + ethRollupEventInbox.address, + ethOutbox.address, + ], + [ + erc20Bridge.address, + erc20SequencerInbox.address, + erc20Inbox.address, + erc20RollupEventInbox.address, + erc20Outbox.address, + ], + ]) + const prover0 = await deployContract('OneStepProver0', signer) + const proverMem = await deployContract('OneStepProverMemory', signer) + const proverMath = await deployContract('OneStepProverMath', signer) + const proverHostIo = await deployContract('OneStepProverHostIo', signer) + const osp: Contract = await deployContract('OneStepProofEntry', signer, [ + prover0.address, + proverMem.address, + proverMath.address, + proverHostIo.address, + ]) + const challengeManager = await deployContract('ChallengeManager', signer) + const rollupAdmin = await deployContract('RollupAdminLogic', signer) + const rollupUser = await deployContract('RollupUserLogic', signer) + const upgradeExecutor = await deployUpgradeExecutor(signer) + const validatorUtils = await deployContract('ValidatorUtils', signer) + const validatorWalletCreator = await deployContract( + 'ValidatorWalletCreator', + signer + ) + const rollupCreator = await deployContract('RollupCreator', signer) + const deployHelper = await deployContract('DeployHelper', signer) + return { + bridgeCreator, + prover0, + proverMem, + proverMath, + proverHostIo, + osp, + challengeManager, + rollupAdmin, + rollupUser, + upgradeExecutor, + validatorUtils, + validatorWalletCreator, + rollupCreator, + deployHelper, + } +} + +// Check if we're deploying to an Arbitrum chain +async function _isRunningOnArbitrum(signer: any): Promise { + const arbSys = ArbSys__factory.connect(ARB_SYS_ADDRESS, signer) + try { + await arbSys.arbOSVersion() + return true + } catch (error) { + return false + } +} diff --git a/scripts/upgrade/deploy4844.ts b/scripts/upgrade/deploy4844.ts new file mode 100644 index 00000000..986636e5 --- /dev/null +++ b/scripts/upgrade/deploy4844.ts @@ -0,0 +1,107 @@ +import { ethers } from 'hardhat' +import { ContractFactory, Contract, Overrides } from 'ethers' +import '@nomiclabs/hardhat-ethers' +import { IReader4844__factory } from '../../build/types' +import { bytecode as Reader4844Bytecode } from '../../out/yul/Reader4844.yul/Reader4844.json' +import { deployContract, verifyContract } from '../deploymentUtils' +import { maxDataSize, isUsingFeeToken } from '../config' + +async function main() { + const [signer] = await ethers.getSigners() + const overrides: Overrides = { + maxFeePerGas: ethers.utils.parseUnits('30', 'gwei'), + maxPriorityFeePerGas: ethers.utils.parseUnits('0.001', 'gwei'), + } + + const contractFactory = new ContractFactory( + IReader4844__factory.abi, + Reader4844Bytecode, + signer + ) + const reader4844 = await contractFactory.deploy(overrides) + await reader4844.deployed() + console.log(`Reader4844 deployed at ${reader4844.address}`) + + // skip verification on deployment + const sequencerInbox = await deployContract( + 'SequencerInbox', + signer, + [maxDataSize, reader4844.address, isUsingFeeToken], + false, + overrides + ) + // SequencerInbox logic do not need to be initialized + const prover0 = await deployContract( + 'OneStepProver0', + signer, + [], + false, + overrides + ) + const proverMem = await deployContract( + 'OneStepProverMemory', + signer, + [], + false, + overrides + ) + const proverMath = await deployContract( + 'OneStepProverMath', + signer, + [], + false, + overrides + ) + const proverHostIo = await deployContract( + 'OneStepProverHostIo', + signer, + [], + false, + overrides + ) + const osp: Contract = await deployContract( + 'OneStepProofEntry', + signer, + [ + prover0.address, + proverMem.address, + proverMath.address, + proverHostIo.address, + ], + false, + overrides + ) + const challengeManager = await deployContract( + 'ChallengeManager', + signer, + [], + false, + overrides + ) + // ChallengeManager logic do not need to be initialized + + // verify + await verifyContract('SequencerInbox', sequencerInbox.address, [ + maxDataSize, + reader4844.address, + isUsingFeeToken, + ]) + await verifyContract('OneStepProver0', prover0.address, []) + await verifyContract('OneStepProverMemory', proverMem.address, []) + await verifyContract('OneStepProverMath', proverMath.address, []) + await verifyContract('OneStepProverHostIo', proverHostIo.address, []) + await verifyContract('OneStepProofEntry', osp.address, [ + prover0.address, + proverMem.address, + proverMath.address, + proverHostIo.address, + ]) + await verifyContract('ChallengeManager', challengeManager.address, []) +} + +main() + .then(() => process.exit(0)) + .catch((error: Error) => { + console.error(error) + process.exit(1) + }) diff --git a/src/bridge/ISequencerInbox.sol b/src/bridge/ISequencerInbox.sol index 45f2028e..47db30f0 100644 --- a/src/bridge/ISequencerInbox.sol +++ b/src/bridge/ISequencerInbox.sol @@ -12,10 +12,10 @@ import "./IBridge.sol"; interface ISequencerInbox is IDelayedMessageProvider { struct MaxTimeVariation { - uint64 delayBlocks; - uint64 futureBlocks; - uint64 delaySeconds; - uint64 futureSeconds; + uint256 delayBlocks; + uint256 futureBlocks; + uint256 delaySeconds; + uint256 futureSeconds; } event SequencerBatchDelivered( diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index 58249dae..16a65e77 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -10,7 +10,6 @@ import { BadPostUpgradeInit, NotOrigin, DataTooLarge, - NotRollup, DelayedBackwards, DelayedTooFar, ForceIncludeBlockTooSoon, @@ -18,7 +17,6 @@ import { IncorrectMessagePreimage, NotBatchPoster, BadSequencerNumber, - DataNotAuthenticated, AlreadyValidDASKeyset, NoSuchKeyset, NotForked, @@ -27,12 +25,10 @@ import { DataBlobsNotSupported, InitParamZero, MissingDataHashes, - InvalidBlobMetadata, NotOwner, - RollupNotChanged, - EmptyBatchData, InvalidHeaderFlag, NativeTokenMismatch, + BadMaxTimeVariation, Deprecated } from "../libraries/Error.sol"; import "./IBridge.sol"; @@ -93,7 +89,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox // we previously stored the max time variation in a (uint,uint,uint,uint) struct here // solhint-disable-next-line var-name-mixedcase - uint256[4] private __LEGACY_MAX_TIME_VARIATION; + ISequencerInbox.MaxTimeVariation private __LEGACY_MAX_TIME_VARIATION; mapping(bytes32 => DasKeySetInfo) public dasKeySetInfo; @@ -152,32 +148,32 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox // Assuming we would not upgrade from a version that have MaxTimeVariation all set to zero // If that is the case, postUpgradeInit do not need to be called if ( - __LEGACY_MAX_TIME_VARIATION[0] == 0 && - __LEGACY_MAX_TIME_VARIATION[1] == 0 && - __LEGACY_MAX_TIME_VARIATION[2] == 0 && - __LEGACY_MAX_TIME_VARIATION[3] == 0 + __LEGACY_MAX_TIME_VARIATION.delayBlocks == 0 && + __LEGACY_MAX_TIME_VARIATION.futureBlocks == 0 && + __LEGACY_MAX_TIME_VARIATION.delaySeconds == 0 && + __LEGACY_MAX_TIME_VARIATION.futureSeconds == 0 ) { revert AlreadyInit(); } if ( - __LEGACY_MAX_TIME_VARIATION[0] > type(uint64).max || - __LEGACY_MAX_TIME_VARIATION[1] > type(uint64).max || - __LEGACY_MAX_TIME_VARIATION[2] > type(uint64).max || - __LEGACY_MAX_TIME_VARIATION[3] > type(uint64).max + __LEGACY_MAX_TIME_VARIATION.delayBlocks > type(uint64).max || + __LEGACY_MAX_TIME_VARIATION.futureBlocks > type(uint64).max || + __LEGACY_MAX_TIME_VARIATION.delaySeconds > type(uint64).max || + __LEGACY_MAX_TIME_VARIATION.futureSeconds > type(uint64).max ) { revert BadPostUpgradeInit(); } - delayBlocks = uint64(__LEGACY_MAX_TIME_VARIATION[0]); - futureBlocks = uint64(__LEGACY_MAX_TIME_VARIATION[1]); - delaySeconds = uint64(__LEGACY_MAX_TIME_VARIATION[2]); - futureSeconds = uint64(__LEGACY_MAX_TIME_VARIATION[3]); + delayBlocks = uint64(__LEGACY_MAX_TIME_VARIATION.delayBlocks); + futureBlocks = uint64(__LEGACY_MAX_TIME_VARIATION.futureBlocks); + delaySeconds = uint64(__LEGACY_MAX_TIME_VARIATION.delaySeconds); + futureSeconds = uint64(__LEGACY_MAX_TIME_VARIATION.futureSeconds); - __LEGACY_MAX_TIME_VARIATION[0] = 0; - __LEGACY_MAX_TIME_VARIATION[1] = 0; - __LEGACY_MAX_TIME_VARIATION[2] = 0; - __LEGACY_MAX_TIME_VARIATION[3] = 0; + __LEGACY_MAX_TIME_VARIATION.delayBlocks = 0; + __LEGACY_MAX_TIME_VARIATION.futureBlocks = 0; + __LEGACY_MAX_TIME_VARIATION.delaySeconds = 0; + __LEGACY_MAX_TIME_VARIATION.futureSeconds = 0; } function initialize( @@ -201,10 +197,8 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox bridge = bridge_; rollup = bridge_.rollup(); - delayBlocks = maxTimeVariation_.delayBlocks; - futureBlocks = maxTimeVariation_.futureBlocks; - delaySeconds = maxTimeVariation_.delaySeconds; - futureSeconds = maxTimeVariation_.futureSeconds; + + _setMaxTimeVariation(maxTimeVariation_); } /// @notice Allows the rollup owner to sync the rollup address @@ -718,15 +712,29 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox return bridge.sequencerMessageCount(); } + function _setMaxTimeVariation(ISequencerInbox.MaxTimeVariation memory maxTimeVariation_) + internal + { + if ( + maxTimeVariation_.delayBlocks > type(uint64).max || + maxTimeVariation_.futureBlocks > type(uint64).max || + maxTimeVariation_.delaySeconds > type(uint64).max || + maxTimeVariation_.futureSeconds > type(uint64).max + ) { + revert BadMaxTimeVariation(); + } + delayBlocks = uint64(maxTimeVariation_.delayBlocks); + futureBlocks = uint64(maxTimeVariation_.futureBlocks); + delaySeconds = uint64(maxTimeVariation_.delaySeconds); + futureSeconds = uint64(maxTimeVariation_.futureSeconds); + } + /// @inheritdoc ISequencerInbox function setMaxTimeVariation(ISequencerInbox.MaxTimeVariation memory maxTimeVariation_) external onlyRollupOwner { - delayBlocks = maxTimeVariation_.delayBlocks; - futureBlocks = maxTimeVariation_.futureBlocks; - delaySeconds = maxTimeVariation_.delaySeconds; - futureSeconds = maxTimeVariation_.futureSeconds; + _setMaxTimeVariation(maxTimeVariation_); emit OwnerFunctionCalled(0); } diff --git a/src/libraries/Error.sol b/src/libraries/Error.sol index 7c2860fe..0d5a2a8d 100644 --- a/src/libraries/Error.sol +++ b/src/libraries/Error.sol @@ -167,9 +167,6 @@ error BadSequencerNumber(uint256 stored, uint256 received); /// @dev The sequence message number provided to this message was inconsistent with the previous one error BadSequencerMessageNumber(uint256 stored, uint256 received); -/// @dev The batch data has the inbox authenticated bit set, but the batch data was not authenticated by the inbox -error DataNotAuthenticated(); - /// @dev Tried to create an already valid Data Availability Service keyset error AlreadyValidDASKeyset(bytes32); @@ -188,15 +185,9 @@ error InitParamZero(string name); /// @dev Thrown when data hashes where expected but not where present on the tx error MissingDataHashes(); -/// @dev Thrown when the data blob meta data is invalid -error InvalidBlobMetadata(); - /// @dev Thrown when rollup is not updated with updateRollupAddress error RollupNotChanged(); -/// @dev Batch data was empty when non empty was expected -error EmptyBatchData(); - /// @dev Unsupported header flag was provided error InvalidHeaderFlag(bytes1); @@ -205,3 +196,6 @@ error NativeTokenMismatch(); /// @dev Thrown when a deprecated function is called error Deprecated(); + +/// @dev Thrown when any component of maxTimeVariation is over uint64 +error BadMaxTimeVariation(); diff --git a/src/mocks/SequencerInboxStub.sol b/src/mocks/SequencerInboxStub.sol index e78d9479..49b31702 100644 --- a/src/mocks/SequencerInboxStub.sol +++ b/src/mocks/SequencerInboxStub.sol @@ -19,10 +19,10 @@ contract SequencerInboxStub is SequencerInbox { ) SequencerInbox(maxDataSize_, reader4844_, isUsingFeeToken_) { bridge = bridge_; rollup = IOwnable(msg.sender); - delayBlocks = maxTimeVariation_.delayBlocks; - futureBlocks = maxTimeVariation_.futureBlocks; - delaySeconds = maxTimeVariation_.delaySeconds; - futureSeconds = maxTimeVariation_.futureSeconds; + delayBlocks = uint64(maxTimeVariation_.delayBlocks); + futureBlocks = uint64(maxTimeVariation_.futureBlocks); + delaySeconds = uint64(maxTimeVariation_.delaySeconds); + futureSeconds = uint64(maxTimeVariation_.futureSeconds); isBatchPoster[sequencer_] = true; } diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index be2c09e1..8660f0ef 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -534,7 +534,6 @@ describe('ArbRollup', () => { validators: validatorsI, batchPosterManager: batchPosterManagerI, upgradeExecutorAddress, - adminproxy: adminproxyAddress, } = await setup() rollupAdmin = rollupAdminContract rollupUser = rollupUserContract diff --git a/test/foundry/SequencerInbox.t.sol b/test/foundry/SequencerInbox.t.sol index 5bad2eb6..92902d68 100644 --- a/test/foundry/SequencerInbox.t.sol +++ b/test/foundry/SequencerInbox.t.sol @@ -566,4 +566,49 @@ contract SequencerInboxTest is Test { abi.encodeWithSelector(SequencerInbox.postUpgradeInit.selector) ); } + + function testSetMaxTimeVariation( + uint256 delayBlocks, + uint256 futureBlocks, + uint256 delaySeconds, + uint256 futureSeconds + ) public { + vm.assume(delayBlocks <= uint256(type(uint64).max)); + vm.assume(futureBlocks <= uint256(type(uint64).max)); + vm.assume(delaySeconds <= uint256(type(uint64).max)); + vm.assume(futureSeconds <= uint256(type(uint64).max)); + (SequencerInbox seqInbox, ) = deployRollup(false); + vm.prank(rollupOwner); + seqInbox.setMaxTimeVariation( + ISequencerInbox.MaxTimeVariation({ + delayBlocks: delayBlocks, + futureBlocks: futureBlocks, + delaySeconds: delaySeconds, + futureSeconds: futureSeconds + }) + ); + } + + function testSetMaxTimeVariationOverflow( + uint256 delayBlocks, + uint256 futureBlocks, + uint256 delaySeconds, + uint256 futureSeconds + ) public { + vm.assume(delayBlocks > uint256(type(uint64).max)); + vm.assume(futureBlocks > uint256(type(uint64).max)); + vm.assume(delaySeconds > uint256(type(uint64).max)); + vm.assume(futureSeconds > uint256(type(uint64).max)); + (SequencerInbox seqInbox, ) = deployRollup(false); + vm.expectRevert(abi.encodeWithSelector(BadMaxTimeVariation.selector)); + vm.prank(rollupOwner); + seqInbox.setMaxTimeVariation( + ISequencerInbox.MaxTimeVariation({ + delayBlocks: delayBlocks, + futureBlocks: futureBlocks, + delaySeconds: delaySeconds, + futureSeconds: futureSeconds + }) + ); + } } diff --git a/test/signatures/Bridge b/test/signatures/Bridge new file mode 100644 index 00000000..667c6a85 --- /dev/null +++ b/test/signatures/Bridge @@ -0,0 +1,25 @@ +{ + "acceptFundsFromOldBridge()": "e77145f4", + "activeOutbox()": "ab5d8943", + "allowedDelayedInboxList(uint256)": "e76f5c8d", + "allowedDelayedInboxes(address)": "ae60bd13", + "allowedOutboxList(uint256)": "945e1147", + "allowedOutboxes(address)": "413b35bd", + "delayedInboxAccs(uint256)": "d5719dc2", + "delayedMessageCount()": "eca067ad", + "enqueueDelayedMessage(uint8,address,bytes32)": "8db5993b", + "enqueueSequencerMessage(bytes32,uint256,uint256,uint256)": "86598a56", + "executeCall(address,uint256,bytes)": "9e5d4c49", + "initialize(address)": "c4d66de8", + "rollup()": "cb23bcb5", + "sequencerInbox()": "ee35f327", + "sequencerInboxAccs(uint256)": "16bf5579", + "sequencerMessageCount()": "0084120c", + "sequencerReportedSubMessageCount()": "5fca4a16", + "setDelayedInbox(address,bool)": "47fb24c5", + "setOutbox(address,bool)": "cee3d728", + "setSequencerInbox(address)": "4f61f850", + "setSequencerReportedSubMessageCount(uint256)": "f81ff3b3", + "submitBatchSpendingReport(address,bytes32)": "7a88b107", + "updateRollupAddress(address)": "919cc706" +} diff --git a/test/signatures/BridgeCreator b/test/signatures/BridgeCreator new file mode 100644 index 00000000..33340999 --- /dev/null +++ b/test/signatures/BridgeCreator @@ -0,0 +1,10 @@ +{ + "createBridge(address,address,address,(uint256,uint256,uint256,uint256))": "b4a5cc34", + "erc20BasedTemplates()": "76768ab9", + "ethBasedTemplates()": "11f02227", + "owner()": "8da5cb5b", + "renounceOwnership()": "715018a6", + "transferOwnership(address)": "f2fde38b", + "updateERC20Templates((address,address,address,address,address))": "1bb7c6cc", + "updateTemplates((address,address,address,address,address))": "d94d6e0a" +} diff --git a/test/signatures/ChallengeManager b/test/signatures/ChallengeManager new file mode 100644 index 00000000..3807c4ff --- /dev/null +++ b/test/signatures/ChallengeManager @@ -0,0 +1,19 @@ +{ + "bisectExecution(uint64,(uint256,uint256,bytes32[],uint256),bytes32[])": "a521b032", + "bridge()": "e78cea92", + "challengeExecution(uint64,(uint256,uint256,bytes32[],uint256),uint8[2],bytes32[2],uint256)": "fb7be0a1", + "challengeInfo(uint64)": "7fd07a9c", + "challenges(uint256)": "8f1d3776", + "clearChallenge(uint64)": "56e9df97", + "createChallenge(bytes32,uint8[2],(bytes32[2],uint64[2])[2],uint64,address,address,uint256,uint256)": "14eab5e7", + "currentResponder(uint64)": "23a9ef23", + "initialize(address,address,address,address)": "f8c8765e", + "isTimedOut(uint64)": "9ede42b9", + "oneStepProveExecution(uint64,(uint256,uint256,bytes32[],uint256),bytes)": "d248d124", + "osp()": "f26a62c6", + "postUpgradeInit(address)": "c474d2c5", + "resultReceiver()": "3504f1d7", + "sequencerInbox()": "ee35f327", + "timeout(uint64)": "1b45c86a", + "totalChallengesCreated()": "5ef489e6" +} diff --git a/test/signatures/DeployHelper b/test/signatures/DeployHelper new file mode 100644 index 00000000..93ff0c75 --- /dev/null +++ b/test/signatures/DeployHelper @@ -0,0 +1,16 @@ +{ + "ERC1820_DEPLOYER()": "290302ce", + "ERC1820_PAYLOAD()": "2e796641", + "ERC1820_VALUE()": "db633c3e", + "ERC2470_DEPLOYER()": "55e34a6b", + "ERC2470_PAYLOAD()": "89cf8ae6", + "ERC2470_VALUE()": "9ed2c6f0", + "NICK_CREATE2_DEPLOYER()": "ef77e71a", + "NICK_CREATE2_PAYLOAD()": "1b9a680c", + "NICK_CREATE2_VALUE()": "4367d652", + "ZOLTU_CREATE2_DEPLOYER()": "d3a3faab", + "ZOLTU_CREATE2_PAYLOAD()": "75ae22b5", + "ZOLTU_VALUE()": "dd0c625a", + "getDeploymentTotalCost(address,uint256)": "acd7d02a", + "perform(address,address,uint256)": "d7c641e7" +} diff --git a/test/signatures/ERC20Bridge b/test/signatures/ERC20Bridge new file mode 100644 index 00000000..c37821d6 --- /dev/null +++ b/test/signatures/ERC20Bridge @@ -0,0 +1,26 @@ +{ + "acceptFundsFromOldBridge()": "e77145f4", + "activeOutbox()": "ab5d8943", + "allowedDelayedInboxList(uint256)": "e76f5c8d", + "allowedDelayedInboxes(address)": "ae60bd13", + "allowedOutboxList(uint256)": "945e1147", + "allowedOutboxes(address)": "413b35bd", + "delayedInboxAccs(uint256)": "d5719dc2", + "delayedMessageCount()": "eca067ad", + "enqueueDelayedMessage(uint8,address,bytes32,uint256)": "75d81e25", + "enqueueSequencerMessage(bytes32,uint256,uint256,uint256)": "86598a56", + "executeCall(address,uint256,bytes)": "9e5d4c49", + "initialize(address,address)": "485cc955", + "nativeToken()": "e1758bd8", + "rollup()": "cb23bcb5", + "sequencerInbox()": "ee35f327", + "sequencerInboxAccs(uint256)": "16bf5579", + "sequencerMessageCount()": "0084120c", + "sequencerReportedSubMessageCount()": "5fca4a16", + "setDelayedInbox(address,bool)": "47fb24c5", + "setOutbox(address,bool)": "cee3d728", + "setSequencerInbox(address)": "4f61f850", + "setSequencerReportedSubMessageCount(uint256)": "f81ff3b3", + "submitBatchSpendingReport(address,bytes32)": "7a88b107", + "updateRollupAddress(address)": "919cc706" +} diff --git a/test/signatures/ERC20Inbox b/test/signatures/ERC20Inbox new file mode 100644 index 00000000..04176030 --- /dev/null +++ b/test/signatures/ERC20Inbox @@ -0,0 +1,22 @@ +{ + "allowListEnabled()": "22bd5c1c", + "bridge()": "e78cea92", + "calculateRetryableSubmissionFee(uint256,uint256)": "a66b327d", + "createRetryableTicket(address,uint256,uint256,address,address,uint256,uint256,uint256,bytes)": "549e8426", + "depositERC20(uint256)": "b79092fd", + "getProxyAdmin()": "8b3240a0", + "initialize(address,address)": "485cc955", + "isAllowed(address)": "babcc539", + "maxDataSize()": "e8eb1dc3", + "pause()": "8456cb59", + "paused()": "5c975abb", + "sendContractTransaction(uint256,uint256,address,uint256,bytes)": "8a631aa6", + "sendL2Message(bytes)": "b75436bb", + "sendL2MessageFromOrigin(bytes)": "1fe927cf", + "sendUnsignedTransaction(uint256,uint256,uint256,address,uint256,bytes)": "5075788b", + "sequencerInbox()": "ee35f327", + "setAllowList(address[],bool[])": "e3de72a5", + "setAllowListEnabled(bool)": "efeadb6d", + "unpause()": "3f4ba83a", + "unsafeCreateRetryableTicket(address,uint256,uint256,address,address,uint256,uint256,uint256,bytes)": "b9b9a688" +} diff --git a/test/signatures/ERC20Outbox b/test/signatures/ERC20Outbox new file mode 100644 index 00000000..f577c95d --- /dev/null +++ b/test/signatures/ERC20Outbox @@ -0,0 +1,23 @@ +{ + "OUTBOX_VERSION()": "c75184df", + "bridge()": "e78cea92", + "calculateItemHash(address,address,uint256,uint256,uint256,uint256,bytes)": "9f0c04bf", + "calculateMerkleRoot(bytes32[],uint256,bytes32)": "007436d3", + "executeTransaction(bytes32[],uint256,address,address,uint256,uint256,uint256,uint256,bytes)": "08635a95", + "executeTransactionSimulation(uint256,address,address,uint256,uint256,uint256,uint256,bytes)": "288e5b10", + "initialize(address)": "c4d66de8", + "isSpent(uint256)": "5a129efe", + "l2ToL1BatchNum()": "11985271", + "l2ToL1Block()": "46547790", + "l2ToL1EthBlock()": "8515bc6a", + "l2ToL1OutputId()": "72f2a8c7", + "l2ToL1Sender()": "80648b02", + "l2ToL1Timestamp()": "b0f30537", + "l2ToL1WithdrawalAmount()": "cbf96f63", + "postUpgradeInit()": "95fcea78", + "rollup()": "cb23bcb5", + "roots(bytes32)": "ae6dead7", + "spent(uint256)": "d5b5cc23", + "updateRollupAddress()": "6ae71f12", + "updateSendRoot(bytes32,bytes32)": "a04cee60" +} diff --git a/test/signatures/Inbox b/test/signatures/Inbox new file mode 100644 index 00000000..4e884c6b --- /dev/null +++ b/test/signatures/Inbox @@ -0,0 +1,30 @@ +{ + "allowListEnabled()": "22bd5c1c", + "bridge()": "e78cea92", + "calculateRetryableSubmissionFee(uint256,uint256)": "a66b327d", + "createRetryableTicket(address,uint256,uint256,address,address,uint256,uint256,bytes)": "679b6ded", + "createRetryableTicketNoRefundAliasRewrite(address,uint256,uint256,address,address,uint256,uint256,bytes)": "1b871c8d", + "depositEth()": "439370b1", + "depositEth(uint256)": "0f4d14e9", + "getProxyAdmin()": "8b3240a0", + "initialize(address,address)": "485cc955", + "isAllowed(address)": "babcc539", + "maxDataSize()": "e8eb1dc3", + "pause()": "8456cb59", + "paused()": "5c975abb", + "postUpgradeInit(address)": "c474d2c5", + "sendContractTransaction(uint256,uint256,address,uint256,bytes)": "8a631aa6", + "sendL1FundedContractTransaction(uint256,uint256,address,bytes)": "5e916758", + "sendL1FundedUnsignedTransaction(uint256,uint256,uint256,address,bytes)": "67ef3ab8", + "sendL1FundedUnsignedTransactionToFork(uint256,uint256,uint256,address,bytes)": "e6bd12cf", + "sendL2Message(bytes)": "b75436bb", + "sendL2MessageFromOrigin(bytes)": "1fe927cf", + "sendUnsignedTransaction(uint256,uint256,uint256,address,uint256,bytes)": "5075788b", + "sendUnsignedTransactionToFork(uint256,uint256,uint256,address,uint256,bytes)": "00f72382", + "sendWithdrawEthToFork(uint256,uint256,uint256,uint256,address)": "70665f14", + "sequencerInbox()": "ee35f327", + "setAllowList(address[],bool[])": "e3de72a5", + "setAllowListEnabled(bool)": "efeadb6d", + "unpause()": "3f4ba83a", + "unsafeCreateRetryableTicket(address,uint256,uint256,address,address,uint256,uint256,bytes)": "6e6e8a6a" +} diff --git a/test/signatures/Outbox b/test/signatures/Outbox new file mode 100644 index 00000000..cdfc5a24 --- /dev/null +++ b/test/signatures/Outbox @@ -0,0 +1,22 @@ +{ + "OUTBOX_VERSION()": "c75184df", + "bridge()": "e78cea92", + "calculateItemHash(address,address,uint256,uint256,uint256,uint256,bytes)": "9f0c04bf", + "calculateMerkleRoot(bytes32[],uint256,bytes32)": "007436d3", + "executeTransaction(bytes32[],uint256,address,address,uint256,uint256,uint256,uint256,bytes)": "08635a95", + "executeTransactionSimulation(uint256,address,address,uint256,uint256,uint256,uint256,bytes)": "288e5b10", + "initialize(address)": "c4d66de8", + "isSpent(uint256)": "5a129efe", + "l2ToL1BatchNum()": "11985271", + "l2ToL1Block()": "46547790", + "l2ToL1EthBlock()": "8515bc6a", + "l2ToL1OutputId()": "72f2a8c7", + "l2ToL1Sender()": "80648b02", + "l2ToL1Timestamp()": "b0f30537", + "postUpgradeInit()": "95fcea78", + "rollup()": "cb23bcb5", + "roots(bytes32)": "ae6dead7", + "spent(uint256)": "d5b5cc23", + "updateRollupAddress()": "6ae71f12", + "updateSendRoot(bytes32,bytes32)": "a04cee60" +} diff --git a/test/signatures/RollupAdminLogic b/test/signatures/RollupAdminLogic new file mode 100644 index 00000000..65a3167e --- /dev/null +++ b/test/signatures/RollupAdminLogic @@ -0,0 +1,73 @@ +{ + "_stakerMap(address)": "e8bd4922", + "amountStaked(address)": "ef40a670", + "baseStake()": "76e7e23b", + "bridge()": "e78cea92", + "chainId()": "9a8a0592", + "challengeManager()": "023a96fe", + "confirmPeriodBlocks()": "2e7acfa6", + "createNitroMigrationGenesis((((bytes32[2],uint64[2]),uint8),((bytes32[2],uint64[2]),uint8),uint64))": "7b83a3fe", + "currentChallenge(address)": "69fd251c", + "extraChallengeTimeBlocks()": "771b2f97", + "firstUnresolvedNode()": "d735e21d", + "forceConfirmNode(uint64,bytes32,bytes32)": "2f7968e8", + "forceCreateNode(uint64,uint256,(((bytes32[2],uint64[2]),uint8),((bytes32[2],uint64[2]),uint8),uint64),bytes32)": "470dce4e", + "forceRefundStaker(address[])": "7c75c298", + "forceResolveChallenge(address[],address[])": "f38c9379", + "getNode(uint64)": "92c8134c", + "getNodeCreationBlockForLogLookup(uint64)": "f63a434a", + "getStaker(address)": "a23c44b1", + "getStakerAddress(uint64)": "6ddd3744", + "inbox()": "fb0e722b", + "initialize((uint64,uint64,address,uint256,bytes32,address,address,uint256,string,uint64,(uint256,uint256,uint256,uint256)),(address,address,address,address,address,address,address,address,address,address))": "28ff127a", + "isStaked(address)": "6177fd18", + "isStakedOnLatestConfirmed(address)": "dcd030aa", + "isValidator(address)": "facd743b", + "isZombie(address)": "91c657e8", + "lastStakeBlock()": "8640ce5f", + "latestConfirmed()": "65f7f80d", + "latestNodeCreated()": "7ba9534a", + "latestStakedNode(address)": "3e96576e", + "loserStakeEscrow()": "f065de3f", + "minimumAssertionPeriod()": "45e38b64", + "nodeHasStaker(uint64,address)": "aa65af48", + "outbox()": "ce11e6ab", + "pause()": "8456cb59", + "paused()": "5c975abb", + "proxiableUUID()": "52d1902d", + "removeOldOutbox(address)": "567ca41b", + "resume()": "046f7da2", + "rollupDeploymentBlock()": "1b1689e9", + "rollupEventInbox()": "aa38a6e7", + "sequencerInbox()": "ee35f327", + "setBaseStake(uint256)": "06ae5851", + "setConfirmPeriodBlocks(uint64)": "ce66d05c", + "setDelayedInbox(address,bool)": "47fb24c5", + "setExtraChallengeTimeBlocks(uint64)": "6136fe2e", + "setInbox(address)": "53b60c4a", + "setLoserStakeEscrow(address)": "fc8ffa03", + "setMinimumAssertionPeriod(uint256)": "948d6588", + "setOutbox(address)": "ff204f3b", + "setOwner(address)": "13af4035", + "setSequencerInbox(address)": "4f61f850", + "setStakeToken(address)": "0397d458", + "setValidator(address[],bool[])": "a3ffb772", + "setValidatorWhitelistDisabled(bool)": "a2b4f1d8", + "setWasmModuleRoot(bytes32)": "89384960", + "stakeToken()": "51ed6a30", + "stakerCount()": "dff69787", + "totalWithdrawableFunds()": "71ef232c", + "upgradeBeacon(address,address)": "848bf918", + "upgradeSecondaryTo(address)": "0d40a0fd", + "upgradeSecondaryToAndCall(address,bytes)": "9846129a", + "upgradeTo(address)": "3659cfe6", + "upgradeToAndCall(address,bytes)": "4f1ef286", + "validatorUtils()": "014cc92c", + "validatorWalletCreator()": "bc45e0ae", + "validatorWhitelistDisabled()": "12ab3d3b", + "wasmModuleRoot()": "8ee1a126", + "withdrawableFunds(address)": "2f30cabd", + "zombieAddress(uint256)": "d01e6602", + "zombieCount()": "63721d6b", + "zombieLatestStakedNode(uint256)": "f33e1fac" +} diff --git a/test/signatures/RollupCore b/test/signatures/RollupCore new file mode 100644 index 00000000..01125d8e --- /dev/null +++ b/test/signatures/RollupCore @@ -0,0 +1,44 @@ +{ + "_stakerMap(address)": "e8bd4922", + "amountStaked(address)": "ef40a670", + "baseStake()": "76e7e23b", + "bridge()": "e78cea92", + "chainId()": "9a8a0592", + "challengeManager()": "023a96fe", + "confirmPeriodBlocks()": "2e7acfa6", + "currentChallenge(address)": "69fd251c", + "extraChallengeTimeBlocks()": "771b2f97", + "firstUnresolvedNode()": "d735e21d", + "getNode(uint64)": "92c8134c", + "getNodeCreationBlockForLogLookup(uint64)": "f63a434a", + "getStaker(address)": "a23c44b1", + "getStakerAddress(uint64)": "6ddd3744", + "inbox()": "fb0e722b", + "isStaked(address)": "6177fd18", + "isStakedOnLatestConfirmed(address)": "dcd030aa", + "isValidator(address)": "facd743b", + "isZombie(address)": "91c657e8", + "lastStakeBlock()": "8640ce5f", + "latestConfirmed()": "65f7f80d", + "latestNodeCreated()": "7ba9534a", + "latestStakedNode(address)": "3e96576e", + "loserStakeEscrow()": "f065de3f", + "minimumAssertionPeriod()": "45e38b64", + "nodeHasStaker(uint64,address)": "aa65af48", + "outbox()": "ce11e6ab", + "paused()": "5c975abb", + "rollupDeploymentBlock()": "1b1689e9", + "rollupEventInbox()": "aa38a6e7", + "sequencerInbox()": "ee35f327", + "stakeToken()": "51ed6a30", + "stakerCount()": "dff69787", + "totalWithdrawableFunds()": "71ef232c", + "validatorUtils()": "014cc92c", + "validatorWalletCreator()": "bc45e0ae", + "validatorWhitelistDisabled()": "12ab3d3b", + "wasmModuleRoot()": "8ee1a126", + "withdrawableFunds(address)": "2f30cabd", + "zombieAddress(uint256)": "d01e6602", + "zombieCount()": "63721d6b", + "zombieLatestStakedNode(uint256)": "f33e1fac" +} diff --git a/test/signatures/RollupCreator b/test/signatures/RollupCreator new file mode 100644 index 00000000..6c6f761a --- /dev/null +++ b/test/signatures/RollupCreator @@ -0,0 +1,16 @@ +{ + "bridgeCreator()": "f860cefa", + "challengeManagerTemplate()": "9c683d10", + "createRollup(((uint64,uint64,address,uint256,bytes32,address,address,uint256,string,uint64,(uint256,uint256,uint256,uint256)),address[],uint256,address,bool,uint256,address[],address))": "331f9b0b", + "l2FactoriesDeployer()": "ac0425bc", + "osp()": "f26a62c6", + "owner()": "8da5cb5b", + "renounceOwnership()": "715018a6", + "rollupAdminLogic()": "9dba3241", + "rollupUserLogic()": "9d4798e3", + "setTemplates(address,address,address,address,address,address,address,address,address)": "ac9a97b4", + "transferOwnership(address)": "f2fde38b", + "upgradeExecutorLogic()": "030cb85e", + "validatorUtils()": "014cc92c", + "validatorWalletCreator()": "bc45e0ae" +} diff --git a/test/signatures/RollupUserLogic b/test/signatures/RollupUserLogic new file mode 100644 index 00000000..e0b35889 --- /dev/null +++ b/test/signatures/RollupUserLogic @@ -0,0 +1,71 @@ +{ + "VALIDATOR_AFK_BLOCKS()": "4ceccfe5", + "_stakerMap(address)": "e8bd4922", + "addToDeposit(address)": "45c5b2c7", + "amountStaked(address)": "ef40a670", + "baseStake()": "76e7e23b", + "bridge()": "e78cea92", + "chainId()": "9a8a0592", + "challengeManager()": "023a96fe", + "completeChallenge(uint256,address,address)": "0357aa49", + "confirmNextNode(bytes32,bytes32)": "5eb405d5", + "confirmPeriodBlocks()": "2e7acfa6", + "countStakedZombies(uint64)": "5c617e94", + "countZombiesStakedOnChildren(uint64)": "6d08d0a2", + "createChallenge(address[2],uint64[2],uint8[2],(bytes32[2],uint64[2])[2],uint64,bytes32,uint256[2],bytes32[2])": "6f57644e", + "currentChallenge(address)": "69fd251c", + "currentRequiredStake()": "4d26732d", + "extraChallengeTimeBlocks()": "771b2f97", + "firstUnresolvedNode()": "d735e21d", + "getNode(uint64)": "92c8134c", + "getNodeCreationBlockForLogLookup(uint64)": "f63a434a", + "getStaker(address)": "a23c44b1", + "getStakerAddress(uint64)": "6ddd3744", + "inbox()": "fb0e722b", + "initialize(address)": "c4d66de8", + "isERC20Enabled()": "cd205fda", + "isStaked(address)": "6177fd18", + "isStakedOnLatestConfirmed(address)": "dcd030aa", + "isValidator(address)": "facd743b", + "isZombie(address)": "91c657e8", + "lastStakeBlock()": "8640ce5f", + "latestConfirmed()": "65f7f80d", + "latestNodeCreated()": "7ba9534a", + "latestStakedNode(address)": "3e96576e", + "loserStakeEscrow()": "f065de3f", + "minimumAssertionPeriod()": "45e38b64", + "newStakeOnExistingNode(uint64,bytes32)": "ced01cfb", + "newStakeOnNewNode((((bytes32[2],uint64[2]),uint8),((bytes32[2],uint64[2]),uint8),uint64),bytes32,uint256)": "4774e576", + "nodeHasStaker(uint64,address)": "aa65af48", + "outbox()": "ce11e6ab", + "owner()": "8da5cb5b", + "paused()": "5c975abb", + "proxiableUUID()": "52d1902d", + "reduceDeposit(uint256)": "1e83d30f", + "rejectNextNode(address)": "6b94c33b", + "removeOldZombies(uint256)": "edfd03ed", + "removeWhitelistAfterFork()": "c2c2e68e", + "removeWhitelistAfterValidatorAfk()": "18baaab9", + "removeZombie(uint256,uint256)": "7e2d2155", + "requireUnresolved(uint256)": "2b2af0ab", + "requireUnresolvedExists()": "67425daf", + "requiredStake(uint256,uint64,uint64)": "b0ebedc7", + "returnOldDeposit(address)": "7427be51", + "rollupDeploymentBlock()": "1b1689e9", + "rollupEventInbox()": "aa38a6e7", + "sequencerInbox()": "ee35f327", + "stakeOnExistingNode(uint64,bytes32)": "1aeb55a0", + "stakeOnNewNode((((bytes32[2],uint64[2]),uint8),((bytes32[2],uint64[2]),uint8),uint64),bytes32,uint256)": "54ce8961", + "stakeToken()": "51ed6a30", + "stakerCount()": "dff69787", + "totalWithdrawableFunds()": "71ef232c", + "validatorUtils()": "014cc92c", + "validatorWalletCreator()": "bc45e0ae", + "validatorWhitelistDisabled()": "12ab3d3b", + "wasmModuleRoot()": "8ee1a126", + "withdrawStakerFunds()": "61373919", + "withdrawableFunds(address)": "2f30cabd", + "zombieAddress(uint256)": "d01e6602", + "zombieCount()": "63721d6b", + "zombieLatestStakedNode(uint256)": "f33e1fac" +} diff --git a/test/signatures/SequencerInbox b/test/signatures/SequencerInbox new file mode 100644 index 00000000..18c3db02 --- /dev/null +++ b/test/signatures/SequencerInbox @@ -0,0 +1,39 @@ +{ + "BROTLI_MESSAGE_HEADER_FLAG()": "16af91a7", + "DAS_MESSAGE_HEADER_FLAG()": "f60a5091", + "DATA_AUTHENTICATED_FLAG()": "e5a358c8", + "DATA_BLOB_HEADER_FLAG()": "2cbf74e5", + "HEADER_LENGTH()": "27957a49", + "TREE_DAS_MESSAGE_HEADER_FLAG()": "6c890450", + "ZERO_HEAVY_MESSAGE_HEADER_FLAG()": "02c99275", + "addSequencerL2Batch(uint256,bytes,uint256,address,uint256,uint256)": "e0bc9729", + "addSequencerL2BatchFromBlobs(uint256,uint256,address,uint256,uint256)": "3e5aa082", + "addSequencerL2BatchFromOrigin(uint256,bytes,uint256,address)": "6f12b0c9", + "addSequencerL2BatchFromOrigin(uint256,bytes,uint256,address,uint256,uint256)": "8f111f3c", + "batchCount()": "06f13056", + "batchPosterManager()": "cc2a1a0c", + "bridge()": "e78cea92", + "dasKeySetInfo(bytes32)": "715ea34b", + "forceInclusion(uint256,uint8,uint64[2],uint256,address,bytes32)": "f1981578", + "getKeysetCreationBlock(bytes32)": "258f0495", + "inboxAccs(uint256)": "d9dd67ab", + "initialize(address,(uint256,uint256,uint256,uint256))": "1f7a92b2", + "invalidateKeysetHash(bytes32)": "84420860", + "isBatchPoster(address)": "71c3e6fe", + "isSequencer(address)": "6d46e987", + "isUsingFeeToken()": "92d9f782", + "isValidKeysetHash(bytes32)": "1637be48", + "maxDataSize()": "e8eb1dc3", + "maxTimeVariation()": "ebea461d", + "postUpgradeInit()": "95fcea78", + "reader4844()": "8d910dde", + "removeDelayAfterFork()": "96cc5c78", + "rollup()": "cb23bcb5", + "setBatchPosterManager(address)": "1ff64790", + "setIsBatchPoster(address,bool)": "6e7df3e7", + "setIsSequencer(address,bool)": "1f956632", + "setMaxTimeVariation((uint256,uint256,uint256,uint256))": "b31761f8", + "setValidKeyset(bytes)": "d1ce8da8", + "totalDelayedMessagesRead()": "7fa3a40e", + "updateRollupAddress()": "6ae71f12" +} diff --git a/test/signatures/test-sigs.bash b/test/signatures/test-sigs.bash new file mode 100755 index 00000000..4ff16cc3 --- /dev/null +++ b/test/signatures/test-sigs.bash @@ -0,0 +1,17 @@ +#!/bin/bash +output_dir="./test/signatures" +for CONTRACTNAME in Bridge Inbox Outbox RollupCore RollupUserLogic RollupAdminLogic SequencerInbox ChallengeManager ERC20Bridge ERC20Inbox ERC20Outbox BridgeCreator DeployHelper RollupCreator +do + echo "Checking for signature changes in $CONTRACTNAME" + [ -f "$output_dir/$CONTRACTNAME" ] && mv "$output_dir/$CONTRACTNAME" "$output_dir/$CONTRACTNAME-old" + forge inspect "$CONTRACTNAME" methods > "$output_dir/$CONTRACTNAME" + diff "$output_dir/$CONTRACTNAME-old" "$output_dir/$CONTRACTNAME" + if [[ $? != "0" ]] + then + CHANGED=1 + fi +done +if [[ $CHANGED == 1 ]] +then + exit 1 +fi \ No newline at end of file diff --git a/test/storage/SequencerInbox b/test/storage/SequencerInbox index 54db5485..c53e775e 100644 --- a/test/storage/SequencerInbox +++ b/test/storage/SequencerInbox @@ -4,7 +4,7 @@ | bridge | contract IBridge | 1 | 0 | 20 | src/bridge/SequencerInbox.sol:SequencerInbox | | rollup | contract IOwnable | 2 | 0 | 20 | src/bridge/SequencerInbox.sol:SequencerInbox | | isBatchPoster | mapping(address => bool) | 3 | 0 | 32 | src/bridge/SequencerInbox.sol:SequencerInbox | -| __LEGACY_MAX_TIME_VARIATION | uint256[4] | 4 | 0 | 128 | src/bridge/SequencerInbox.sol:SequencerInbox | +| __LEGACY_MAX_TIME_VARIATION | struct ISequencerInbox.MaxTimeVariation | 4 | 0 | 128 | src/bridge/SequencerInbox.sol:SequencerInbox | | dasKeySetInfo | mapping(bytes32 => struct ISequencerInbox.DasKeySetInfo) | 8 | 0 | 32 | src/bridge/SequencerInbox.sol:SequencerInbox | | isSequencer | mapping(address => bool) | 9 | 0 | 32 | src/bridge/SequencerInbox.sol:SequencerInbox | | delayBlocks | uint64 | 10 | 0 | 8 | src/bridge/SequencerInbox.sol:SequencerInbox |