diff --git a/contracts/verifiers/previousVerifiers/FflonkVerifier.sol b/contracts/verifiers/previousVerifiers/FflonkVerifierEtrog.sol similarity index 100% rename from contracts/verifiers/previousVerifiers/FflonkVerifier.sol rename to contracts/verifiers/previousVerifiers/FflonkVerifierEtrog.sol diff --git a/deployment/v2/3_deployContracts.ts b/deployment/v2/3_deployContracts.ts index e5aaabd1d..2179c7bb1 100644 --- a/deployment/v2/3_deployContracts.ts +++ b/deployment/v2/3_deployContracts.ts @@ -529,14 +529,15 @@ async function main() { expect(await upgrades.erc1967.getAdminAddress(proxyBridgeAddress)).to.be.equal(proxyAdminAddress); const outputJson = { - polygonRollupManager: polygonRollupManagerContract.target, + polygonRollupManagerAddress: polygonRollupManagerContract.target, polygonZkEVMBridgeAddress: polygonZkEVMBridgeContract.target, polygonZkEVMGlobalExitRootAddress: polygonZkEVMGlobalExitRoot?.target, polTokenAddress, zkEVMDeployerContract: zkEVMDeployerContract.target, deployerAddress: deployer.address, timelockContractAddress: timelockContract.target, - deploymentBlockNumber, + deploymenRollupManagerBlockNumber: deploymentBlockNumber, + upgradeToULxLyBlockNumber: deploymentBlockNumber, admin, trustedAggregator, proxyAdminAddress, diff --git a/deployment/v2/4_createRollup.ts b/deployment/v2/4_createRollup.ts index 1e11e317f..935a14257 100644 --- a/deployment/v2/4_createRollup.ts +++ b/deployment/v2/4_createRollup.ts @@ -293,7 +293,7 @@ async function main() { await (await polygonDataCommittee?.transferOwnership(adminZkEVM)).wait(); } - outputJson.polygonDataCommittee = polygonDataCommittee?.target; + outputJson.polygonDataCommitteeAddress = polygonDataCommittee?.target; } // Assert admin address @@ -329,7 +329,7 @@ async function main() { outputJson.firstBatchData = batchData; outputJson.genesis = genesis.root; - outputJson.createRollupBlock = blockDeploymentRollup.number; + outputJson.createRollupBlockNumber = blockDeploymentRollup.number; outputJson.rollupAddress = newZKEVMAddress; outputJson.verifierAddress = verifierContract.target; outputJson.consensusContract = consensusContract; diff --git a/tools/deployPolygonDataCommittee/deployPolygonDataCommittee.ts b/tools/deployPolygonDataCommittee/deployPolygonDataCommittee.ts index 704591f9e..716b60d07 100644 --- a/tools/deployPolygonDataCommittee/deployPolygonDataCommittee.ts +++ b/tools/deployPolygonDataCommittee/deployPolygonDataCommittee.ts @@ -106,7 +106,7 @@ async function main() { await (await proxyAdmin.transferOwnership(deployParameters.admin)).wait(); await (await polygonDataCommittee?.transferOwnership(deployParameters.admin)).wait(); - outputJson.polygonDataCommittee = polygonDataCommittee?.target; + outputJson.polygonDataCommitteeAddress = polygonDataCommittee?.target; outputJson.proxyAdmin = proxyAdmin.target; fs.writeFileSync(pathOutput, JSON.stringify(outputJson, null, 1)); diff --git a/tools/getRollupData/getRollupData.ts b/tools/getRollupData/getRollupData.ts new file mode 100644 index 000000000..796936d7c --- /dev/null +++ b/tools/getRollupData/getRollupData.ts @@ -0,0 +1,96 @@ +/* eslint-disable no-await-in-loop, no-use-before-define, no-lonely-if */ +/* eslint-disable no-console, no-inner-declarations, no-undef, import/no-unresolved */ +import {expect} from "chai"; +import path = require("path"); +import fs = require("fs"); + +import * as dotenv from "dotenv"; +dotenv.config({path: path.resolve(__dirname, "../../../.env")}); +import {ethers, upgrades} from "hardhat"; +const getRollupParams = require("./rollupDataParams.json"); +import {PolygonRollupManager} from "../../typechain-types"; +const pathOutputJson = path.join(__dirname, "./deploy_output.json"); +const pathCreateRollupOutput = path.join(__dirname, "./create_rollup_output.json"); + +async function main() { + const RollupManagerFactory = await ethers.getContractFactory("PolygonRollupManager"); + + const rollupManager = (await RollupManagerFactory.attach( + getRollupParams.polygonRollupManagerAddress + )) as PolygonRollupManager; + + const polygonZkEVMBridgeAddress = await rollupManager.bridgeAddress(); + const polygonZkEVMGlobalExitRootAddress = await rollupManager.globalExitRootManager(); + const polTokenAddress = await rollupManager.pol(); + + // FIlter first rollup ID ( the one on migration) + const filterInit = rollupManager.filters.Initialized(undefined); + const eventsInit = await rollupManager.queryFilter(filterInit, 0, "latest"); + const deploymenRollupManagerBlockNumber = eventsInit[0].blockNumber; + + // Filter first initialization (deployment) + const filter = rollupManager.filters.AddExistingRollup(1); + const eventsAddRollup = await rollupManager.queryFilter(filter, 0, "latest"); + const upgradeToULxLyBlockNumber = eventsAddRollup[0].blockNumber; + const deployOutput = { + polygonRollupManagerAddress: rollupManager.target, + polygonZkEVMBridgeAddress, + polygonZkEVMGlobalExitRootAddress, + polTokenAddress, + deploymenRollupManagerBlockNumber, + upgradeToULxLyBlockNumber, + }; + fs.writeFileSync(pathOutputJson, JSON.stringify(deployOutput, null, 1)); + + const filter2 = rollupManager.filters.CreateNewRollup( + getRollupParams.rollupID, + undefined, + undefined, + undefined, + undefined + ); + const eventsCreateNewRollup = await rollupManager.queryFilter(filter2, 0, "latest"); + const {rollupID, rollupAddress, chainID, gasTokenAddress, rollupTypeID} = eventsCreateNewRollup[0].args; + + const filter3 = rollupManager.filters.AddNewRollupType( + rollupTypeID, + undefined, + undefined, + undefined, + undefined, + undefined + ); + + const eventsAddRollupType = await rollupManager.queryFilter(filter3, 0, "latest"); + const {forkID, genesis, description} = eventsAddRollupType[0].args; + + // Add the first batch of the created rollup + const outputCreateRollup = {} as any; + outputCreateRollup.genesis = genesis; + outputCreateRollup.createRollupBlockNumber = eventsCreateNewRollup[0].blockNumber; + outputCreateRollup.rollupAddress = rollupAddress; + outputCreateRollup.consensusContract = description; + + fs.writeFileSync(pathCreateRollupOutput, JSON.stringify(outputCreateRollup, null, 1)); +} + +main().catch((e) => { + console.error(e); + process.exit(1); +}); + +// OZ test functions +function genOperation(target: any, value: any, data: any, predecessor: any, salt: any) { + const id = ethers.solidityPackedKeccak256( + ["address", "uint256", "bytes", "uint256", "bytes32"], + [target, value, data, predecessor, salt] + ); + return { + id, + target, + value, + data, + predecessor, + salt, + }; +} diff --git a/tools/getRollupData/rollupDataParams.json.example b/tools/getRollupData/rollupDataParams.json.example new file mode 100644 index 000000000..1b036b111 --- /dev/null +++ b/tools/getRollupData/rollupDataParams.json.example @@ -0,0 +1,4 @@ +{ + "polygonRollupManagerAddress":"", + "rollupID":0 +}