diff --git a/deployment/testnet/prepareTestnet.ts b/deployment/testnet/prepareTestnet.ts index 0a45e9d0..d8b189d5 100644 --- a/deployment/testnet/prepareTestnet.ts +++ b/deployment/testnet/prepareTestnet.ts @@ -23,6 +23,7 @@ const argv = yargs(process.argv.slice(2)) const pathDeployParameters = path.join(__dirname, argv.input); const deployParameters = require(argv.input); +const pathCreateRollupParameters = path.join(__dirname, argv.createRollupInput); const createRollupParameters = require(argv.createRollupInput); async function main() { @@ -133,19 +134,22 @@ async function main() { deployParameters.polTokenAddress = polTokenContract.target; - /* - * Deployment gasToken address - * A erc20 is deployed in this testnet in case it's wanted to deploy a rollup that uses this token as the gas token - */ - const gasTokenName = "Gas Token"; - const gasTokenSymbol = "GAS"; - - const gasTokenFactory = await ethers.getContractFactory("ERC20", deployer); - const gasTokenContract = await gasTokenFactory.deploy(gasTokenName, gasTokenSymbol); - await gasTokenContract.waitForDeployment(); - deployParameters.gasTokenAddress = gasTokenContract.target; - console.log("#######################\n"); - console.log("gas token deployed to:", gasTokenContract.target); + if (createRollupParameters.gasTokenAddress == "deploy") { + /* + * Deployment gasToken address + * A erc20 is deployed in this testnet in case it's wanted to deploy a rollup that uses this token as the gas token + */ + const gasTokenName = "Gas Token"; + const gasTokenSymbol = "GAS"; + + const gasTokenFactory = await ethers.getContractFactory("ERC20", deployer); + const gasTokenContract = await gasTokenFactory.deploy(gasTokenName, gasTokenSymbol); + await gasTokenContract.waitForDeployment(); + createRollupParameters.gasTokenAddress = gasTokenContract.target; + console.log("#######################\n"); + console.log("gas token deployed to:", gasTokenContract.target); + fs.writeFileSync(pathCreateRollupParameters, JSON.stringify(createRollupParameters, null, 1)); + } fs.writeFileSync(pathDeployParameters, JSON.stringify(deployParameters, null, 1)); } diff --git a/deployment/v2/4_createRollup.ts b/deployment/v2/4_createRollup.ts index 48937bfd..8f4e12ba 100644 --- a/deployment/v2/4_createRollup.ts +++ b/deployment/v2/4_createRollup.ts @@ -266,15 +266,13 @@ async function main() { createRollupParameters.gasTokenAddress !== "" && createRollupParameters.gasTokenAddress !== ethers.ZeroAddress ) { - // If gas token address is "deployed" use the one from deploy parameters, erc20 deployed at prepare testnet script - if(createRollupParameters.gasTokenAddress == "deployed") { - createRollupParameters.gasTokenAddress = deployParameters.gasTokenAddress; - } // Get token metadata gasTokenMetadata = await polygonZkEVMBridgeContract.getTokenMetadata(createRollupParameters.gasTokenAddress); // If gas token metadata includes `0x124e4f545f56414c49445f454e434f44494e47 (NOT_VALID_ENCODING)` means there is no erc20 token deployed at the selected gas token network - if(gasTokenMetadata.includes("124e4f545f56414c49445f454e434f44494e47")) { - throw new Error(`Invalid gas token address, no ERC20 token deployed at the selected gas token network ${createRollupParameters.gasTokenAddress}`); + if (gasTokenMetadata.includes("124e4f545f56414c49445f454e434f44494e47")) { + throw new Error( + `Invalid gas token address, no ERC20 token deployed at the selected gas token network ${createRollupParameters.gasTokenAddress}` + ); } const wrappedData = await polygonZkEVMBridgeContract.wrappedTokenToTokenInfo( createRollupParameters.gasTokenAddress @@ -391,9 +389,12 @@ async function main() { }; genesis = await updateVanillaGenesis(genesis, chainID, initializeParams); // Add weth address to deployment output if gas token address is provided and sovereignWETHAddress is not provided - if ( gasTokenAddress !== ethers.ZeroAddress && + if ( + gasTokenAddress !== ethers.ZeroAddress && ethers.isAddress(gasTokenAddress) && - (sovereignParams.sovereignWETHAddress === ethers.ZeroAddress || !ethers.isAddress(sovereignParams.sovereignWETHAddress))) { + (sovereignParams.sovereignWETHAddress === ethers.ZeroAddress || + !ethers.isAddress(sovereignParams.sovereignWETHAddress)) + ) { const wethObject = genesis.genesis.find(function (obj) { return obj.contractName == "WETH"; }); diff --git a/docker/scripts/v2/create_rollup_parameters_docker.json b/docker/scripts/v2/create_rollup_parameters_docker.json index 7e99c5a8..83f5bf27 100644 --- a/docker/scripts/v2/create_rollup_parameters_docker.json +++ b/docker/scripts/v2/create_rollup_parameters_docker.json @@ -8,7 +8,7 @@ "adminZkEVM": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "forkID": 11, "consensusContract": "PolygonPessimisticConsensus", - "gasTokenAddress": "deployed", + "gasTokenAddress": "deploy", "deployerPvtKey": "", "maxFeePerGas": "", "maxPriorityFeePerGas": "", @@ -21,4 +21,4 @@ "sovereignWETHAddressIsNotMintable": false, "globalExitRootUpdater": "0xB55B27Cca633A73108893985350bc26B8A00C43a" } -} \ No newline at end of file +} diff --git a/upgrade/upgradePessimistic/upgradePessimistic.ts b/upgrade/upgradePessimistic/upgradePessimistic.ts index c9bf51f1..7d3e2725 100644 --- a/upgrade/upgradePessimistic/upgradePessimistic.ts +++ b/upgrade/upgradePessimistic/upgradePessimistic.ts @@ -8,7 +8,7 @@ import {utils} from "ffjavascript"; import * as dotenv from "dotenv"; dotenv.config({path: path.resolve(__dirname, "../../.env")}); import {ethers, upgrades} from "hardhat"; -import {PolygonRollupManager, PolygonZkEVM} from "../../typechain-types"; +import {PolygonRollupManager} from "../../typechain-types"; const pathOutputJson = path.join(__dirname, "./upgrade_output.json"); @@ -165,34 +165,28 @@ async function main() { // Decode the scheduleData for better readability const timelockTx = timelockContractFactory.interface.parseTransaction({data: scheduleData}); - const paramsArray = timelockTx?.fragment.inputs; - const objectDecoded = {}; + const paramsArray = timelockTx?.fragment.inputs as any; + const objectDecoded = {} as any; for (let i = 0; i < paramsArray?.length; i++) { const currentParam = paramsArray[i]; objectDecoded[currentParam.name] = timelockTx?.args[i]; - if (currentParam.name == "payloads") { - // for each payload - const payloads = timelockTx?.args[i]; - for (let j = 0; j < payloads.length; j++) { - const data = payloads[j]; - const decodedProxyAdmin = proxyAdmin.interface.parseTransaction({ - data, - }); + if (currentParam.name == "data") { + const decodedProxyAdmin = proxyAdmin.interface.parseTransaction({ + data: timelockTx?.args[i], + }); + const objectDecodedData = {} as any; + const paramsArrayData = decodedProxyAdmin?.fragment.inputs as any; - const resultDecodeProxyAdmin = {}; - resultDecodeProxyAdmin.signature = decodedProxyAdmin?.signature; - resultDecodeProxyAdmin.selector = decodedProxyAdmin?.selector; + objectDecodedData.signature = decodedProxyAdmin?.signature; + objectDecodedData.selector = decodedProxyAdmin?.selector; - const paramsArrayData = decodedProxyAdmin?.fragment.inputs; - - for (let n = 0; n < paramsArrayData?.length; n++) { - const currentParam = paramsArrayData[n]; - resultDecodeProxyAdmin[currentParam.name] = decodedProxyAdmin?.args[n]; - } - objectDecoded[`decodePayload_${j}`] = resultDecodeProxyAdmin; + for (let j = 0; j < paramsArrayData?.length; j++) { + const currentParam = paramsArrayData[j]; + objectDecodedData[currentParam.name] = decodedProxyAdmin?.args[j]; } + objectDecoded["decodedData"] = objectDecodedData; } }