From 350252ad7a3bbbf9a8718b997a727814f5419d0f Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Fri, 26 May 2023 18:36:51 -0700 Subject: [PATCH 01/41] deployment script added --- scripts/deployment.ts | 126 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 scripts/deployment.ts diff --git a/scripts/deployment.ts b/scripts/deployment.ts new file mode 100644 index 0000000000..12d9960402 --- /dev/null +++ b/scripts/deployment.ts @@ -0,0 +1,126 @@ +import { ethers } from "hardhat"; +import { ContractFactory, Contract, providers, Wallet } from "ethers"; +import "@nomiclabs/hardhat-ethers"; + + +async function deployContract(contractName: string, signer: any): Promise { + const factory: ContractFactory = await ethers.getContractFactory(contractName); + const connectedFactory: ContractFactory = factory.connect(signer); + const contract: Contract = await connectedFactory.deploy(); + await contract.deployTransaction.wait(); + console.log(`New ${contractName} created at address:`, contract.address); + return contract; +} + +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 OneStepProofEntryFactory: ContractFactory = await ethers.getContractFactory("OneStepProofEntry"); + const OneStepProofEntryFactoryWithDeployer: ContractFactory = OneStepProofEntryFactory.connect(signer); + const osp: Contract = await OneStepProofEntryFactoryWithDeployer.deploy( + prover0.address, + proverMem.address, + proverMath.address, + proverHostIo.address + ); + await osp.deployTransaction.wait(); + console.log("New osp created at address:", osp.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() { + // Get the signer (account) to deploy the contract + const privateKey = process.env.PRIVATE_KEY; + if (!privateKey) { + throw new Error("Private key is not defined"); + } + + const providerAPI = process.env.RPC_URL; + if (!providerAPI) { + throw new Error("RPC URL is not defined"); + } + + const provider = new providers.JsonRpcProvider(providerAPI) + const signer = new Wallet(privateKey, provider) + + try { + const contracts = await deployAllContracts(signer); + + // Call setTemplates with the deployed contract addresses + 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 + ); + + // Define the configuration for the createRollup function + const rollupConfig = { + confirmPeriodBlocks: 10, + extraChallengeTimeBlocks: 10, + stakeToken: ethers.constants.AddressZero, + baseStake: ethers.utils.parseEther("1"), + wasmModuleRoot: ethers.constants.HashZero, + owner: signer.address, + loserStakeEscrow: ethers.constants.AddressZero, + chainId: 5, + chainConfig:ethers.constants.HashZero, + genesisBlockNum: 0, + sequencerInboxMaxTimeVariation: { + delayBlocks: 10, + futureBlocks: 10, + delaySeconds: 60, + futureSeconds: 60, + }, + }; + + // Call the createRollup function + const createRollupTx = await contracts.rollupCreator.createRollup(rollupConfig); + const createRollupReceipt = await createRollupTx.wait(); + const rollupCreatedEvent = createRollupReceipt.events?.find( + (event: { event: string }) => event.event === "RollupCreated" + ); + + if (rollupCreatedEvent) { + const rollupAddress = rollupCreatedEvent.args?.rollupAddress; + console.log("Congratulations! πŸŽ‰πŸŽ‰πŸŽ‰ New rollup created at address:", rollupAddress); + } 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); + }); From 03ee4f1d139115210aae35d2c1cbcd19d83d4374 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Fri, 26 May 2023 23:47:52 -0700 Subject: [PATCH 02/41] adding gas limit to txs --- scripts/deployment.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/deployment.ts b/scripts/deployment.ts index 12d9960402..9f031d1182 100644 --- a/scripts/deployment.ts +++ b/scripts/deployment.ts @@ -68,7 +68,8 @@ async function main() { try { const contracts = await deployAllContracts(signer); - // Call setTemplates with the deployed contract addresses + // 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, @@ -77,8 +78,9 @@ async function main() { contracts.rollupUser.address, contracts.validatorUtils.address, contracts.validatorWalletCreator.address + , {gasLimit: ethers.BigNumber.from("15000000")} ); - + console.log("Template is set on the Rollup Creator") // Define the configuration for the createRollup function const rollupConfig = { confirmPeriodBlocks: 10, @@ -98,9 +100,11 @@ async function main() { futureSeconds: 60, }, }; - + + // Call the createRollup function - const createRollupTx = await contracts.rollupCreator.createRollup(rollupConfig); + console.log("Calling createRollup to generate a new rollup ...") + const createRollupTx = await contracts.rollupCreator.createRollup(rollupConfig, {gasLimit: ethers.BigNumber.from("15000000")}); const createRollupReceipt = await createRollupTx.wait(); const rollupCreatedEvent = createRollupReceipt.events?.find( (event: { event: string }) => event.event === "RollupCreated" From 84e38e204235730d2a05a35ac9937495519eab68 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Sat, 27 May 2023 19:02:12 -0700 Subject: [PATCH 03/41] config, comments and some edits --- scripts/deployment.ts | 54 ++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/scripts/deployment.ts b/scripts/deployment.ts index 9f031d1182..a63b214156 100644 --- a/scripts/deployment.ts +++ b/scripts/deployment.ts @@ -51,7 +51,8 @@ async function deployAllContracts(signer: any): Promise } async function main() { - // Get the signer (account) to deploy the contract + + // Get the private key and RPC to deploy the contract const privateKey = process.env.PRIVATE_KEY; if (!privateKey) { throw new Error("Private key is not defined"); @@ -66,9 +67,14 @@ async function main() { const signer = new Wallet(privateKey, provider) try { + + // Deploying all contracts const contracts = await deployAllContracts(signer); - // Call setTemplates with the deployed contract addresses + /* + * Call setTemplates with the deployed contract addresses + * Adding 15 million gas limit otherwise it'll be reverted with "gas exceeds block gas limit" error + */ console.log("Waiting for the Template to be set on the Rollup Creator") await contracts.rollupCreator.setTemplates( contracts.bridgeCreator.address, @@ -81,38 +87,58 @@ async function main() { , {gasLimit: ethers.BigNumber.from("15000000")} ); console.log("Template is set on the Rollup Creator") + // Define the configuration for the createRollup function const rollupConfig = { - confirmPeriodBlocks: 10, - extraChallengeTimeBlocks: 10, + confirmPeriodBlocks: 20, + extraChallengeTimeBlocks: 0, stakeToken: ethers.constants.AddressZero, baseStake: ethers.utils.parseEther("1"), - wasmModuleRoot: ethers.constants.HashZero, + wasmModuleRoot: "0xda4e3ad5e7feacb817c21c8d0220da7650fe9051ece68a3f0b1c5d38bbb27b21", owner: signer.address, loserStakeEscrow: ethers.constants.AddressZero, - chainId: 5, + chainId: 421613, chainConfig:ethers.constants.HashZero, genesisBlockNum: 0, sequencerInboxMaxTimeVariation: { - delayBlocks: 10, - futureBlocks: 10, - delaySeconds: 60, - futureSeconds: 60, + delayBlocks: 16, + futureBlocks: 192, + delaySeconds: 86400, + futureSeconds: 7200, }, }; - // Call the createRollup function - console.log("Calling createRollup to generate a new rollup ...") + /* + * Call the createRollup function + * Adding 15 million gas limit otherwise it'll be reverted with "gas exceeds block gas limit" error + */ + console.log("Calling createRollup to generate a new rollup ...") const createRollupTx = await contracts.rollupCreator.createRollup(rollupConfig, {gasLimit: ethers.BigNumber.from("15000000")}); const createRollupReceipt = await createRollupTx.wait(); const rollupCreatedEvent = createRollupReceipt.events?.find( (event: { event: string }) => event.event === "RollupCreated" ); + //Checking for RollupCreated event for new rollup address if (rollupCreatedEvent) { const rollupAddress = rollupCreatedEvent.args?.rollupAddress; - console.log("Congratulations! πŸŽ‰πŸŽ‰πŸŽ‰ New rollup created at address:", rollupAddress); + const inboxAddress = rollupCreatedEvent.args?.inboxAddress; + const adminProxy = rollupCreatedEvent.args?.adminProxy; + const sequencerInbox = rollupCreatedEvent.args?.sequencerInbox; + const bridge = rollupCreatedEvent.args?.bridge; + console.log("Congratulations! πŸŽ‰πŸŽ‰πŸŽ‰ All DONE! Here's your addresses:"); + console.log("Rollup Contract created at address:", rollupAddress); + console.log("Inbox Contract created at address:", inboxAddress); + console.log("Admin Proxy Contract created at address:", adminProxy); + console.log("Sequencer Contract Inbox created at address:", sequencerInbox); + console.log("Bridge Contract created at address:", bridge); + console.log("Utils Contract created at address:",contracts.validatorUtils.address); + console.log("ValidatorWalletCreator Contract created at address:",contracts.validatorWalletCreator.address); + + // getting the block number + const blockNumber = createRollupReceipt.blockNumber; + console.log("All deployed at block number:", blockNumber); } else { console.error("RollupCreated event not found"); } @@ -127,4 +153,4 @@ async function main() { .catch((error: Error) => { console.error(error); process.exit(1); - }); + }); \ No newline at end of file From d807163832b06e4abf89126377d18f91069a4839 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Mon, 12 Jun 2023 19:39:22 -0700 Subject: [PATCH 04/41] format fixed --- scripts/deployment.ts | 205 +++++++++++++++++++++++------------------- 1 file changed, 113 insertions(+), 92 deletions(-) diff --git a/scripts/deployment.ts b/scripts/deployment.ts index a63b214156..9aa062794d 100644 --- a/scripts/deployment.ts +++ b/scripts/deployment.ts @@ -1,39 +1,48 @@ -import { ethers } from "hardhat"; -import { ContractFactory, Contract, providers, Wallet } from "ethers"; -import "@nomiclabs/hardhat-ethers"; +import { ethers } from 'hardhat' +import { ContractFactory, Contract, providers, Wallet } from 'ethers' +import '@nomiclabs/hardhat-ethers' - -async function deployContract(contractName: string, signer: any): Promise { - const factory: ContractFactory = await ethers.getContractFactory(contractName); - const connectedFactory: ContractFactory = factory.connect(signer); - const contract: Contract = await connectedFactory.deploy(); - await contract.deployTransaction.wait(); - console.log(`New ${contractName} created at address:`, contract.address); - return contract; +async function deployContract( + contractName: string, + signer: any +): Promise { + const factory: ContractFactory = await ethers.getContractFactory(contractName) + const connectedFactory: ContractFactory = factory.connect(signer) + const contract: Contract = await connectedFactory.deploy() + await contract.deployTransaction.wait() + console.log(`New ${contractName} created at address:`, contract.address) + return contract } -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 OneStepProofEntryFactory: ContractFactory = await ethers.getContractFactory("OneStepProofEntry"); - const OneStepProofEntryFactoryWithDeployer: ContractFactory = OneStepProofEntryFactory.connect(signer); +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 OneStepProofEntryFactory: ContractFactory = + await ethers.getContractFactory('OneStepProofEntry') + const OneStepProofEntryFactoryWithDeployer: ContractFactory = + OneStepProofEntryFactory.connect(signer) const osp: Contract = await OneStepProofEntryFactoryWithDeployer.deploy( prover0.address, proverMem.address, proverMath.address, proverHostIo.address - ); - await osp.deployTransaction.wait(); - console.log("New osp created at address:", osp.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); + ) + await osp.deployTransaction.wait() + console.log('New osp created at address:', osp.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, @@ -47,35 +56,33 @@ async function deployAllContracts(signer: any): Promise validatorUtils, validatorWalletCreator, rollupCreator, - }; + } } async function main() { - // Get the private key and RPC to deploy the contract - const privateKey = process.env.PRIVATE_KEY; + const privateKey = process.env.PRIVATE_KEY if (!privateKey) { - throw new Error("Private key is not defined"); + throw new Error('Private key is not defined') } - const providerAPI = process.env.RPC_URL; + const providerAPI = process.env.RPC_URL if (!providerAPI) { - throw new Error("RPC URL is not defined"); + throw new Error('RPC URL is not defined') } const provider = new providers.JsonRpcProvider(providerAPI) const signer = new Wallet(privateKey, provider) try { - // Deploying all contracts - const contracts = await deployAllContracts(signer); - - /* - * Call setTemplates with the deployed contract addresses - * Adding 15 million gas limit otherwise it'll be reverted with "gas exceeds block gas limit" error - */ - console.log("Waiting for the Template to be set on the Rollup Creator") + const contracts = await deployAllContracts(signer) + + /* + * Call setTemplates with the deployed contract addresses + * Adding 15 million gas limit otherwise it'll be reverted with "gas exceeds block gas limit" error + */ + console.log('Waiting for the Template to be set on the Rollup Creator') await contracts.rollupCreator.setTemplates( contracts.bridgeCreator.address, contracts.osp.address, @@ -83,22 +90,23 @@ async function main() { contracts.rollupAdmin.address, contracts.rollupUser.address, contracts.validatorUtils.address, - contracts.validatorWalletCreator.address - , {gasLimit: ethers.BigNumber.from("15000000")} - ); - console.log("Template is set on the Rollup Creator") + contracts.validatorWalletCreator.address, + { gasLimit: ethers.BigNumber.from('15000000') } + ) + console.log('Template is set on the Rollup Creator') // Define the configuration for the createRollup function const rollupConfig = { confirmPeriodBlocks: 20, extraChallengeTimeBlocks: 0, stakeToken: ethers.constants.AddressZero, - baseStake: ethers.utils.parseEther("1"), - wasmModuleRoot: "0xda4e3ad5e7feacb817c21c8d0220da7650fe9051ece68a3f0b1c5d38bbb27b21", + baseStake: ethers.utils.parseEther('1'), + wasmModuleRoot: + '0xda4e3ad5e7feacb817c21c8d0220da7650fe9051ece68a3f0b1c5d38bbb27b21', owner: signer.address, loserStakeEscrow: ethers.constants.AddressZero, - chainId: 421613, - chainConfig:ethers.constants.HashZero, + chainId: 1337, + chainConfig: ethers.constants.HashZero, genesisBlockNum: 0, sequencerInboxMaxTimeVariation: { delayBlocks: 16, @@ -106,51 +114,64 @@ async function main() { delaySeconds: 86400, futureSeconds: 7200, }, - }; - + } - /* - * Call the createRollup function - * Adding 15 million gas limit otherwise it'll be reverted with "gas exceeds block gas limit" error - */ - console.log("Calling createRollup to generate a new rollup ...") - const createRollupTx = await contracts.rollupCreator.createRollup(rollupConfig, {gasLimit: ethers.BigNumber.from("15000000")}); - const createRollupReceipt = await createRollupTx.wait(); + /* + * Call the createRollup function + * Adding 15 million gas limit otherwise it'll be reverted with "gas exceeds block gas limit" error + */ + console.log('Calling createRollup to generate a new rollup ...') + const createRollupTx = await contracts.rollupCreator.createRollup( + rollupConfig, + { gasLimit: ethers.BigNumber.from('15000000') } + ) + const createRollupReceipt = await createRollupTx.wait() const rollupCreatedEvent = createRollupReceipt.events?.find( - (event: { event: string }) => event.event === "RollupCreated" - ); + (event: { event: string }) => event.event === 'RollupCreated' + ) - //Checking for RollupCreated event for new rollup address - if (rollupCreatedEvent) { - const rollupAddress = rollupCreatedEvent.args?.rollupAddress; - const inboxAddress = rollupCreatedEvent.args?.inboxAddress; - const adminProxy = rollupCreatedEvent.args?.adminProxy; - const sequencerInbox = rollupCreatedEvent.args?.sequencerInbox; - const bridge = rollupCreatedEvent.args?.bridge; - console.log("Congratulations! πŸŽ‰πŸŽ‰πŸŽ‰ All DONE! Here's your addresses:"); - console.log("Rollup Contract created at address:", rollupAddress); - console.log("Inbox Contract created at address:", inboxAddress); - console.log("Admin Proxy Contract created at address:", adminProxy); - console.log("Sequencer Contract Inbox created at address:", sequencerInbox); - console.log("Bridge Contract created at address:", bridge); - console.log("Utils Contract created at address:",contracts.validatorUtils.address); - console.log("ValidatorWalletCreator Contract created at address:",contracts.validatorWalletCreator.address); + //Checking for RollupCreated event for new rollup address + if (rollupCreatedEvent) { + const rollupAddress = rollupCreatedEvent.args?.rollupAddress + const inboxAddress = rollupCreatedEvent.args?.inboxAddress + const adminProxy = rollupCreatedEvent.args?.adminProxy + const sequencerInbox = rollupCreatedEvent.args?.sequencerInbox + const bridge = rollupCreatedEvent.args?.bridge + console.log("Congratulations! πŸŽ‰πŸŽ‰πŸŽ‰ All DONE! Here's your addresses:") + console.log('Rollup Contract created at address:', rollupAddress) + console.log('Inbox Contract created at address:', inboxAddress) + console.log('Admin Proxy Contract created at address:', adminProxy) + console.log( + 'Sequencer Contract Inbox created at address:', + sequencerInbox + ) + console.log('Bridge Contract created at address:', bridge) + console.log( + 'Utils Contract created at address:', + contracts.validatorUtils.address + ) + console.log( + 'ValidatorWalletCreator Contract created at address:', + contracts.validatorWalletCreator.address + ) - // getting the block number - 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); + // getting the block number + 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); - }); \ No newline at end of file +} + +main() + .then(() => process.exit(0)) + .catch((error: Error) => { + console.error(error) + process.exit(1) + }) From 35907b76cff38cd321452126e11a276a68c2d4df Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Wed, 14 Jun 2023 10:40:29 -0700 Subject: [PATCH 05/41] add check for event address --- scripts/deployment.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/deployment.ts b/scripts/deployment.ts index 9aa062794d..678af548a7 100644 --- a/scripts/deployment.ts +++ b/scripts/deployment.ts @@ -2,6 +2,19 @@ import { ethers } from 'hardhat' import { ContractFactory, Contract, providers, Wallet } from 'ethers' import '@nomiclabs/hardhat-ethers' +interface RollupCreatedEvent { + event: string; + address: string; + args?: { + rollupAddress: string; + inboxAddress: string; + adminProxy: string; + sequencerInbox: string; + bridge: string; + }; +} + + async function deployContract( contractName: string, signer: any @@ -126,10 +139,10 @@ async function main() { { gasLimit: ethers.BigNumber.from('15000000') } ) const createRollupReceipt = await createRollupTx.wait() + const rollupCreatedEvent = createRollupReceipt.events?.find( - (event: { event: string }) => event.event === 'RollupCreated' + (event: RollupCreatedEvent) => event.event === 'RollupCreated' && event.address.toLowerCase() === contracts.rollupCreator.address.toLowerCase() ) - //Checking for RollupCreated event for new rollup address if (rollupCreatedEvent) { const rollupAddress = rollupCreatedEvent.args?.rollupAddress From f19657644c4126cf1192efc7c1ac6c43b6bedaa0 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Wed, 14 Jun 2023 10:56:27 -0700 Subject: [PATCH 06/41] using hardhat network and signer --- scripts/deployment.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/scripts/deployment.ts b/scripts/deployment.ts index 678af548a7..2a3af69544 100644 --- a/scripts/deployment.ts +++ b/scripts/deployment.ts @@ -73,19 +73,8 @@ async function deployAllContracts( } async function main() { - // Get the private key and RPC to deploy the contract - const privateKey = process.env.PRIVATE_KEY - if (!privateKey) { - throw new Error('Private key is not defined') - } - - const providerAPI = process.env.RPC_URL - if (!providerAPI) { - throw new Error('RPC URL is not defined') - } - const provider = new providers.JsonRpcProvider(providerAPI) - const signer = new Wallet(privateKey, provider) + const [signer] = await ethers.getSigners() try { // Deploying all contracts From a24e89c9f696d6e9a632a9e40d833ee7a650de7f Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Wed, 14 Jun 2023 11:07:16 -0700 Subject: [PATCH 07/41] adding sepolia --- hardhat.config.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hardhat.config.ts b/hardhat.config.ts index 89fbc7a63c..76929c70bf 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'], From 8c92856808a8bad4e4048f5f35f94f0cdc7a38bd Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Wed, 14 Jun 2023 11:18:37 -0700 Subject: [PATCH 08/41] adding outbox address --- scripts/deployment.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/deployment.ts b/scripts/deployment.ts index 2a3af69544..a6936aff38 100644 --- a/scripts/deployment.ts +++ b/scripts/deployment.ts @@ -1,5 +1,5 @@ import { ethers } from 'hardhat' -import { ContractFactory, Contract, providers, Wallet } from 'ethers' +import { ContractFactory, Contract} from 'ethers' import '@nomiclabs/hardhat-ethers' interface RollupCreatedEvent { @@ -156,6 +156,10 @@ async function main() { 'ValidatorWalletCreator Contract created at address:', contracts.validatorWalletCreator.address ) + console.log( + 'outbox Contract created at address:', + await contracts.rollup.outbox() + ) // getting the block number const blockNumber = createRollupReceipt.blockNumber From b2dce25a60464d05d05bba1eda71363c905a6488 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Thu, 15 Jun 2023 11:46:32 -0700 Subject: [PATCH 09/41] editing stuff --- scripts/deployment.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/deployment.ts b/scripts/deployment.ts index a6936aff38..31d627b909 100644 --- a/scripts/deployment.ts +++ b/scripts/deployment.ts @@ -1,5 +1,5 @@ import { ethers } from 'hardhat' -import { ContractFactory, Contract} from 'ethers' +import { ContractFactory, Contract } from 'ethers' import '@nomiclabs/hardhat-ethers' interface RollupCreatedEvent { @@ -156,10 +156,6 @@ async function main() { 'ValidatorWalletCreator Contract created at address:', contracts.validatorWalletCreator.address ) - console.log( - 'outbox Contract created at address:', - await contracts.rollup.outbox() - ) // getting the block number const blockNumber = createRollupReceipt.blockNumber From 6a5f7bb4b562a7e667e4e18e087fefaab6714b00 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Thu, 22 Jun 2023 12:08:29 -0600 Subject: [PATCH 10/41] Add additional redeem checks to mock Simple.sol --- src/mocks/Simple.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mocks/Simple.sol b/src/mocks/Simple.sol index 25d4b67b50..3cdb99ac66 100644 --- a/src/mocks/Simple.sol +++ b/src/mocks/Simple.sol @@ -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()); } From 2ba206505edd15ad1e177392c454e89479959ca5 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Thu, 22 Jun 2023 15:27:34 -0600 Subject: [PATCH 11/41] Copy LICENSE over from the nitro repository --- LICENSE | 114 ++++++++++++++++++ src/bridge/Bridge.sol | 2 +- src/bridge/IBridge.sol | 2 +- src/bridge/IDelayedMessageProvider.sol | 2 +- src/bridge/IInbox.sol | 2 +- src/bridge/IOutbox.sol | 2 +- src/bridge/IOwnable.sol | 2 +- src/bridge/ISequencerInbox.sol | 2 +- src/bridge/Inbox.sol | 2 +- src/bridge/Messages.sol | 2 +- src/bridge/Outbox.sol | 2 +- src/bridge/SequencerInbox.sol | 2 +- src/challenge/ChallengeLib.sol | 2 +- src/challenge/ChallengeManager.sol | 2 +- src/challenge/IChallengeManager.sol | 2 +- src/challenge/IChallengeResultReceiver.sol | 2 +- src/libraries/AddressAliasHelper.sol | 2 +- src/libraries/AdminFallbackProxy.sol | 2 +- src/libraries/Constants.sol | 2 +- src/libraries/CryptographyPrimitives.sol | 2 +- src/libraries/DelegateCallAware.sol | 2 +- src/libraries/DoubleLogicUUPSUpgradeable.sol | 2 +- src/libraries/Error.sol | 2 +- src/libraries/IGasRefunder.sol | 2 +- src/libraries/MerkleLib.sol | 2 +- src/libraries/MessageTypes.sol | 2 +- src/mocks/BridgeStub.sol | 2 +- src/mocks/BridgeUnproxied.sol | 2 +- src/mocks/InboxStub.sol | 2 +- src/mocks/MockResultReceiver.sol | 2 +- src/mocks/ProxyAdminForBinding.sol | 2 +- src/mocks/SequencerInboxStub.sol | 2 +- src/mocks/Simple.sol | 2 +- src/mocks/SimpleProxy.sol | 2 +- src/mocks/SingleExecutionChallenge.sol | 2 +- src/mocks/TimedOutChallengeManager.sol | 2 +- src/node-interface/NodeInterface.sol | 2 +- src/node-interface/NodeInterfaceDebug.sol | 2 +- src/osp/HashProofHelper.sol | 2 +- src/osp/IOneStepProofEntry.sol | 2 +- src/osp/IOneStepProver.sol | 2 +- src/osp/OneStepProofEntry.sol | 2 +- src/osp/OneStepProver0.sol | 2 +- src/osp/OneStepProverHostIo.sol | 2 +- src/osp/OneStepProverMath.sol | 2 +- src/osp/OneStepProverMemory.sol | 2 +- src/precompiles/ArbAddressTable.sol | 2 +- src/precompiles/ArbAggregator.sol | 2 +- src/precompiles/ArbBLS.sol | 2 +- src/precompiles/ArbDebug.sol | 2 +- src/precompiles/ArbFunctionTable.sol | 2 +- src/precompiles/ArbGasInfo.sol | 2 +- src/precompiles/ArbInfo.sol | 2 +- src/precompiles/ArbOwner.sol | 2 +- src/precompiles/ArbOwnerPublic.sol | 2 +- src/precompiles/ArbRetryableTx.sol | 2 +- src/precompiles/ArbStatistics.sol | 2 +- src/precompiles/ArbSys.sol | 2 +- src/precompiles/ArbosTest.sol | 2 +- src/rollup/BridgeCreator.sol | 2 +- src/rollup/Config.sol | 2 +- src/rollup/IRollupAdmin.sol | 2 +- src/rollup/IRollupCore.sol | 2 +- src/rollup/IRollupEventInbox.sol | 2 +- src/rollup/IRollupLogic.sol | 2 +- src/rollup/Node.sol | 2 +- src/rollup/RollupAdminLogic.sol | 2 +- src/rollup/RollupCore.sol | 2 +- src/rollup/RollupCreator.sol | 2 +- src/rollup/RollupEventInbox.sol | 2 +- src/rollup/RollupLib.sol | 2 +- src/rollup/RollupProxy.sol | 2 +- src/rollup/RollupUserLogic.sol | 2 +- src/rollup/ValidatorUtils.sol | 2 +- src/rollup/ValidatorWallet.sol | 2 +- src/rollup/ValidatorWalletCreator.sol | 2 +- src/state/Deserialize.sol | 2 +- src/state/GlobalState.sol | 2 +- src/state/Instructions.sol | 2 +- src/state/Machine.sol | 2 +- src/state/MerkleProof.sol | 2 +- src/state/Module.sol | 2 +- src/state/ModuleMemory.sol | 2 +- src/state/ModuleMemoryCompact.sol | 2 +- src/state/PcArray.sol | 2 +- src/state/StackFrame.sol | 2 +- src/state/Value.sol | 2 +- src/state/ValueArray.sol | 2 +- src/state/ValueStack.sol | 2 +- src/test-helpers/BridgeTester.sol | 2 +- .../CryptographyPrimitivesTester.sol | 2 +- .../InterfaceCompatibilityTester.sol | 2 +- src/test-helpers/MessageTester.sol | 2 +- src/test-helpers/OutboxWithoutOptTester.sol | 2 +- src/test-helpers/RollupMock.sol | 2 +- src/test-helpers/ValueArrayTester.sol | 2 +- 96 files changed, 209 insertions(+), 95 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..8217feee40 --- /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/src/bridge/Bridge.sol b/src/bridge/Bridge.sol index e8a6764ee9..31b4155404 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 5e318c3a22..f1fff13c06 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 9e650c8726..a03601aa67 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 ba424b6bb4..95c3128cfa 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 78f36767f0..3a551ce65d 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 20735f0dd2..10bfc5e90f 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 55454a8892..5f19471e96 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 4cf6549279..aa23d07a21 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; diff --git a/src/bridge/Messages.sol b/src/bridge/Messages.sol index 6e193b7d64..07731c5172 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 b0b4bbe031..9020e660ac 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 c95cd70b72..d639a16c91 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; diff --git a/src/challenge/ChallengeLib.sol b/src/challenge/ChallengeLib.sol index e225ea1fe4..25ff894d8f 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 8c97e53eb2..12cad0852d 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 ca46a68ecb..b6f63d672c 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 6533dfa35d..264a0ae241 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 a9b7dcbd15..9320fe3e2b 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 52dc9bff9f..7f1bb5116a 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 7fc7f875bd..57dfec6f3c 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; diff --git a/src/libraries/CryptographyPrimitives.sol b/src/libraries/CryptographyPrimitives.sol index ba1e41fe14..c77ad7c1df 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 bbedcf98c8..c5168aa132 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 fb616878ab..c9bf304008 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 7aeef80295..2114aa1e0a 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 99e48bf57d..e7b0865654 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 344bad3e9f..fd80196f47 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 093cb332a2..d7a6a812a5 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 261cfabf30..d0f9e8ccaa 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 84b4473364..75aecfe141 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 3b1838839e..a31f33ef5d 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 1b2fd1a2f5..46a4dd1122 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 4311e88087..4d770ab349 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 20d5e9f050..c476043b1a 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 25d4b67b50..4ce8bc3cbf 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; diff --git a/src/mocks/SimpleProxy.sol b/src/mocks/SimpleProxy.sol index 6c44c86e13..e69f891cc5 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 696567adee..cd44ce1e9a 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 2dbe10f07e..83e0457f11 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 f74c5a4c8c..9f3ec1d2f0 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 323b324a1c..faeacb7468 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 4d37aa9b31..b211908f0e 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 c90bfd7913..fb00b74f00 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 202d58599b..2e11e6570f 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 bae84ca1ea..390727c341 100644 --- a/src/osp/OneStepProofEntry.sol +++ b/src/osp/OneStepProofEntry.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/OneStepProver0.sol b/src/osp/OneStepProver0.sol index 2767a8e980..107e497381 100644 --- a/src/osp/OneStepProver0.sol +++ b/src/osp/OneStepProver0.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/OneStepProverHostIo.sol b/src/osp/OneStepProverHostIo.sol index a2cb8e31ee..260ab20626 100644 --- a/src/osp/OneStepProverHostIo.sol +++ b/src/osp/OneStepProverHostIo.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/OneStepProverMath.sol b/src/osp/OneStepProverMath.sol index 1a23347463..c13dd89456 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 7d33d55e04..6fee2f932f 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 b0e8e97bf2..b37d949d38 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 4c01f00b6e..c37af3bae4 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 c85d0c8d3c..9aef25ce4a 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 3cfb3cf43f..9924ededc4 100644 --- a/src/precompiles/ArbDebug.sol +++ b/src/precompiles/ArbDebug.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/ArbFunctionTable.sol b/src/precompiles/ArbFunctionTable.sol index 1b5e14b764..6ee07011ad 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 ff91c037e4..a710688387 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; diff --git a/src/precompiles/ArbInfo.sol b/src/precompiles/ArbInfo.sol index 7668169ad3..ab7e7294fc 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 165039c9d6..46ac63c560 100644 --- a/src/precompiles/ArbOwner.sol +++ b/src/precompiles/ArbOwner.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/ArbOwnerPublic.sol b/src/precompiles/ArbOwnerPublic.sol index d6fd683128..270f5f247e 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; diff --git a/src/precompiles/ArbRetryableTx.sol b/src/precompiles/ArbRetryableTx.sol index 3de17ea12c..0600f6513a 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 901dc5ca91..d0a3da0016 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 ca2f316c50..4e7a8f41fc 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 b99dc142a8..b766fd015e 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 4c2c7ba7d7..1c2b60cd72 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 41950a9bd6..269ecb5a2e 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 8420c29c63..bdad07b339 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 e17c27af42..e50f7a4af6 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 5c1111e099..beb1b4ed2e 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 d413b2771e..bc1520be63 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 a5a5027055..6961168a06 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 44a9989c77..b6c3771fc7 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 ec417596cd..fabe83fb39 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 58ef0909fe..0d469a0558 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; diff --git a/src/rollup/RollupEventInbox.sol b/src/rollup/RollupEventInbox.sol index 9d7353fcca..4641930a66 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 8120fe838a..82b9571dc5 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 110dd3991e..2938a58517 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 00145fa2e4..bd16ad5ebd 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 a7bb7d9df4..75d554bb9c 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 fbde488a48..9b8c2296c8 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 325b2077ca..ce801eb02e 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 b0f1500724..75bf62bf14 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 46a9be1a4e..ceea606526 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 196899c93f..75452f77ef 100644 --- a/src/state/Instructions.sol +++ b/src/state/Instructions.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/Machine.sol b/src/state/Machine.sol index a7a5e9273d..9d80f45c9a 100644 --- a/src/state/Machine.sol +++ b/src/state/Machine.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/MerkleProof.sol b/src/state/MerkleProof.sol index 560e3913de..09c405b209 100644 --- a/src/state/MerkleProof.sol +++ b/src/state/MerkleProof.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/Module.sol b/src/state/Module.sol index 46d64de242..e21fb018df 100644 --- a/src/state/Module.sol +++ b/src/state/Module.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/ModuleMemory.sol b/src/state/ModuleMemory.sol index 76e64ec18f..1f0a4434d5 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 935fdf3812..6271547751 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 d76465a309..d36076db41 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 465d637625..083376ecdb 100644 --- a/src/state/StackFrame.sol +++ b/src/state/StackFrame.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/Value.sol b/src/state/Value.sol index 6e0a837b2b..a4cb832a3a 100644 --- a/src/state/Value.sol +++ b/src/state/Value.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/ValueArray.sol b/src/state/ValueArray.sol index 89833182a2..c4239f6caa 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 ccfe9ddc39..ce676bd0ea 100644 --- a/src/state/ValueStack.sol +++ b/src/state/ValueStack.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/BridgeTester.sol b/src/test-helpers/BridgeTester.sol index 51454eb51b..b355c51c84 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 c056980923..d587e1ec05 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 1c6ae155a9..ba63770585 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 b8070dea86..1dc5cbff5f 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 09b9d60e2f..50f378acee 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 fe701827b8..085b9c005c 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 8a614570b2..048b76af31 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; From 1a42df52086be787682372d5801bbe73394496cb Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Thu, 22 Jun 2023 23:13:24 -0700 Subject: [PATCH 12/41] changing the flow, adding verificatins, missing addresses etc. --- scripts/config.ts | 21 +++++ scripts/deployment.ts | 168 +++++++++++++++++--------------------- scripts/rollupCreation.ts | 124 ++++++++++++++++++++++++++++ 3 files changed, 221 insertions(+), 92 deletions(-) create mode 100644 scripts/config.ts create mode 100644 scripts/rollupCreation.ts diff --git a/scripts/config.ts b/scripts/config.ts new file mode 100644 index 0000000000..12317532e1 --- /dev/null +++ b/scripts/config.ts @@ -0,0 +1,21 @@ +import { ethers } from 'ethers' + +export const rollupConfig = { + confirmPeriodBlocks: ethers.BigNumber.from(''), + extraChallengeTimeBlocks: ethers.BigNumber.from(''), + stakeToken: '', + baseStake: ethers.utils.parseEther(''), + wasmModuleRoot: + '0xda4e3ad5e7feacb817c21c8d0220da7650fe9051ece68a3f0b1c5d38bbb27b21', + owner: '', + loserStakeEscrow: '', + chainId: ethers.BigNumber.from(''), + chainConfig: '', + genesisBlockNum: ethers.BigNumber.from(''), + sequencerInboxMaxTimeVariation: { + delayBlocks: ethers.BigNumber.from(''), + futureBlocks: ethers.BigNumber.from(''), + delaySeconds: ethers.BigNumber.from(''), + futureSeconds: ethers.BigNumber.from(''), + }, +} diff --git a/scripts/deployment.ts b/scripts/deployment.ts index 31d627b909..9a5bf94f82 100644 --- a/scripts/deployment.ts +++ b/scripts/deployment.ts @@ -1,32 +1,62 @@ import { ethers } from 'hardhat' import { ContractFactory, Contract } from 'ethers' import '@nomiclabs/hardhat-ethers' +import { run } from 'hardhat' -interface RollupCreatedEvent { - event: string; - address: string; - args?: { - rollupAddress: string; - inboxAddress: string; - adminProxy: string; - sequencerInbox: string; - bridge: string; - }; -} +// 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 + signer: any, + constructorArgs: any[] = [] ): Promise { const factory: ContractFactory = await ethers.getContractFactory(contractName) const connectedFactory: ContractFactory = factory.connect(signer) - const contract: Contract = await connectedFactory.deploy() + 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> { @@ -35,18 +65,12 @@ async function deployAllContracts( const proverMem = await deployContract('OneStepProverMemory', signer) const proverMath = await deployContract('OneStepProverMath', signer) const proverHostIo = await deployContract('OneStepProverHostIo', signer) - const OneStepProofEntryFactory: ContractFactory = - await ethers.getContractFactory('OneStepProofEntry') - const OneStepProofEntryFactoryWithDeployer: ContractFactory = - OneStepProofEntryFactory.connect(signer) - const osp: Contract = await OneStepProofEntryFactoryWithDeployer.deploy( + const osp: Contract = await deployContract('OneStepProofEntry', signer, [ prover0.address, proverMem.address, proverMath.address, - proverHostIo.address - ) - await osp.deployTransaction.wait() - console.log('New osp created at address:', osp.address) + proverHostIo.address, + ]) const challengeManager = await deployContract('ChallengeManager', signer) const rollupAdmin = await deployContract('RollupAdminLogic', signer) const rollupUser = await deployContract('RollupUserLogic', signer) @@ -73,17 +97,13 @@ async function deployAllContracts( } async function main() { - const [signer] = await ethers.getSigners() try { // Deploying all contracts const contracts = await deployAllContracts(signer) - /* - * Call setTemplates with the deployed contract addresses - * Adding 15 million gas limit otherwise it'll be reverted with "gas exceeds block gas limit" error - */ + // 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, @@ -92,77 +112,41 @@ async function main() { contracts.rollupAdmin.address, contracts.rollupUser.address, contracts.validatorUtils.address, - contracts.validatorWalletCreator.address, - { gasLimit: ethers.BigNumber.from('15000000') } + contracts.validatorWalletCreator.address ) console.log('Template is set on the Rollup Creator') - // Define the configuration for the createRollup function - const rollupConfig = { - confirmPeriodBlocks: 20, - extraChallengeTimeBlocks: 0, - stakeToken: ethers.constants.AddressZero, - baseStake: ethers.utils.parseEther('1'), - wasmModuleRoot: - '0xda4e3ad5e7feacb817c21c8d0220da7650fe9051ece68a3f0b1c5d38bbb27b21', - owner: signer.address, - loserStakeEscrow: ethers.constants.AddressZero, - chainId: 1337, - chainConfig: ethers.constants.HashZero, - genesisBlockNum: 0, - sequencerInboxMaxTimeVariation: { - delayBlocks: 16, - futureBlocks: 192, - delaySeconds: 86400, - futureSeconds: 7200, - }, - } + const bridgeAddress = await contracts.bridgeCreator.bridgeTemplate() + const sequencerInboxAddress = + await contracts.bridgeCreator.sequencerInboxTemplate() + const inboxAddress = await contracts.bridgeCreator.inboxTemplate() + const outboxAddress = await contracts.bridgeCreator.outboxTemplate() - /* - * Call the createRollup function - * Adding 15 million gas limit otherwise it'll be reverted with "gas exceeds block gas limit" error - */ - console.log('Calling createRollup to generate a new rollup ...') - const createRollupTx = await contracts.rollupCreator.createRollup( - rollupConfig, - { gasLimit: ethers.BigNumber.from('15000000') } + console.log( + `"bridge implementation contract" created at address:`, + bridgeAddress ) - const createRollupReceipt = await createRollupTx.wait() - - const rollupCreatedEvent = createRollupReceipt.events?.find( - (event: RollupCreatedEvent) => event.event === 'RollupCreated' && event.address.toLowerCase() === contracts.rollupCreator.address.toLowerCase() + await verifyContract( + 'Bridge', + bridgeAddress, + [], + 'src/bridge/Bridge.sol:Bridge' ) - //Checking for RollupCreated event for new rollup address - if (rollupCreatedEvent) { - const rollupAddress = rollupCreatedEvent.args?.rollupAddress - const inboxAddress = rollupCreatedEvent.args?.inboxAddress - const adminProxy = rollupCreatedEvent.args?.adminProxy - const sequencerInbox = rollupCreatedEvent.args?.sequencerInbox - const bridge = rollupCreatedEvent.args?.bridge - console.log("Congratulations! πŸŽ‰πŸŽ‰πŸŽ‰ All DONE! Here's your addresses:") - console.log('Rollup Contract created at address:', rollupAddress) - console.log('Inbox Contract created at address:', inboxAddress) - console.log('Admin Proxy Contract created at address:', adminProxy) - console.log( - 'Sequencer Contract Inbox created at address:', - sequencerInbox - ) - console.log('Bridge Contract created at address:', bridge) - console.log( - 'Utils Contract created at address:', - contracts.validatorUtils.address - ) - console.log( - 'ValidatorWalletCreator Contract created at address:', - contracts.validatorWalletCreator.address - ) - - // getting the block number - const blockNumber = createRollupReceipt.blockNumber - console.log('All deployed at block number:', blockNumber) - } else { - console.error('RollupCreated event not found') - } + 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:', diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts new file mode 100644 index 0000000000..af6ffe26bf --- /dev/null +++ b/scripts/rollupCreation.ts @@ -0,0 +1,124 @@ +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 { rollupConfig } from './config' +import { abi as rollupCoreAbi } from '../build/contracts/src/rollup/RollupCore.sol/RollupCore.json' + +interface RollupCreatedEvent { + event: string + address: string + args?: { + rollupAddress: string + inboxAddress: string + adminProxy: string + sequencerInbox: string + bridge: 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 { + // Call the createRollup function + console.log('Calling createRollup to generate a new rollup ...') + const createRollupTx = await rollupCreator.createRollup(rollupConfig) + 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 adminProxy = rollupCreatedEvent.args?.adminProxy + const sequencerInbox = rollupCreatedEvent.args?.sequencerInbox + const bridge = rollupCreatedEvent.args?.bridge + + const rollupCore = new ethers.Contract( + rollupAddress, + rollupCoreAbi, + signer + ) + + 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 Contract created at address:', + await rollupCore.outbox() + ) + 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:', + await rollupCore.validatorUtils() + ) + console.log( + 'ValidatorWalletCreator Contract created at address:', + await rollupCore.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) + }) From b6793a6eaad668f699912d82c56f43aa01cf01e2 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Fri, 23 Jun 2023 12:01:15 -0700 Subject: [PATCH 13/41] outbox proxy fixed --- scripts/rollupCreation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index af6ffe26bf..d495454254 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -88,7 +88,7 @@ async function main() { } console.log('Inbox (proxy) Contract created at address:', inboxAddress) console.log( - 'Outbox Contract created at address:', + 'Outbox (proxy) Contract created at address:', await rollupCore.outbox() ) console.log('AdminProxy Contract created at address:', adminProxy) From e827007a0784f9f679ec36b5f6eeebd09ca34986 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Fri, 23 Jun 2023 13:04:58 -0700 Subject: [PATCH 14/41] populating config.ts --- scripts/config.ts | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/scripts/config.ts b/scripts/config.ts index 12317532e1..4f2fb29cfb 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -1,21 +1,22 @@ import { ethers } from 'ethers' export const rollupConfig = { - confirmPeriodBlocks: ethers.BigNumber.from(''), - extraChallengeTimeBlocks: ethers.BigNumber.from(''), - stakeToken: '', - baseStake: ethers.utils.parseEther(''), + confirmPeriodBlocks: ethers.BigNumber.from('45818'), + extraChallengeTimeBlocks: ethers.BigNumber.from('200'), + stakeToken: ethers.constants.AddressZero, + baseStake: ethers.utils.parseEther('1'), wasmModuleRoot: '0xda4e3ad5e7feacb817c21c8d0220da7650fe9051ece68a3f0b1c5d38bbb27b21', - owner: '', - loserStakeEscrow: '', - chainId: ethers.BigNumber.from(''), - chainConfig: '', - genesisBlockNum: ethers.BigNumber.from(''), + owner: '0x1234123412341234123412341234123412341234', + loserStakeEscrow: ethers.constants.AddressZero, + chainId: ethers.BigNumber.from('1337'), + chainConfig: + '{"chainId":1337,"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(''), - futureBlocks: ethers.BigNumber.from(''), - delaySeconds: ethers.BigNumber.from(''), - futureSeconds: ethers.BigNumber.from(''), + delayBlocks: ethers.BigNumber.from('5760'), + futureBlocks: ethers.BigNumber.from('12'), + delaySeconds: ethers.BigNumber.from('86400'), + futureSeconds: ethers.BigNumber.from('3600'), }, } From 7b569fa1ebb7afadc74f45c179c857e3d53b46a8 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Fri, 23 Jun 2023 13:45:57 -0700 Subject: [PATCH 15/41] add config to .ignore --- .gitignore | 2 ++ scripts/{config.ts => config.ts.example} | 0 2 files changed, 2 insertions(+) rename scripts/{config.ts => config.ts.example} (100%) diff --git a/.gitignore b/.gitignore index 1cd604bbbf..7d9a004d4f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ deployments/ /test/prover/proofs/*.json /test/prover/spec-proofs/*.json /test/storage/*-old.dot +scripts/config.ts +scripts/config.ts diff --git a/scripts/config.ts b/scripts/config.ts.example similarity index 100% rename from scripts/config.ts rename to scripts/config.ts.example From 909586ea688de00b5808b5c6a44f49fd6dcddb35 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Fri, 23 Jun 2023 13:46:39 -0700 Subject: [PATCH 16/41] update .ignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7d9a004d4f..4d219b574a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ deployments/ /test/prover/spec-proofs/*.json /test/storage/*-old.dot scripts/config.ts -scripts/config.ts From 6a2d9e1f0356877fb8cb82d0ea12e47aa5ca55f0 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Wed, 28 Jun 2023 12:56:03 -0700 Subject: [PATCH 17/41] adding tasks to run scripts --- package.json | 5 ++++- scripts/rollupCreation.ts | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a330b8829b..6d5da54d2c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,10 @@ "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", + "deployment": "hardhat run scripts/deployment.ts", + "rollup": "hardhat run scripts/rollupCreation.ts" + }, "dependencies": { "@openzeppelin/contracts": "4.5.0", diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index d495454254..fec50d0820 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -34,6 +34,7 @@ async function main() { } const [signer] = await ethers.getSigners() + const rollupCreator = await new ethers.Contract( rollupCreatorAddress, rollupCreatorAbi, From 42691296b5ea509b0b008be8f65ffd8ea7024c2b Mon Sep 17 00:00:00 2001 From: Mehdi Salehi <61604245+GreatSoshiant@users.noreply.github.com> Date: Thu, 29 Jun 2023 08:01:57 -0700 Subject: [PATCH 18/41] Update package.json Co-authored-by: gzeon --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6d5da54d2c..0f6135e29a 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "test:compatibility": "yarn run build:0.6 && yarn run build:0.7", "test:storage": "./test/storage/test.bash", "postinstall": "patch-package", - "deployment": "hardhat run scripts/deployment.ts", - "rollup": "hardhat run scripts/rollupCreation.ts" + "deploy-factory": "hardhat run scripts/deployment.ts", + "deploy-rollup": "hardhat run scripts/rollupCreation.ts" }, "dependencies": { From 6beb27e6bb334656fb0411e3322f0547b42476a7 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Fri, 30 Jun 2023 20:34:04 -0700 Subject: [PATCH 19/41] changing RollupCreated event adding outbox, validatorUtils and validatorWalletCreator to RollupCreated event. Also changing tests/scripts correspondingly --- scripts/rollupCreation.ts | 12 +++++++++--- src/rollup/RollupCreator.sol | 10 ++++++++-- test/contract/arbRollup.spec.ts | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index fec50d0820..746f83c8d7 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -11,9 +11,12 @@ interface RollupCreatedEvent { args?: { rollupAddress: string inboxAddress: string + outbox: string adminProxy: string sequencerInbox: string bridge: string + validatorUtils: string + validatorWalletCreator: string } } @@ -57,9 +60,12 @@ async function main() { if (rollupCreatedEvent) { const rollupAddress = rollupCreatedEvent.args?.rollupAddress const inboxAddress = rollupCreatedEvent.args?.inboxAddress + const outbox = rollupCreatedEvent.args?.outbox 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 const rollupCore = new ethers.Contract( rollupAddress, @@ -90,18 +96,18 @@ async function main() { console.log('Inbox (proxy) Contract created at address:', inboxAddress) console.log( 'Outbox (proxy) Contract created at address:', - await rollupCore.outbox() + outbox ) 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:', - await rollupCore.validatorUtils() + validatorUtils ) console.log( 'ValidatorWalletCreator Contract created at address:', - await rollupCore.validatorWalletCreator() + validatorWalletCreator ) const blockNumber = createRollupReceipt.blockNumber diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index 0d469a0558..aa49acf3a5 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -16,9 +16,12 @@ contract RollupCreator is Ownable { event RollupCreated( address indexed rollupAddress, address inboxAddress, + address outbox, address adminProxy, address sequencerInbox, - address bridge + address bridge, + address validatorUtils, + address validatorWalletCreator ); event TemplatesUpdated(); @@ -112,9 +115,12 @@ contract RollupCreator is Ownable { emit RollupCreated( address(rollup), address(inbox), + address(outbox), address(proxyAdmin), address(sequencerInbox), - address(bridge) + address(bridge), + address(validatorUtils), + address(validatorWalletCreator) ); return address(rollup); } diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index ad71ad1e0d..77e4238e4d 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -236,7 +236,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, From c91e7d76ff56994934db1300236035e8d974e820 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Fri, 30 Jun 2023 20:35:03 -0700 Subject: [PATCH 20/41] formatting --- package.json | 1 - scripts/rollupCreation.ts | 13 ++++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 0f6135e29a..152ddab627 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "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/rollupCreation.ts b/scripts/rollupCreation.ts index 746f83c8d7..468dcffbea 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -65,7 +65,8 @@ async function main() { const sequencerInbox = rollupCreatedEvent.args?.sequencerInbox const bridge = rollupCreatedEvent.args?.bridge const validatorUtils = rollupCreatedEvent.args?.validatorUtils - const validatorWalletCreator = rollupCreatedEvent.args?.validatorWalletCreator + const validatorWalletCreator = + rollupCreatedEvent.args?.validatorWalletCreator const rollupCore = new ethers.Contract( rollupAddress, @@ -94,17 +95,11 @@ async function main() { } } console.log('Inbox (proxy) Contract created at address:', inboxAddress) - console.log( - 'Outbox (proxy) Contract created at address:', - outbox - ) + console.log('Outbox (proxy) Contract created at address:', outbox) 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('ValidatorUtils Contract created at address:', validatorUtils) console.log( 'ValidatorWalletCreator Contract created at address:', validatorWalletCreator From 668b11a7e73058138cae747d5e474f280188e351 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Sat, 1 Jul 2023 15:18:08 -0700 Subject: [PATCH 21/41] added rollupEventInbox and challengeManager addresses to event --- scripts/rollupCreation.ts | 13 ++++++------- src/rollup/RollupCreator.sol | 4 ++++ test/contract/arbRollup.spec.ts | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index 468dcffbea..adf18b87db 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -3,7 +3,6 @@ import '@nomiclabs/hardhat-ethers' import { run } from 'hardhat' import { abi as rollupCreatorAbi } from '../build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json' import { rollupConfig } from './config' -import { abi as rollupCoreAbi } from '../build/contracts/src/rollup/RollupCore.sol/RollupCore.json' interface RollupCreatedEvent { event: string @@ -12,6 +11,8 @@ interface RollupCreatedEvent { rollupAddress: string inboxAddress: string outbox: string + rollupEventInbox: string + challengeManager: string adminProxy: string sequencerInbox: string bridge: string @@ -61,6 +62,8 @@ async function main() { 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 @@ -68,12 +71,6 @@ async function main() { const validatorWalletCreator = rollupCreatedEvent.args?.validatorWalletCreator - const rollupCore = new ethers.Contract( - rollupAddress, - rollupCoreAbi, - signer - ) - console.log("Congratulations! πŸŽ‰πŸŽ‰πŸŽ‰ All DONE! Here's your addresses:") console.log('RollupProxy Contract created at address:', rollupAddress) console.log( @@ -96,6 +93,8 @@ async function main() { } 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) diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index aa49acf3a5..13f6ba5a21 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -17,6 +17,8 @@ contract RollupCreator is Ownable { address indexed rollupAddress, address inboxAddress, address outbox, + address rollupEventInbox, + address challengeManager, address adminProxy, address sequencerInbox, address bridge, @@ -116,6 +118,8 @@ contract RollupCreator is Ownable { address(rollup), address(inbox), address(outbox), + address(rollupEventInbox), + address(challengeManager), address(proxyAdmin), address(sequencerInbox), address(bridge), diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index 77e4238e4d..a29e0a2a4e 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -18,7 +18,7 @@ import { ethers, run, network } 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 { From 93b0599be7e4c2c7cf13beff89db9fd37f228dd9 Mon Sep 17 00:00:00 2001 From: gzeon Date: Tue, 4 Jul 2023 16:48:58 +0800 Subject: [PATCH 22/41] fix: remove uniswapCreateRetryableTicket --- src/bridge/Inbox.sol | 80 +-------------------------------- src/libraries/Constants.sol | 3 -- test/contract/arbRollup.spec.ts | 77 ------------------------------- 3 files changed, 1 insertion(+), 159 deletions(-) diff --git a/src/bridge/Inbox.sol b/src/bridge/Inbox.sol index aa23d07a21..9e718b6645 100644 --- a/src/bridge/Inbox.sol +++ b/src/bridge/Inbox.sol @@ -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/libraries/Constants.sol b/src/libraries/Constants.sol index 57dfec6f3c..d15bdf169d 100644 --- a/src/libraries/Constants.sol +++ b/src/libraries/Constants.sol @@ -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/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index a29e0a2a4e..89ab50da5d 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -1227,81 +1227,4 @@ describe('ArbRollup', () => { ) }) - 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], - }) - }) }) From aa39668479154f1de3a7fa22b39580466444107a Mon Sep 17 00:00:00 2001 From: gzeon Date: Tue, 4 Jul 2023 22:23:34 +0800 Subject: [PATCH 23/41] fix: format --- scripts/rollupCreation.ts | 10 ++++++++-- test/contract/arbRollup.spec.ts | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index adf18b87db..e88e29572a 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -93,8 +93,14 @@ async function main() { } 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( + '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) diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index 89ab50da5d..b67a685c01 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -1226,5 +1226,4 @@ describe('ArbRollup', () => { 'VALIDATOR_NOT_AFK' ) }) - }) From e44c80c01627456b427ed941a66c2be08bf1f428 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Wed, 5 Jul 2023 21:15:25 -0700 Subject: [PATCH 24/41] setting validators and batch poster on createRollup --- scripts/config.ts.example | 43 +++++++++++++++++++-------------- scripts/rollupCreation.ts | 23 +++++++++++++++--- src/rollup/RollupCreator.sol | 24 +++++++++++++++--- test/contract/arbRollup.spec.ts | 15 ++++++------ 4 files changed, 72 insertions(+), 33 deletions(-) diff --git a/scripts/config.ts.example b/scripts/config.ts.example index 4f2fb29cfb..7f911710bd 100644 --- a/scripts/config.ts.example +++ b/scripts/config.ts.example @@ -1,22 +1,29 @@ import { ethers } from 'ethers' -export const 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('1337'), - chainConfig: - '{"chainId":1337,"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'), +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/rollupCreation.ts b/scripts/rollupCreation.ts index adf18b87db..06d4cdc5de 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -2,7 +2,7 @@ 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 { rollupConfig } from './config' +import { config } from './config' interface RollupCreatedEvent { event: string @@ -46,9 +46,18 @@ async function main() { ) 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(rollupConfig) + const createRollupTx = await rollupCreator.createRollup( + config.rollupConfig, + config.batchPoster, + config.validators, + vals + ) const createRollupReceipt = await createRollupTx.wait() const rollupCreatedEvent = createRollupReceipt.events?.find( @@ -93,8 +102,14 @@ async function main() { } 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( + '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) diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index 13f6ba5a21..62d400c02d 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -11,6 +11,7 @@ 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( @@ -36,6 +37,8 @@ contract RollupCreator is Ownable { address public validatorUtils; address public validatorWalletCreator; + bool[1] private vals = [true]; + constructor() Ownable() {} function setTemplates( @@ -62,7 +65,12 @@ contract RollupCreator is Ownable { // 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) { + function createRollup( + Config memory config, + address _batchPoster, + address[] memory _validators, + bool[] memory _vals + ) external returns (address) { ProxyAdmin proxyAdmin = new ProxyAdmin(); // Create the rollup proxy to figure out the address and initialize it later @@ -80,8 +88,6 @@ contract RollupCreator is Ownable { config.sequencerInboxMaxTimeVariation ); - proxyAdmin.transferOwnership(config.owner); - IChallengeManager challengeManager = IChallengeManager( address( new TransparentUpgradeableProxy( @@ -98,6 +104,8 @@ contract RollupCreator is Ownable { osp ); + address tempOwner = config.owner; + config.owner = address(this); rollup.initializeProxy( config, ContractDependencies({ @@ -114,6 +122,16 @@ contract RollupCreator is Ownable { }) ); + IRollupAdmin rollupAdmin = IRollupAdmin(address(rollup)); + sequencerInbox.setIsBatchPoster(_batchPoster, true); + + // Call setValidator on the newly created rollup contract + + rollupAdmin.setValidator(_validators, _vals); + + rollupAdmin.setOwner(tempOwner); + proxyAdmin.transferOwnership(config.owner); + emit RollupCreated( address(rollup), address(inbox), diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index a29e0a2a4e..64bb6331ac 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -182,7 +182,13 @@ 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()], + [true, true, true] + ) + const rec = await response.wait() const rollupCreatedEvent = rollupCreator.interface.parseLog( @@ -196,19 +202,12 @@ 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' From 1ded895dc4e7387e5020e13457d786351ef49a89 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Thu, 6 Jul 2023 07:58:48 -0700 Subject: [PATCH 25/41] debug stack too deep --- scripts/rollupCreation.ts | 3 +-- src/rollup/RollupCreator.sol | 25 ++++++++++++++----------- test/contract/arbRollup.spec.ts | 3 +-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index 06d4cdc5de..2c9af88580 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -55,8 +55,7 @@ async function main() { const createRollupTx = await rollupCreator.createRollup( config.rollupConfig, config.batchPoster, - config.validators, - vals + config.validators ) const createRollupReceipt = await createRollupTx.wait() diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index 62d400c02d..5a3cc0a902 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -68,8 +68,7 @@ contract RollupCreator is Ownable { function createRollup( Config memory config, address _batchPoster, - address[] memory _validators, - bool[] memory _vals + address[] memory _validators ) external returns (address) { ProxyAdmin proxyAdmin = new ProxyAdmin(); @@ -121,15 +120,19 @@ contract RollupCreator is Ownable { validatorWalletCreator: validatorWalletCreator }) ); - - IRollupAdmin rollupAdmin = IRollupAdmin(address(rollup)); - sequencerInbox.setIsBatchPoster(_batchPoster, true); - - // Call setValidator on the newly created rollup contract - - rollupAdmin.setValidator(_validators, _vals); - - rollupAdmin.setOwner(tempOwner); + { + IRollupAdmin rollupAdmin = IRollupAdmin(address(rollup)); + sequencerInbox.setIsBatchPoster(_batchPoster, true); + + // Call setValidator on the newly created rollup contract + bool[] memory _vals = new bool[](_validators.length); + for (uint256 i = 0; i < _validators.length; i++) { + _vals[i] = true; + } + rollupAdmin.setValidator(_validators, _vals); + + rollupAdmin.setOwner(tempOwner); + } proxyAdmin.transferOwnership(config.owner); emit RollupCreated( diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index 64bb6331ac..6a56c6d8f6 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -185,8 +185,7 @@ const setup = async () => { const response = await rollupCreator.createRollup( await getDefaultConfig(), await sequencer.getAddress(), - [await val1.getAddress(), await val2.getAddress(), await val3.getAddress()], - [true, true, true] + [await val1.getAddress(), await val2.getAddress(), await val3.getAddress()] ) const rec = await response.wait() From a917be11bb06170c74c775f6308e0ea405d8b4ff Mon Sep 17 00:00:00 2001 From: Mehdi Salehi <61604245+GreatSoshiant@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:23:11 -0700 Subject: [PATCH 26/41] Update src/rollup/RollupCreator.sol Co-authored-by: gzeon --- src/rollup/RollupCreator.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index 5a3cc0a902..08cd3b1255 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -68,7 +68,7 @@ contract RollupCreator is Ownable { function createRollup( Config memory config, address _batchPoster, - address[] memory _validators + address[] calldata _validators ) external returns (address) { ProxyAdmin proxyAdmin = new ProxyAdmin(); From d3d90e735e855aa9c5cacd0127c568b2478f2073 Mon Sep 17 00:00:00 2001 From: Mehdi Salehi <61604245+GreatSoshiant@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:23:30 -0700 Subject: [PATCH 27/41] Update src/rollup/RollupCreator.sol Co-authored-by: gzeon --- src/rollup/RollupCreator.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index 08cd3b1255..dfaaf0a393 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -133,7 +133,7 @@ contract RollupCreator is Ownable { rollupAdmin.setOwner(tempOwner); } - proxyAdmin.transferOwnership(config.owner); + proxyAdmin.transferOwnership(tempOwner); emit RollupCreated( address(rollup), From c2a1bee3dadb23f2cb30076c2ab70a58046730b1 Mon Sep 17 00:00:00 2001 From: Mehdi Salehi <61604245+GreatSoshiant@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:32:32 -0700 Subject: [PATCH 28/41] Update src/rollup/RollupCreator.sol Co-authored-by: gzeon --- src/rollup/RollupCreator.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index dfaaf0a393..f92fe31937 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -103,7 +103,9 @@ contract RollupCreator is Ownable { osp ); - address tempOwner = 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, From 90d41c971a50cac5856fbcf37047777c4f8e7ac5 Mon Sep 17 00:00:00 2001 From: Mehdi Salehi <61604245+GreatSoshiant@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:32:40 -0700 Subject: [PATCH 29/41] Update src/rollup/RollupCreator.sol Co-authored-by: gzeon --- src/rollup/RollupCreator.sol | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index f92fe31937..cf124a1827 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -37,8 +37,6 @@ contract RollupCreator is Ownable { address public validatorUtils; address public validatorWalletCreator; - bool[1] private vals = [true]; - constructor() Ownable() {} function setTemplates( From 34b7a34f665daa00df0cca6865cb379d898e23d5 Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Thu, 6 Jul 2023 09:59:15 -0700 Subject: [PATCH 30/41] workaround stack too deep --- src/rollup/RollupCreator.sol | 25 ++++++++++++------------- test/contract/arbRollup.spec.ts | 16 +--------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index cf124a1827..0cb5fd26eb 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -120,20 +120,19 @@ contract RollupCreator is Ownable { validatorWalletCreator: validatorWalletCreator }) ); - { - IRollupAdmin rollupAdmin = IRollupAdmin(address(rollup)); - sequencerInbox.setIsBatchPoster(_batchPoster, true); - - // Call setValidator on the newly created rollup contract - bool[] memory _vals = new bool[](_validators.length); - for (uint256 i = 0; i < _validators.length; i++) { - _vals[i] = true; - } - rollupAdmin.setValidator(_validators, _vals); - - rollupAdmin.setOwner(tempOwner); + + sequencerInbox.setIsBatchPoster(_batchPoster, true); + + // Call setValidator on the newly created rollup contract + bool[] memory _vals = new bool[](_validators.length); + for (uint256 i = 0; i < _validators.length; i++) { + _vals[i] = true; } - proxyAdmin.transferOwnership(tempOwner); + IRollupAdmin(address(rollup)).setValidator(_validators, _vals); + + IRollupAdmin(address(rollup)).setOwner(actualOwner); + + proxyAdmin.transferOwnership(actualOwner); emit RollupCreated( address(rollup), diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index 56d3710e08..ba41754137 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 } 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 @@ -213,14 +207,6 @@ const setup = async () => { )) 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, From ab35c180baca04f23c6ac62c623b13303f9bd3bf Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Sun, 9 Jul 2023 22:06:05 -0700 Subject: [PATCH 31/41] moving the transfer ownership line in createRollup --- src/rollup/RollupCreator.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index 0cb5fd26eb..e71263d838 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -101,6 +101,8 @@ 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; @@ -132,8 +134,6 @@ contract RollupCreator is Ownable { IRollupAdmin(address(rollup)).setOwner(actualOwner); - proxyAdmin.transferOwnership(actualOwner); - emit RollupCreated( address(rollup), address(inbox), From dd934b426dd8709b086eac1259019789484b18ef Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Wed, 12 Jul 2023 17:06:39 -0700 Subject: [PATCH 32/41] check for empty validator set, and zero address for batch poster --- src/rollup/RollupCreator.sol | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index e71263d838..c2f938b037 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -63,6 +63,9 @@ contract RollupCreator is Ownable { // RollupOwner should be the owner of Rollup's ProxyAdmin // RollupOwner should be the owner of Rollup // Bridge should have a single inbox and outbox + // Validators and batch poster should be set if provided + // If you don't want to set validators, put an empty list + // If you don't want to set batch-poster, put zero address function createRollup( Config memory config, address _batchPoster, @@ -123,14 +126,19 @@ contract RollupCreator is Ownable { }) ); - sequencerInbox.setIsBatchPoster(_batchPoster, true); + // 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 - bool[] memory _vals = new bool[](_validators.length); - for (uint256 i = 0; i < _validators.length; i++) { - _vals[i] = 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)).setValidator(_validators, _vals); IRollupAdmin(address(rollup)).setOwner(actualOwner); From 832b4646a8219390ffd79458becabb3e8a4edbba Mon Sep 17 00:00:00 2001 From: GreatSoshiant Date: Wed, 12 Jul 2023 22:34:53 -0700 Subject: [PATCH 33/41] edit on comments --- src/rollup/RollupCreator.sol | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index c2f938b037..93cf0bb2ec 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -58,14 +58,19 @@ 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 - // Validators and batch poster should be set if provided - // If you don't want to set validators, put an empty list - // If you don't want to set batch-poster, put zero 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, From df77534aa8a6800c3f55d16898346cfcc5e63c3b Mon Sep 17 00:00:00 2001 From: ganeshvanahalli Date: Thu, 20 Jul 2023 11:11:29 -0400 Subject: [PATCH 34/41] add getL1RewardRate and getL1RewardRecipient methods to ArbGasInfo interface --- src/precompiles/ArbGasInfo.sol | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/precompiles/ArbGasInfo.sol b/src/precompiles/ArbGasInfo.sol index ff91c037e4..23b42c0879 100644 --- a/src/precompiles/ArbGasInfo.sol +++ b/src/precompiles/ArbGasInfo.sol @@ -95,6 +95,12 @@ 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 + function getL1RewardRate() external view returns (uint64); + + /// @notice Get the L1 pricer reward recipient + function getL1RewardRecipient() external view returns (address); + /// @notice Deprecated -- Same as getL1BaseFeeEstimate() function getL1GasPriceEstimate() external view returns (uint256); From 09493b6fd9b3284d0ac243f6401631367e4b0f48 Mon Sep 17 00:00:00 2001 From: ganeshvanahalli Date: Wed, 26 Jul 2023 17:20:35 -0500 Subject: [PATCH 35/41] add rectifyChainOwner function and ChainOwnerRectified event to ArbOwnerPublic --- src/precompiles/ArbOwnerPublic.sol | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/precompiles/ArbOwnerPublic.sol b/src/precompiles/ArbOwnerPublic.sol index d6fd683128..1a4314c527 100644 --- a/src/precompiles/ArbOwnerPublic.sol +++ b/src/precompiles/ArbOwnerPublic.sol @@ -10,6 +10,12 @@ 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. + */ + function rectifyChainOwner(address ownerToRectify) external; + /// @notice Retrieves the list of chain owners function getAllChainOwners() external view returns (address[] memory); @@ -18,4 +24,6 @@ interface ArbOwnerPublic { /// @notice Get the infrastructure fee collector function getInfraFeeAccount() external view returns (address); + + event ChainOwnerRectified(address rectifiedOwner); } From 7ea1da311458817c94dd776ea0a81ebfbb53c2e8 Mon Sep 17 00:00:00 2001 From: ganeshvanahalli Date: Thu, 27 Jul 2023 10:56:33 -0500 Subject: [PATCH 36/41] document rate measured in --- src/precompiles/ArbGasInfo.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/precompiles/ArbGasInfo.sol b/src/precompiles/ArbGasInfo.sol index 23b42c0879..d9d1ed2f28 100644 --- a/src/precompiles/ArbGasInfo.sol +++ b/src/precompiles/ArbGasInfo.sol @@ -95,7 +95,7 @@ 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 + /// @notice Get the L1 pricer reward rate, in wei per unit function getL1RewardRate() external view returns (uint64); /// @notice Get the L1 pricer reward recipient From a724d3debdb9c071467aa5321dc3545c774d381a Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Sun, 30 Jul 2023 14:06:46 -0600 Subject: [PATCH 37/41] Use L2 block number for keyset info if applicable --- src/bridge/SequencerInbox.sol | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index 8c2c538769..2ba25c161a 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -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); From 9400c53d95654ac9d4d80797c89399d44189d967 Mon Sep 17 00:00:00 2001 From: ganeshvanahalli Date: Thu, 3 Aug 2023 12:13:15 -0500 Subject: [PATCH 38/41] add comments --- src/precompiles/ArbGasInfo.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/precompiles/ArbGasInfo.sol b/src/precompiles/ArbGasInfo.sol index d9d1ed2f28..a30772ed52 100644 --- a/src/precompiles/ArbGasInfo.sol +++ b/src/precompiles/ArbGasInfo.sol @@ -96,9 +96,11 @@ interface ArbGasInfo { 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() From 97cfbe00ff0eea4d7f5f5f3afb01598c19ddabc4 Mon Sep 17 00:00:00 2001 From: ganeshvanahalli Date: Fri, 4 Aug 2023 16:05:16 -0500 Subject: [PATCH 39/41] add comments --- src/precompiles/ArbOwnerPublic.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/precompiles/ArbOwnerPublic.sol b/src/precompiles/ArbOwnerPublic.sol index b4f68bde4b..1fbfdc0359 100644 --- a/src/precompiles/ArbOwnerPublic.sol +++ b/src/precompiles/ArbOwnerPublic.sol @@ -12,7 +12,8 @@ interface ArbOwnerPublic { /** * @notice Rectify the list of chain owners - * If successful, emits ChainOwnerRectified event. + * If successful, emits ChainOwnerRectified event + * Available in ArbOS version 11 */ function rectifyChainOwner(address ownerToRectify) external; From 1d84c0d963ffec15b8569de1d37c473027a1ffc5 Mon Sep 17 00:00:00 2001 From: Tsahi Zidenberg Date: Wed, 23 Aug 2023 19:09:42 -0600 Subject: [PATCH 40/41] rename program actiated error --- src/precompiles/ArbWasm.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/precompiles/ArbWasm.sol b/src/precompiles/ArbWasm.sol index e646a246e8..0059e99fca 100644 --- a/src/precompiles/ArbWasm.sol +++ b/src/precompiles/ArbWasm.sol @@ -50,7 +50,7 @@ interface ArbWasm { // @return gas cost paid per half kb uncompressed. function callScalar() external view returns (uint16 gas); - error ProgramNotCompiled(); + error ProgramNotActivated(); error ProgramOutOfDate(uint16 version); error ProgramUpToDate(); } From 1e31d42396af2b231b915873e2085880560b396f Mon Sep 17 00:00:00 2001 From: Joshua Colvin Date: Mon, 28 Aug 2023 14:31:33 -0700 Subject: [PATCH 41/41] Add codehashversion precompile --- src/precompiles/ArbWasm.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/precompiles/ArbWasm.sol b/src/precompiles/ArbWasm.sol index 0059e99fca..6ae4449eb6 100644 --- a/src/precompiles/ArbWasm.sol +++ b/src/precompiles/ArbWasm.sol @@ -18,6 +18,10 @@ interface ArbWasm { // @return version the stylus version function stylusVersion() external view returns (uint16 version); + // @notice gets the stylus version the program with codehash was most recently compiled against. + // @return version the program version (0 for EVM contracts) + function codehashVersion(bytes32 codehash) external view returns (uint16 version); + // @notice gets the stylus version the program was most recently compiled against. // @return version the program version (0 for EVM contracts) function programVersion(address program) external view returns (uint16 version);