diff --git a/.gitignore b/.gitignore index 1cd604bb..4d219b57 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ deployments/ /test/prover/proofs/*.json /test/prover/spec-proofs/*.json /test/storage/*-old.dot +scripts/config.ts diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..8217feee --- /dev/null +++ b/LICENSE @@ -0,0 +1,114 @@ +Business Source License 1.1 + +License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. +"Business Source License" is a trademark of MariaDB Corporation Ab. + +----------------------------------------------------------------------------- + +Parameters + +Licensor: Offchain Labs + +Licensed Work: Arbitrum Nitro Contracts + The Licensed Work is (c) 2021-2023 Offchain Labs + +Additional Use Grant: You may use the Licensed Work in a production environment solely + to provide a point of interface to permit end users or applications + utilizing the Covered Arbitrum Chains to interact and query the + state of a Covered Arbitrum Chain, including without limitation + validating the correctness of the posted chain state. For purposes + of this Additional Use Grant, the "Covered Arbitrum Chains" are + means (a) Arbitrum One (chainid:42161), Arbitrum Nova (chainid:42170), + Arbitrum Rinkeby testnet/Rinkarby (chainid:421611), and + Arbitrum Nitro Goerli testnet (chainid:421613) (b) any future + blockchains authorized to be designated as Covered Arbitrum Chains + by the decentralized autonomous organization governing the Arbitrum + network; and (c) any “Layer 3” Arbitrum-based blockchain that is built + on and settles to another Covered Arbitrum Chain. + + + + + +Change Date: Dec 31, 2027 + +Change License: Apache License Version 2.0 + +----------------------------------------------------------------------------- + +Terms + +The Licensor hereby grants you the right to copy, modify, create derivative +works, redistribute, and make non-production use of the Licensed Work. The +Licensor may make an Additional Use Grant, above, permitting limited +production use. + +Effective on the Change Date, or the fourth anniversary of the first publicly +available distribution of a specific version of the Licensed Work under this +License, whichever comes first, the Licensor hereby grants you rights under +the terms of the Change License, and the rights granted in the paragraph +above terminate. + +If your use of the Licensed Work does not comply with the requirements +currently in effect as described in this License, you must purchase a +commercial license from the Licensor, its affiliated entities, or authorized +resellers, or you must refrain from using the Licensed Work. + +All copies of the original and modified Licensed Work, and derivative works +of the Licensed Work, are subject to this License. This License applies +separately for each version of the Licensed Work and the Change Date may vary +for each version of the Licensed Work released by Licensor. + +You must conspicuously display this License on each original or modified copy +of the Licensed Work. If you receive the Licensed Work in original or +modified form from a third party, the terms and conditions set forth in this +License apply to your use of that work. + +Any use of the Licensed Work in violation of this License will automatically +terminate your rights under this License for the current and all other +versions of the Licensed Work. + +This License does not grant you any right in any trademark or logo of +Licensor or its affiliates (provided that you may use a trademark or logo of +Licensor as expressly required by this License). + +TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +TITLE. + +MariaDB hereby grants you permission to use this License’s text to license +your works, and to refer to it using the trademark "Business Source License", +as long as you comply with the Covenants of Licensor below. + +----------------------------------------------------------------------------- + +Covenants of Licensor + +In consideration of the right to use this License’s text and the "Business +Source License" name and trademark, Licensor covenants to MariaDB, and to all +other recipients of the licensed work to be provided by Licensor: + +1. To specify as the Change License the GPL Version 2.0 or any later version, + or a license that is compatible with GPL Version 2.0 or a later version, + where "compatible" means that software provided under the Change License can + be included in a program with software provided under GPL Version 2.0 or a + later version. Licensor may specify additional Change Licenses without + limitation. + +2. To either: (a) specify an additional grant of rights to use that does not + impose any additional restriction on the right granted in this License, as + the Additional Use Grant; or (b) insert the text "None". + +3. To specify a Change Date. + +4. Not to modify this License in any other way. + +----------------------------------------------------------------------------- + +Notice + +The Business Source License (this document, or the "License") is not an Open +Source license. However, the Licensed Work will eventually be made available +under an Open Source License, as stated in this License. diff --git a/hardhat.config.ts b/hardhat.config.ts index 89fbc7a6..76929c70 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -88,6 +88,12 @@ module.exports = { ? [process.env['DEVNET_PRIVKEY']] : [], }, + sepolia: { + url: 'https://sepolia.infura.io/v3/' + process.env['INFURA_KEY'], + accounts: process.env['DEVNET_PRIVKEY'] + ? [process.env['DEVNET_PRIVKEY']] + : [], + }, rinkeby: { url: 'https://rinkeby.infura.io/v3/' + process.env['INFURA_KEY'], accounts: process.env['DEVNET_PRIVKEY'] @@ -126,6 +132,7 @@ module.exports = { apiKey: { mainnet: process.env['ETHERSCAN_API_KEY'], goerli: process.env['ETHERSCAN_API_KEY'], + sepolia: process.env['ETHERSCAN_API_KEY'], rinkeby: process.env['ETHERSCAN_API_KEY'], arbitrumOne: process.env['ARBISCAN_API_KEY'], arbitrumTestnet: process.env['ARBISCAN_API_KEY'], diff --git a/package.json b/package.json index a330b882..152ddab6 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,9 @@ "build:0.7": "INTERFACE_TESTER_SOLC_VERSION=0.7.0 yarn run build", "test:compatibility": "yarn run build:0.6 && yarn run build:0.7", "test:storage": "./test/storage/test.bash", - "postinstall": "patch-package" + "postinstall": "patch-package", + "deploy-factory": "hardhat run scripts/deployment.ts", + "deploy-rollup": "hardhat run scripts/rollupCreation.ts" }, "dependencies": { "@openzeppelin/contracts": "4.5.0", diff --git a/scripts/config.ts.example b/scripts/config.ts.example new file mode 100644 index 00000000..7f911710 --- /dev/null +++ b/scripts/config.ts.example @@ -0,0 +1,29 @@ +import { ethers } from 'ethers' + +export const config = { + rollupConfig: { + confirmPeriodBlocks: ethers.BigNumber.from('45818'), + extraChallengeTimeBlocks: ethers.BigNumber.from('200'), + stakeToken: ethers.constants.AddressZero, + baseStake: ethers.utils.parseEther('1'), + wasmModuleRoot: + '0xda4e3ad5e7feacb817c21c8d0220da7650fe9051ece68a3f0b1c5d38bbb27b21', + owner: '0x1234123412341234123412341234123412341234', + loserStakeEscrow: ethers.constants.AddressZero, + chainId: ethers.BigNumber.from('13331370'), + chainConfig: + '{"chainId":13331370,"homesteadBlock":0,"daoForkBlock":null,"daoForkSupport":true,"eip150Block":0,"eip150Hash":"0x0000000000000000000000000000000000000000000000000000000000000000","eip155Block":0,"eip158Block":0,"byzantiumBlock":0,"constantinopleBlock":0,"petersburgBlock":0,"istanbulBlock":0,"muirGlacierBlock":0,"berlinBlock":0,"londonBlock":0,"clique":{"period":0,"epoch":0},"arbitrum":{"EnableArbOS":true,"AllowDebugPrecompiles":false,"DataAvailabilityCommittee":false,"InitialArbOSVersion":10,"InitialChainOwner":"0x1234123412341234123412341234123412341234","GenesisBlockNum":0}}', + genesisBlockNum: ethers.BigNumber.from('0'), + sequencerInboxMaxTimeVariation: { + delayBlocks: ethers.BigNumber.from('5760'), + futureBlocks: ethers.BigNumber.from('12'), + delaySeconds: ethers.BigNumber.from('86400'), + futureSeconds: ethers.BigNumber.from('3600'), + }, + }, + validators: [ + '0x1234123412341234123412341234123412341234', + '0x1234512345123451234512345123451234512345', + ], + batchPoster: '0x1234123412341234123412341234123412341234', +} diff --git a/scripts/deployment.ts b/scripts/deployment.ts new file mode 100644 index 00000000..9a5bf94f --- /dev/null +++ b/scripts/deployment.ts @@ -0,0 +1,163 @@ +import { ethers } from 'hardhat' +import { ContractFactory, Contract } from 'ethers' +import '@nomiclabs/hardhat-ethers' +import { run } from 'hardhat' + +// Define a verification function +async function verifyContract( + contractName: string, + contractAddress: string, + constructorArguments: any[] = [], + contractPathAndName?: string // optional +): Promise { + try { + // 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[] = [] +): 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) + + await verifyContract(contractName, contract.address, constructorArgs) + + return contract +} + +// Function to handle all deployments of core contracts using deployContract function +async function deployAllContracts( + signer: any +): Promise> { + const bridgeCreator = await deployContract('BridgeCreator', signer) + 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 validatorUtils = await deployContract('ValidatorUtils', signer) + const validatorWalletCreator = await deployContract( + 'ValidatorWalletCreator', + signer + ) + const rollupCreator = await deployContract('RollupCreator', signer) + return { + bridgeCreator, + prover0, + proverMem, + proverMath, + proverHostIo, + osp, + challengeManager, + rollupAdmin, + rollupUser, + validatorUtils, + validatorWalletCreator, + rollupCreator, + } +} + +async function main() { + const [signer] = await ethers.getSigners() + + try { + // Deploying all contracts + const contracts = await deployAllContracts(signer) + + // Call setTemplates with the deployed contract addresses + console.log('Waiting for the Template to be set on the Rollup Creator') + await contracts.rollupCreator.setTemplates( + contracts.bridgeCreator.address, + contracts.osp.address, + contracts.challengeManager.address, + contracts.rollupAdmin.address, + contracts.rollupUser.address, + contracts.validatorUtils.address, + contracts.validatorWalletCreator.address + ) + console.log('Template is set on the Rollup Creator') + + const bridgeAddress = await contracts.bridgeCreator.bridgeTemplate() + const sequencerInboxAddress = + await contracts.bridgeCreator.sequencerInboxTemplate() + const inboxAddress = await contracts.bridgeCreator.inboxTemplate() + const outboxAddress = await contracts.bridgeCreator.outboxTemplate() + + console.log( + `"bridge implementation contract" created at address:`, + bridgeAddress + ) + await verifyContract( + 'Bridge', + bridgeAddress, + [], + 'src/bridge/Bridge.sol:Bridge' + ) + console.log( + `"sequencerInbox implementation contract" created at address:`, + sequencerInboxAddress + ) + await verifyContract('SequencerInbox', sequencerInboxAddress, []) + console.log( + `"inbox implementation contract" created at address:`, + inboxAddress + ) + await verifyContract('Inbox', inboxAddress, []) + console.log( + `"outbox implementation contract" created at address:`, + outboxAddress + ) + await verifyContract('Outbox', outboxAddress, []) + } catch (error) { + console.error( + 'Deployment failed:', + error instanceof Error ? error.message : error + ) + } +} + +main() + .then(() => process.exit(0)) + .catch((error: Error) => { + console.error(error) + process.exit(1) + }) diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts new file mode 100644 index 00000000..2c9af885 --- /dev/null +++ b/scripts/rollupCreation.ts @@ -0,0 +1,139 @@ +import { ethers } from 'hardhat' +import '@nomiclabs/hardhat-ethers' +import { run } from 'hardhat' +import { abi as rollupCreatorAbi } from '../build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json' +import { config } from './config' + +interface RollupCreatedEvent { + event: string + address: string + args?: { + rollupAddress: string + inboxAddress: string + outbox: string + rollupEventInbox: string + challengeManager: string + adminProxy: string + sequencerInbox: string + bridge: string + validatorUtils: string + validatorWalletCreator: string + } +} + +async function main() { + const rollupCreatorAddress = process.env.ROLLUP_CREATOR_ADDRESS + + if (!rollupCreatorAddress) { + console.error( + 'Please provide ROLLUP_CREATOR_ADDRESS as an environment variable.' + ) + process.exit(1) + } + + if (!rollupCreatorAbi) { + throw new Error( + 'You need to first run script to deploy and compile the contracts first' + ) + } + + const [signer] = await ethers.getSigners() + + const rollupCreator = await new ethers.Contract( + rollupCreatorAddress, + rollupCreatorAbi, + signer + ) + + try { + let vals: boolean[] = [] + for (let i = 0; i < config.validators.length; i++) { + vals.push(true) + } + // Call the createRollup function + console.log('Calling createRollup to generate a new rollup ...') + const createRollupTx = await rollupCreator.createRollup( + config.rollupConfig, + config.batchPoster, + config.validators + ) + const createRollupReceipt = await createRollupTx.wait() + + const rollupCreatedEvent = createRollupReceipt.events?.find( + (event: RollupCreatedEvent) => + event.event === 'RollupCreated' && + event.address.toLowerCase() === rollupCreatorAddress.toLowerCase() + ) + + // Checking for RollupCreated event for new rollup address + if (rollupCreatedEvent) { + const rollupAddress = rollupCreatedEvent.args?.rollupAddress + const inboxAddress = rollupCreatedEvent.args?.inboxAddress + const outbox = rollupCreatedEvent.args?.outbox + const rollupEventInbox = rollupCreatedEvent.args?.rollupEventInbox + const challengeManager = rollupCreatedEvent.args?.challengeManager + const adminProxy = rollupCreatedEvent.args?.adminProxy + const sequencerInbox = rollupCreatedEvent.args?.sequencerInbox + const bridge = rollupCreatedEvent.args?.bridge + const validatorUtils = rollupCreatedEvent.args?.validatorUtils + const validatorWalletCreator = + rollupCreatedEvent.args?.validatorWalletCreator + + console.log("Congratulations! 🎉🎉🎉 All DONE! Here's your addresses:") + console.log('RollupProxy Contract created at address:', rollupAddress) + console.log( + `Attempting to verify Rollup contract at address ${rollupAddress}...` + ) + try { + await run('verify:verify', { + contract: 'src/rollup/RollupProxy.sol:RollupProxy', + address: rollupAddress, + constructorArguments: [], + }) + } catch (error: any) { + if (error.message.includes('Already Verified')) { + console.log(`Contract RollupProxy is already verified.`) + } else { + console.error( + `Verification for RollupProxy failed with the following error: ${error.message}` + ) + } + } + console.log('Inbox (proxy) Contract created at address:', inboxAddress) + console.log('Outbox (proxy) Contract created at address:', outbox) + console.log( + 'rollupEventInbox (proxy) Contract created at address:', + rollupEventInbox + ) + console.log( + 'challengeManager (proxy) Contract created at address:', + challengeManager + ) + console.log('AdminProxy Contract created at address:', adminProxy) + console.log('SequencerInbox (proxy) created at address:', sequencerInbox) + console.log('Bridge (proxy) Contract created at address:', bridge) + console.log('ValidatorUtils Contract created at address:', validatorUtils) + console.log( + 'ValidatorWalletCreator Contract created at address:', + validatorWalletCreator + ) + + const blockNumber = createRollupReceipt.blockNumber + console.log('All deployed at block number:', blockNumber) + } else { + console.error('RollupCreated event not found') + } + } catch (error) { + console.error( + 'Deployment failed:', + error instanceof Error ? error.message : error + ) + } +} + +main() + .then(() => process.exit(0)) + .catch((error: Error) => { + console.error(error) + process.exit(1) + }) diff --git a/src/bridge/Bridge.sol b/src/bridge/Bridge.sol index e8a6764e..31b41554 100644 --- a/src/bridge/Bridge.sol +++ b/src/bridge/Bridge.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; diff --git a/src/bridge/IBridge.sol b/src/bridge/IBridge.sol index 5e318c3a..f1fff13c 100644 --- a/src/bridge/IBridge.sol +++ b/src/bridge/IBridge.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 // solhint-disable-next-line compiler-version diff --git a/src/bridge/IDelayedMessageProvider.sol b/src/bridge/IDelayedMessageProvider.sol index 9e650c87..a03601aa 100644 --- a/src/bridge/IDelayedMessageProvider.sol +++ b/src/bridge/IDelayedMessageProvider.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 // solhint-disable-next-line compiler-version diff --git a/src/bridge/IInbox.sol b/src/bridge/IInbox.sol index ba424b6b..95c3128c 100644 --- a/src/bridge/IInbox.sol +++ b/src/bridge/IInbox.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 // solhint-disable-next-line compiler-version diff --git a/src/bridge/IOutbox.sol b/src/bridge/IOutbox.sol index 78f36767..3a551ce6 100644 --- a/src/bridge/IOutbox.sol +++ b/src/bridge/IOutbox.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 // solhint-disable-next-line compiler-version diff --git a/src/bridge/IOwnable.sol b/src/bridge/IOwnable.sol index 20735f0d..10bfc5e9 100644 --- a/src/bridge/IOwnable.sol +++ b/src/bridge/IOwnable.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 // solhint-disable-next-line compiler-version diff --git a/src/bridge/ISequencerInbox.sol b/src/bridge/ISequencerInbox.sol index 55454a88..5f19471e 100644 --- a/src/bridge/ISequencerInbox.sol +++ b/src/bridge/ISequencerInbox.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 // solhint-disable-next-line compiler-version diff --git a/src/bridge/Inbox.sol b/src/bridge/Inbox.sol index 4cf65492..9e718b66 100644 --- a/src/bridge/Inbox.sol +++ b/src/bridge/Inbox.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; @@ -35,7 +35,7 @@ import { L2MessageType_unsignedEOATx, L2MessageType_unsignedContractTx } from "../libraries/MessageTypes.sol"; -import {MAX_DATA_SIZE, UNISWAP_L1_TIMELOCK, UNISWAP_L2_FACTORY} from "../libraries/Constants.sol"; +import {MAX_DATA_SIZE} from "../libraries/Constants.sol"; import "../precompiles/ArbSys.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; @@ -527,84 +527,6 @@ contract Inbox is DelegateCallAware, PausableUpgradeable, IInbox { ); } - /// @notice This is an one-time-exception to resolve a misconfiguration of Uniswap Arbitrum deployment - /// Only the Uniswap L1 Timelock may call this function and it is allowed to create a crosschain - /// retryable ticket without address aliasing. More info here: - /// https://gov.uniswap.org/t/consensus-check-fix-the-cross-chain-messaging-bridge-on-arbitrum/18547 - /// @dev This function will be removed in future releases - function uniswapCreateRetryableTicket( - address to, - uint256 l2CallValue, - uint256 maxSubmissionCost, - address excessFeeRefundAddress, - address callValueRefundAddress, - uint256 gasLimit, - uint256 maxFeePerGas, - bytes calldata data - ) external payable whenNotPaused onlyAllowed returns (uint256) { - // this can only be called by UNISWAP_L1_TIMELOCK - require(msg.sender == UNISWAP_L1_TIMELOCK, "NOT_UNISWAP_L1_TIMELOCK"); - // the retryable can only call UNISWAP_L2_FACTORY - require(to == UNISWAP_L2_FACTORY, "NOT_TO_UNISWAP_L2_FACTORY"); - - // ensure the user's deposit alone will make submission succeed - if (msg.value < (maxSubmissionCost + l2CallValue + gasLimit * maxFeePerGas)) { - revert InsufficientValue( - maxSubmissionCost + l2CallValue + gasLimit * maxFeePerGas, - msg.value - ); - } - - // if a refund address is a contract, we apply the alias to it - // so that it can access its funds on the L2 - // since the beneficiary and other refund addresses don't get rewritten by arb-os - if (AddressUpgradeable.isContract(excessFeeRefundAddress)) { - excessFeeRefundAddress = AddressAliasHelper.applyL1ToL2Alias(excessFeeRefundAddress); - } - if (AddressUpgradeable.isContract(callValueRefundAddress)) { - // this is the beneficiary. be careful since this is the address that can cancel the retryable in the L2 - callValueRefundAddress = AddressAliasHelper.applyL1ToL2Alias(callValueRefundAddress); - } - - // gas price and limit of 1 should never be a valid input, so instead they are used as - // magic values to trigger a revert in eth calls that surface data without requiring a tx trace - if (gasLimit == 1 || maxFeePerGas == 1) - revert RetryableData( - msg.sender, - to, - l2CallValue, - msg.value, - maxSubmissionCost, - excessFeeRefundAddress, - callValueRefundAddress, - gasLimit, - maxFeePerGas, - data - ); - - uint256 submissionFee = calculateRetryableSubmissionFee(data.length, block.basefee); - if (maxSubmissionCost < submissionFee) - revert InsufficientSubmissionCost(submissionFee, maxSubmissionCost); - - return - _deliverMessage( - L1MessageType_submitRetryableTx, - AddressAliasHelper.undoL1ToL2Alias(msg.sender), - abi.encodePacked( - uint256(uint160(to)), - l2CallValue, - msg.value, - maxSubmissionCost, - uint256(uint160(excessFeeRefundAddress)), - uint256(uint160(callValueRefundAddress)), - gasLimit, - maxFeePerGas, - data.length, - data - ) - ); - } - function _deliverMessage( uint8 _kind, address _sender, diff --git a/src/bridge/Messages.sol b/src/bridge/Messages.sol index 6e193b7d..07731c51 100644 --- a/src/bridge/Messages.sol +++ b/src/bridge/Messages.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/bridge/Outbox.sol b/src/bridge/Outbox.sol index b0b4bbe0..9020e660 100644 --- a/src/bridge/Outbox.sol +++ b/src/bridge/Outbox.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index 9b28ef41..2ba25c16 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; @@ -28,6 +28,7 @@ import "./ISequencerInbox.sol"; import "../rollup/IRollupLogic.sol"; import "./Messages.sol"; import "../precompiles/ArbGasInfo.sol"; +import "../precompiles/ArbSys.sol"; import {L1MessageType_batchPostingReport} from "../libraries/MessageTypes.sol"; import {GasRefundEnabled, IGasRefunder} from "../libraries/IGasRefunder.sol"; @@ -454,9 +455,13 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox require(keysetBytes.length < 64 * 1024, "keyset is too large"); if (dasKeySetInfo[ksHash].isValidKeyset) revert AlreadyValidDASKeyset(ksHash); + uint256 creationBlock = block.number; + if (hostChainIsArbitrum) { + creationBlock = ArbSys(address(100)).arbBlockNumber(); + } dasKeySetInfo[ksHash] = DasKeySetInfo({ isValidKeyset: true, - creationBlock: uint64(block.number) + creationBlock: uint64(creationBlock) }); emit SetValidKeyset(ksHash, keysetBytes); emit OwnerFunctionCalled(2); diff --git a/src/challenge/ChallengeLib.sol b/src/challenge/ChallengeLib.sol index 07feffa6..eb1f1bd4 100644 --- a/src/challenge/ChallengeLib.sol +++ b/src/challenge/ChallengeLib.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/challenge/ChallengeManager.sol b/src/challenge/ChallengeManager.sol index 8c97e53e..12cad085 100644 --- a/src/challenge/ChallengeManager.sol +++ b/src/challenge/ChallengeManager.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/challenge/IChallengeManager.sol b/src/challenge/IChallengeManager.sol index ca46a68e..b6f63d67 100644 --- a/src/challenge/IChallengeManager.sol +++ b/src/challenge/IChallengeManager.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/challenge/IChallengeResultReceiver.sol b/src/challenge/IChallengeResultReceiver.sol index 6533dfa3..264a0ae2 100644 --- a/src/challenge/IChallengeResultReceiver.sol +++ b/src/challenge/IChallengeResultReceiver.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/libraries/AddressAliasHelper.sol b/src/libraries/AddressAliasHelper.sol index a9b7dcbd..9320fe3e 100644 --- a/src/libraries/AddressAliasHelper.sol +++ b/src/libraries/AddressAliasHelper.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/libraries/AdminFallbackProxy.sol b/src/libraries/AdminFallbackProxy.sol index 52dc9bff..7f1bb511 100644 --- a/src/libraries/AdminFallbackProxy.sol +++ b/src/libraries/AdminFallbackProxy.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/libraries/Constants.sol b/src/libraries/Constants.sol index 7fc7f875..d15bdf16 100644 --- a/src/libraries/Constants.sol +++ b/src/libraries/Constants.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; @@ -11,6 +11,3 @@ uint64 constant NO_CHAL_INDEX = 0; // Expected seconds per block in Ethereum PoS uint256 constant ETH_POS_BLOCK_TIME = 12; - -address constant UNISWAP_L1_TIMELOCK = 0x1a9C8182C09F50C8318d769245beA52c32BE35BC; -address constant UNISWAP_L2_FACTORY = 0x1F98431c8aD98523631AE4a59f267346ea31F984; diff --git a/src/libraries/CryptographyPrimitives.sol b/src/libraries/CryptographyPrimitives.sol index ba1e41fe..c77ad7c1 100644 --- a/src/libraries/CryptographyPrimitives.sol +++ b/src/libraries/CryptographyPrimitives.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/libraries/DelegateCallAware.sol b/src/libraries/DelegateCallAware.sol index bbedcf98..c5168aa1 100644 --- a/src/libraries/DelegateCallAware.sol +++ b/src/libraries/DelegateCallAware.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/libraries/DoubleLogicUUPSUpgradeable.sol b/src/libraries/DoubleLogicUUPSUpgradeable.sol index fb616878..c9bf3040 100644 --- a/src/libraries/DoubleLogicUUPSUpgradeable.sol +++ b/src/libraries/DoubleLogicUUPSUpgradeable.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/libraries/Error.sol b/src/libraries/Error.sol index 7aeef802..2114aa1e 100644 --- a/src/libraries/Error.sol +++ b/src/libraries/Error.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; diff --git a/src/libraries/IGasRefunder.sol b/src/libraries/IGasRefunder.sol index 99e48bf5..e7b08656 100644 --- a/src/libraries/IGasRefunder.sol +++ b/src/libraries/IGasRefunder.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 // solhint-disable-next-line compiler-version diff --git a/src/libraries/MerkleLib.sol b/src/libraries/MerkleLib.sol index 344bad3e..fd80196f 100644 --- a/src/libraries/MerkleLib.sol +++ b/src/libraries/MerkleLib.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; diff --git a/src/libraries/MessageTypes.sol b/src/libraries/MessageTypes.sol index 093cb332..d7a6a812 100644 --- a/src/libraries/MessageTypes.sol +++ b/src/libraries/MessageTypes.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; diff --git a/src/mocks/BridgeStub.sol b/src/mocks/BridgeStub.sol index 261cfabf..d0f9e8cc 100644 --- a/src/mocks/BridgeStub.sol +++ b/src/mocks/BridgeStub.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/mocks/BridgeUnproxied.sol b/src/mocks/BridgeUnproxied.sol index 84b44733..75aecfe1 100644 --- a/src/mocks/BridgeUnproxied.sol +++ b/src/mocks/BridgeUnproxied.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/mocks/InboxStub.sol b/src/mocks/InboxStub.sol index 3b183883..a31f33ef 100644 --- a/src/mocks/InboxStub.sol +++ b/src/mocks/InboxStub.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/mocks/MockResultReceiver.sol b/src/mocks/MockResultReceiver.sol index 1b2fd1a2..46a4dd11 100644 --- a/src/mocks/MockResultReceiver.sol +++ b/src/mocks/MockResultReceiver.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/mocks/ProxyAdminForBinding.sol b/src/mocks/ProxyAdminForBinding.sol index 4311e880..4d770ab3 100644 --- a/src/mocks/ProxyAdminForBinding.sol +++ b/src/mocks/ProxyAdminForBinding.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/mocks/SequencerInboxStub.sol b/src/mocks/SequencerInboxStub.sol index 20d5e9f0..c476043b 100644 --- a/src/mocks/SequencerInboxStub.sol +++ b/src/mocks/SequencerInboxStub.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/mocks/Simple.sol b/src/mocks/Simple.sol index 25d4b67b..a97e1d0c 100644 --- a/src/mocks/Simple.sol +++ b/src/mocks/Simple.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; @@ -30,6 +30,8 @@ contract Simple { } function incrementRedeem() external { + require(msg.sender == tx.origin, "SENDER_NOT_ORIGIN"); + require(ArbSys(address(0x64)).wasMyCallersAddressAliased(), "NOT_ALIASED"); counter++; emit RedeemedEvent(msg.sender, ArbRetryableTx(address(110)).getCurrentRedeemer()); } diff --git a/src/mocks/SimpleProxy.sol b/src/mocks/SimpleProxy.sol index 6c44c86e..e69f891c 100644 --- a/src/mocks/SimpleProxy.sol +++ b/src/mocks/SimpleProxy.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/mocks/SingleExecutionChallenge.sol b/src/mocks/SingleExecutionChallenge.sol index 696567ad..cd44ce1e 100644 --- a/src/mocks/SingleExecutionChallenge.sol +++ b/src/mocks/SingleExecutionChallenge.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/mocks/TimedOutChallengeManager.sol b/src/mocks/TimedOutChallengeManager.sol index 2dbe10f0..83e0457f 100644 --- a/src/mocks/TimedOutChallengeManager.sol +++ b/src/mocks/TimedOutChallengeManager.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/node-interface/NodeInterface.sol b/src/node-interface/NodeInterface.sol index f74c5a4c..9f3ec1d2 100644 --- a/src/node-interface/NodeInterface.sol +++ b/src/node-interface/NodeInterface.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/node-interface/NodeInterfaceDebug.sol b/src/node-interface/NodeInterfaceDebug.sol index 323b324a..faeacb74 100644 --- a/src/node-interface/NodeInterfaceDebug.sol +++ b/src/node-interface/NodeInterfaceDebug.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/osp/HashProofHelper.sol b/src/osp/HashProofHelper.sol index 4d37aa9b..b211908f 100644 --- a/src/osp/HashProofHelper.sol +++ b/src/osp/HashProofHelper.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/osp/IOneStepProofEntry.sol b/src/osp/IOneStepProofEntry.sol index c90bfd79..fb00b74f 100644 --- a/src/osp/IOneStepProofEntry.sol +++ b/src/osp/IOneStepProofEntry.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/osp/IOneStepProver.sol b/src/osp/IOneStepProver.sol index 202d5859..2e11e657 100644 --- a/src/osp/IOneStepProver.sol +++ b/src/osp/IOneStepProver.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/osp/OneStepProofEntry.sol b/src/osp/OneStepProofEntry.sol index c09f0056..c90480d7 100644 --- a/src/osp/OneStepProofEntry.sol +++ b/src/osp/OneStepProofEntry.sol @@ -1,5 +1,5 @@ // Copyright 2021-2023, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/osp/OneStepProver0.sol b/src/osp/OneStepProver0.sol index a7aee38b..2d116915 100644 --- a/src/osp/OneStepProver0.sol +++ b/src/osp/OneStepProver0.sol @@ -1,5 +1,5 @@ // Copyright 2021-2023, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/osp/OneStepProverHostIo.sol b/src/osp/OneStepProverHostIo.sol index f10c7ec1..d8d0d340 100644 --- a/src/osp/OneStepProverHostIo.sol +++ b/src/osp/OneStepProverHostIo.sol @@ -1,5 +1,5 @@ // Copyright 2021-2023, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/osp/OneStepProverMath.sol b/src/osp/OneStepProverMath.sol index 1a233474..c13dd894 100644 --- a/src/osp/OneStepProverMath.sol +++ b/src/osp/OneStepProverMath.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/osp/OneStepProverMemory.sol b/src/osp/OneStepProverMemory.sol index 7d396ad3..3c966049 100644 --- a/src/osp/OneStepProverMemory.sol +++ b/src/osp/OneStepProverMemory.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/precompiles/ArbAddressTable.sol b/src/precompiles/ArbAddressTable.sol index b0e8e97b..b37d949d 100644 --- a/src/precompiles/ArbAddressTable.sol +++ b/src/precompiles/ArbAddressTable.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/precompiles/ArbAggregator.sol b/src/precompiles/ArbAggregator.sol index 4c01f00b..c37af3ba 100644 --- a/src/precompiles/ArbAggregator.sol +++ b/src/precompiles/ArbAggregator.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/precompiles/ArbBLS.sol b/src/precompiles/ArbBLS.sol index c85d0c8d..9aef25ce 100644 --- a/src/precompiles/ArbBLS.sol +++ b/src/precompiles/ArbBLS.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/precompiles/ArbDebug.sol b/src/precompiles/ArbDebug.sol index 68c67e21..9924eded 100644 --- a/src/precompiles/ArbDebug.sol +++ b/src/precompiles/ArbDebug.sol @@ -1,5 +1,5 @@ -// Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE +// Copyright 2021-2023, 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.4.21 <0.9.0; diff --git a/src/precompiles/ArbFunctionTable.sol b/src/precompiles/ArbFunctionTable.sol index 1b5e14b7..6ee07011 100644 --- a/src/precompiles/ArbFunctionTable.sol +++ b/src/precompiles/ArbFunctionTable.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/precompiles/ArbGasInfo.sol b/src/precompiles/ArbGasInfo.sol index ff91c037..31dd70ea 100644 --- a/src/precompiles/ArbGasInfo.sol +++ b/src/precompiles/ArbGasInfo.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; @@ -95,6 +95,14 @@ interface ArbGasInfo { /// @notice Get how slowly ArbOS updates its estimate of the L1 basefee function getL1BaseFeeEstimateInertia() external view returns (uint64); + /// @notice Get the L1 pricer reward rate, in wei per unit + /// Available in ArbOS version 11 + function getL1RewardRate() external view returns (uint64); + + /// @notice Get the L1 pricer reward recipient + /// Available in ArbOS version 11 + function getL1RewardRecipient() external view returns (address); + /// @notice Deprecated -- Same as getL1BaseFeeEstimate() function getL1GasPriceEstimate() external view returns (uint256); diff --git a/src/precompiles/ArbInfo.sol b/src/precompiles/ArbInfo.sol index 7668169a..ab7e7294 100644 --- a/src/precompiles/ArbInfo.sol +++ b/src/precompiles/ArbInfo.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/precompiles/ArbOwner.sol b/src/precompiles/ArbOwner.sol index 45a29703..86fee30c 100644 --- a/src/precompiles/ArbOwner.sol +++ b/src/precompiles/ArbOwner.sol @@ -1,5 +1,5 @@ // Copyright 2021-2023, Offchain Labs, Inc. -// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/precompiles/ArbOwnerPublic.sol b/src/precompiles/ArbOwnerPublic.sol index d6fd6831..1fbfdc03 100644 --- a/src/precompiles/ArbOwnerPublic.sol +++ b/src/precompiles/ArbOwnerPublic.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; @@ -10,6 +10,13 @@ interface ArbOwnerPublic { /// @notice See if the user is a chain owner function isChainOwner(address addr) external view returns (bool); + /** + * @notice Rectify the list of chain owners + * If successful, emits ChainOwnerRectified event + * Available in ArbOS version 11 + */ + function rectifyChainOwner(address ownerToRectify) external; + /// @notice Retrieves the list of chain owners function getAllChainOwners() external view returns (address[] memory); @@ -18,4 +25,6 @@ interface ArbOwnerPublic { /// @notice Get the infrastructure fee collector function getInfraFeeAccount() external view returns (address); + + event ChainOwnerRectified(address rectifiedOwner); } diff --git a/src/precompiles/ArbRetryableTx.sol b/src/precompiles/ArbRetryableTx.sol index 3de17ea1..0600f651 100644 --- a/src/precompiles/ArbRetryableTx.sol +++ b/src/precompiles/ArbRetryableTx.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/precompiles/ArbStatistics.sol b/src/precompiles/ArbStatistics.sol index 901dc5ca..d0a3da00 100644 --- a/src/precompiles/ArbStatistics.sol +++ b/src/precompiles/ArbStatistics.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/precompiles/ArbSys.sol b/src/precompiles/ArbSys.sol index ca2f316c..4e7a8f41 100644 --- a/src/precompiles/ArbSys.sol +++ b/src/precompiles/ArbSys.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/precompiles/ArbosTest.sol b/src/precompiles/ArbosTest.sol index b99dc142..b766fd01 100644 --- a/src/precompiles/ArbosTest.sol +++ b/src/precompiles/ArbosTest.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.4.21 <0.9.0; diff --git a/src/rollup/BridgeCreator.sol b/src/rollup/BridgeCreator.sol index 4c2c7ba7..1c2b60cd 100644 --- a/src/rollup/BridgeCreator.sol +++ b/src/rollup/BridgeCreator.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/Config.sol b/src/rollup/Config.sol index 41950a9b..269ecb5a 100644 --- a/src/rollup/Config.sol +++ b/src/rollup/Config.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/IRollupAdmin.sol b/src/rollup/IRollupAdmin.sol index 8420c29c..bdad07b3 100644 --- a/src/rollup/IRollupAdmin.sol +++ b/src/rollup/IRollupAdmin.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/IRollupCore.sol b/src/rollup/IRollupCore.sol index e17c27af..e50f7a4a 100644 --- a/src/rollup/IRollupCore.sol +++ b/src/rollup/IRollupCore.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/IRollupEventInbox.sol b/src/rollup/IRollupEventInbox.sol index 5c1111e0..beb1b4ed 100644 --- a/src/rollup/IRollupEventInbox.sol +++ b/src/rollup/IRollupEventInbox.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/IRollupLogic.sol b/src/rollup/IRollupLogic.sol index d413b277..bc1520be 100644 --- a/src/rollup/IRollupLogic.sol +++ b/src/rollup/IRollupLogic.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/Node.sol b/src/rollup/Node.sol index a5a50270..6961168a 100644 --- a/src/rollup/Node.sol +++ b/src/rollup/Node.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/RollupAdminLogic.sol b/src/rollup/RollupAdminLogic.sol index 44a9989c..b6c3771f 100644 --- a/src/rollup/RollupAdminLogic.sol +++ b/src/rollup/RollupAdminLogic.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/RollupCore.sol b/src/rollup/RollupCore.sol index d12fb149..1107f105 100644 --- a/src/rollup/RollupCore.sol +++ b/src/rollup/RollupCore.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index 58ef0909..93cf0bb2 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; @@ -11,14 +11,20 @@ import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.so import "@openzeppelin/contracts/access/Ownable.sol"; import "./RollupProxy.sol"; +import "./IRollupAdmin.sol"; contract RollupCreator is Ownable { event RollupCreated( address indexed rollupAddress, address inboxAddress, + address outbox, + address rollupEventInbox, + address challengeManager, address adminProxy, address sequencerInbox, - address bridge + address bridge, + address validatorUtils, + address validatorWalletCreator ); event TemplatesUpdated(); @@ -52,12 +58,24 @@ contract RollupCreator is Ownable { emit TemplatesUpdated(); } - // After this setup: - // Rollup should be the owner of bridge - // RollupOwner should be the owner of Rollup's ProxyAdmin - // RollupOwner should be the owner of Rollup - // Bridge should have a single inbox and outbox - function createRollup(Config memory config) external returns (address) { + /** + * @notice Create a new rollup + * @dev After this setup: + * @dev - Rollup should be the owner of bridge + * @dev - RollupOwner should be the owner of Rollup's ProxyAdmin + * @dev - RollupOwner should be the owner of Rollup + * @dev - Bridge should have a single inbox and outbox + * @dev - Validators and batch poster should be set if provided + * @param config The configuration for the rollup + * @param _batchPoster The address of the batch poster, not used when set to zero address + * @param _validators The list of validator addresses, not used when set to empty list + * @return The address of the newly created rollup + */ + function createRollup( + Config memory config, + address _batchPoster, + address[] calldata _validators + ) external returns (address) { ProxyAdmin proxyAdmin = new ProxyAdmin(); // Create the rollup proxy to figure out the address and initialize it later @@ -75,8 +93,6 @@ contract RollupCreator is Ownable { config.sequencerInboxMaxTimeVariation ); - proxyAdmin.transferOwnership(config.owner); - IChallengeManager challengeManager = IChallengeManager( address( new TransparentUpgradeableProxy( @@ -93,6 +109,12 @@ contract RollupCreator is Ownable { osp ); + proxyAdmin.transferOwnership(config.owner); + + // initialize the rollup with this contract as owner to set batch poster and validators + // it will transfer the ownership back to the actual owner later + address actualOwner = config.owner; + config.owner = address(this); rollup.initializeProxy( config, ContractDependencies({ @@ -109,12 +131,33 @@ contract RollupCreator is Ownable { }) ); + // setting batch poster, if the address provided is not zero address + if (_batchPoster != address(0)) { + sequencerInbox.setIsBatchPoster(_batchPoster, true); + } + + // Call setValidator on the newly created rollup contract just if validator set is not empty + if (_validators.length != 0) { + bool[] memory _vals = new bool[](_validators.length); + for (uint256 i = 0; i < _validators.length; i++) { + _vals[i] = true; + } + IRollupAdmin(address(rollup)).setValidator(_validators, _vals); + } + + IRollupAdmin(address(rollup)).setOwner(actualOwner); + emit RollupCreated( address(rollup), address(inbox), + address(outbox), + address(rollupEventInbox), + address(challengeManager), address(proxyAdmin), address(sequencerInbox), - address(bridge) + address(bridge), + address(validatorUtils), + address(validatorWalletCreator) ); return address(rollup); } diff --git a/src/rollup/RollupEventInbox.sol b/src/rollup/RollupEventInbox.sol index 3a56288d..ff7a727c 100644 --- a/src/rollup/RollupEventInbox.sol +++ b/src/rollup/RollupEventInbox.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/RollupLib.sol b/src/rollup/RollupLib.sol index 8120fe83..82b9571d 100644 --- a/src/rollup/RollupLib.sol +++ b/src/rollup/RollupLib.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/RollupProxy.sol b/src/rollup/RollupProxy.sol index 110dd399..2938a585 100644 --- a/src/rollup/RollupProxy.sol +++ b/src/rollup/RollupProxy.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/RollupUserLogic.sol b/src/rollup/RollupUserLogic.sol index 00145fa2..bd16ad5e 100644 --- a/src/rollup/RollupUserLogic.sol +++ b/src/rollup/RollupUserLogic.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/ValidatorUtils.sol b/src/rollup/ValidatorUtils.sol index a7bb7d9d..75d554bb 100644 --- a/src/rollup/ValidatorUtils.sol +++ b/src/rollup/ValidatorUtils.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/ValidatorWallet.sol b/src/rollup/ValidatorWallet.sol index fbde488a..9b8c2296 100644 --- a/src/rollup/ValidatorWallet.sol +++ b/src/rollup/ValidatorWallet.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/rollup/ValidatorWalletCreator.sol b/src/rollup/ValidatorWalletCreator.sol index 325b2077..ce801eb0 100644 --- a/src/rollup/ValidatorWalletCreator.sol +++ b/src/rollup/ValidatorWalletCreator.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/Deserialize.sol b/src/state/Deserialize.sol index e63e4930..5ab44045 100644 --- a/src/state/Deserialize.sol +++ b/src/state/Deserialize.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/GlobalState.sol b/src/state/GlobalState.sol index 46a9be1a..ceea6065 100644 --- a/src/state/GlobalState.sol +++ b/src/state/GlobalState.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/Instructions.sol b/src/state/Instructions.sol index a2c63ed3..13447d63 100644 --- a/src/state/Instructions.sol +++ b/src/state/Instructions.sol @@ -1,5 +1,5 @@ // Copyright 2021-2023, Offchain Labs, Inc. -// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/Machine.sol b/src/state/Machine.sol index d315586f..d2a3b286 100644 --- a/src/state/Machine.sol +++ b/src/state/Machine.sol @@ -1,5 +1,5 @@ // Copyright 2021-2023, Offchain Labs, Inc. -// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/MerkleProof.sol b/src/state/MerkleProof.sol index ea0b4dad..645c9b64 100644 --- a/src/state/MerkleProof.sol +++ b/src/state/MerkleProof.sol @@ -1,5 +1,5 @@ // Copyright 2021-2023, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/Module.sol b/src/state/Module.sol index 4dc4cf5c..dc4776c7 100644 --- a/src/state/Module.sol +++ b/src/state/Module.sol @@ -1,5 +1,5 @@ // Copyright 2021-2023, Offchain Labs, Inc. -// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/ModuleMemory.sol b/src/state/ModuleMemory.sol index f240d354..0f7317ed 100644 --- a/src/state/ModuleMemory.sol +++ b/src/state/ModuleMemory.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/ModuleMemoryCompact.sol b/src/state/ModuleMemoryCompact.sol index 935fdf38..62715477 100644 --- a/src/state/ModuleMemoryCompact.sol +++ b/src/state/ModuleMemoryCompact.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/PcArray.sol b/src/state/PcArray.sol index d76465a3..d36076db 100644 --- a/src/state/PcArray.sol +++ b/src/state/PcArray.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/StackFrame.sol b/src/state/StackFrame.sol index 86b2762c..eb72fe0d 100644 --- a/src/state/StackFrame.sol +++ b/src/state/StackFrame.sol @@ -1,5 +1,5 @@ // Copyright 2021-2023, Offchain Labs, Inc. -// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/Value.sol b/src/state/Value.sol index 8f307056..ca1b1a19 100644 --- a/src/state/Value.sol +++ b/src/state/Value.sol @@ -1,5 +1,5 @@ // Copyright 2021-2023, Offchain Labs, Inc. -// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/ValueArray.sol b/src/state/ValueArray.sol index 89833182..c4239f6c 100644 --- a/src/state/ValueArray.sol +++ b/src/state/ValueArray.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/state/ValueStack.sol b/src/state/ValueStack.sol index 0814d9c8..4ba135fb 100644 --- a/src/state/ValueStack.sol +++ b/src/state/ValueStack.sol @@ -1,5 +1,5 @@ // Copyright 2021-2023, Offchain Labs, Inc. -// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/test-helpers/BridgeTester.sol b/src/test-helpers/BridgeTester.sol index 51454eb5..b355c51c 100644 --- a/src/test-helpers/BridgeTester.sol +++ b/src/test-helpers/BridgeTester.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; diff --git a/src/test-helpers/CryptographyPrimitivesTester.sol b/src/test-helpers/CryptographyPrimitivesTester.sol index c0569809..d587e1ec 100644 --- a/src/test-helpers/CryptographyPrimitivesTester.sol +++ b/src/test-helpers/CryptographyPrimitivesTester.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/test-helpers/InterfaceCompatibilityTester.sol b/src/test-helpers/InterfaceCompatibilityTester.sol index 1c6ae155..ba637705 100644 --- a/src/test-helpers/InterfaceCompatibilityTester.sol +++ b/src/test-helpers/InterfaceCompatibilityTester.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 // solhint-disable-next-line compiler-version diff --git a/src/test-helpers/MessageTester.sol b/src/test-helpers/MessageTester.sol index b8070dea..1dc5cbff 100644 --- a/src/test-helpers/MessageTester.sol +++ b/src/test-helpers/MessageTester.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/src/test-helpers/OutboxWithoutOptTester.sol b/src/test-helpers/OutboxWithoutOptTester.sol index 09b9d60e..50f378ac 100644 --- a/src/test-helpers/OutboxWithoutOptTester.sol +++ b/src/test-helpers/OutboxWithoutOptTester.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; diff --git a/src/test-helpers/RollupMock.sol b/src/test-helpers/RollupMock.sol index fe701827..085b9c00 100644 --- a/src/test-helpers/RollupMock.sol +++ b/src/test-helpers/RollupMock.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; diff --git a/src/test-helpers/ValueArrayTester.sol b/src/test-helpers/ValueArrayTester.sol index 8a614570..048b76af 100644 --- a/src/test-helpers/ValueArrayTester.sol +++ b/src/test-helpers/ValueArrayTester.sol @@ -1,5 +1,5 @@ // Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index ad71ad1e..ba417541 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -15,20 +15,16 @@ */ /* eslint-env node, mocha */ -import { ethers, run, network } from 'hardhat' +import { ethers, run } from 'hardhat' import { Signer } from '@ethersproject/abstract-signer' import { BigNumberish, BigNumber } from '@ethersproject/bignumber' -import { BytesLike, hexConcat, zeroPad } from '@ethersproject/bytes' +import { BytesLike } from '@ethersproject/bytes' import { ContractTransaction } from '@ethersproject/contracts' import { assert, expect } from 'chai' import { - Bridge, BridgeCreator__factory, - Bridge__factory, ChallengeManager, ChallengeManager__factory, - Inbox, - Inbox__factory, OneStepProofEntry__factory, OneStepProver0__factory, OneStepProverHostIo__factory, @@ -82,8 +78,6 @@ let sequencerInbox: SequencerInbox let admin: Signer let sequencer: Signer let challengeManager: ChallengeManager -let delayedInbox: Inbox -let bridge: Bridge async function getDefaultConfig( _confirmPeriodBlocks = confirmationPeriodBlocks @@ -182,7 +176,12 @@ const setup = async () => { ethers.constants.AddressZero ) - const response = await rollupCreator.createRollup(await getDefaultConfig()) + const response = await rollupCreator.createRollup( + await getDefaultConfig(), + await sequencer.getAddress(), + [await val1.getAddress(), await val2.getAddress(), await val3.getAddress()] + ) + const rec = await response.wait() const rollupCreatedEvent = rollupCreator.interface.parseLog( @@ -196,33 +195,18 @@ const setup = async () => { .attach(rollupCreatedEvent.rollupAddress) .connect(user) - await rollupAdmin.setValidator( - [await val1.getAddress(), await val2.getAddress(), await val3.getAddress()], - [true, true, true] - ) - sequencerInbox = ( (await ethers.getContractFactory( 'SequencerInbox' )) as SequencerInbox__factory ).attach(rollupCreatedEvent.sequencerInbox) - await sequencerInbox.setIsBatchPoster(await sequencer.getAddress(), true) - challengeManager = ( (await ethers.getContractFactory( 'ChallengeManager' )) as ChallengeManager__factory ).attach(await rollupUser.challengeManager()) - delayedInbox = ( - (await ethers.getContractFactory('Inbox')) as Inbox__factory - ).attach(rollupCreatedEvent.inboxAddress) - - bridge = ( - (await ethers.getContractFactory('Bridge')) as Bridge__factory - ).attach(rollupCreatedEvent.bridge) - return { admin, user, @@ -236,7 +220,7 @@ const setup = async () => { rollupUserLogicTemplate, blockChallengeFactory: challengeManagerTemplateFac, rollupEventBridge: await rollupAdmin.rollupEventInbox(), - outbox: await rollupAdmin.outbox(), + outbox: rollupCreatedEvent.outbox, sequencerInbox: rollupCreatedEvent.sequencerInbox, delayedBridge: rollupCreatedEvent.bridge, delayedInbox: rollupCreatedEvent.inboxAddress, @@ -1226,82 +1210,4 @@ describe('ArbRollup', () => { 'VALIDATOR_NOT_AFK' ) }) - - it('should fail to call uniswapCreateRetryableTicket with random signer', async function () { - const maxSubmissionCost = 10000 - await expect( - delayedInbox.uniswapCreateRetryableTicket( - ethers.constants.AddressZero, - 0, - maxSubmissionCost, - ethers.constants.AddressZero, - ethers.constants.AddressZero, - 0, - 0, - '0x', - { value: maxSubmissionCost } - ) - ).to.revertedWith('NOT_UNISWAP_L1_TIMELOCK') - }) - - it('should allow uniswap to call uniswapCreateRetryableTicket without aliasing to l2 factory only', async function () { - const uniswap_l1_timelock = '0x1a9C8182C09F50C8318d769245beA52c32BE35BC' - await network.provider.request({ - method: 'hardhat_impersonateAccount', - params: [uniswap_l1_timelock], - }) - await network.provider.send('hardhat_setBalance', [ - uniswap_l1_timelock, - '0x10000000000000000000', - ]) - const uniswap_signer = await ethers.getSigner(uniswap_l1_timelock) - const anyValue = () => true - const maxSubmissionCost = 10000 - await expect( - delayedInbox - .connect(uniswap_signer) - .uniswapCreateRetryableTicket( - ethers.constants.AddressZero, - 0, - maxSubmissionCost, - ethers.constants.AddressZero, - ethers.constants.AddressZero, - 0, - 0, - '0x', - { value: maxSubmissionCost } - ) - ).to.revertedWith('NOT_TO_UNISWAP_L2_FACTORY') - const uniswap_l2_factory = '0x1F98431c8aD98523631AE4a59f267346ea31F984' - await expect( - delayedInbox - .connect(uniswap_signer) - .uniswapCreateRetryableTicket( - uniswap_l2_factory, - 0, - maxSubmissionCost, - ethers.constants.AddressZero, - ethers.constants.AddressZero, - 0, - 0, - '0x', - { value: maxSubmissionCost } - ) - ) - .emit(bridge, 'MessageDelivered') - .withArgs( - anyValue, - anyValue, - anyValue, - anyValue, - uniswap_l1_timelock, - anyValue, - anyValue, - anyValue - ) - await network.provider.request({ - method: 'hardhat_stopImpersonatingAccount', - params: [uniswap_l1_timelock], - }) - }) })