diff --git a/docker/scripts/v2/create_rollup_parameters_docker.json b/docker/scripts/v2/create_rollup_parameters_docker.json index e3de619a..7e99c5a8 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": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "gasTokenAddress": "deployed", "deployerPvtKey": "", "maxFeePerGas": "", "maxPriorityFeePerGas": "", diff --git a/upgrade/upgradePessimistic/upgradePessimistic.ts b/upgrade/upgradePessimistic/upgradePessimistic.ts index 68f3997c..c9bf51f1 100644 --- a/upgrade/upgradePessimistic/upgradePessimistic.ts +++ b/upgrade/upgradePessimistic/upgradePessimistic.ts @@ -3,6 +3,7 @@ import {expect} from "chai"; import path = require("path"); import fs = require("fs"); +import {utils} from "ffjavascript"; import * as dotenv from "dotenv"; dotenv.config({path: path.resolve(__dirname, "../../.env")}); @@ -125,7 +126,11 @@ async function main() { const operationRollupManager = genOperation( proxyAdmin.target, 0, // value - proxyAdmin.interface.encodeFunctionData("upgrade", [rollupManagerAddress, implRollupManager]), // data + proxyAdmin.interface.encodeFunctionData("upgradeAndCall", [ + rollupManagerAddress, + implRollupManager, + PolygonRollupManagerFactory.interface.encodeFunctionData("initialize", []), + ]), // data ethers.ZeroHash, // predecessor salt // salt ); @@ -157,7 +162,43 @@ async function main() { executeData, timelockContractAddress: timelockAddress, }; - fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); + + // Decode the scheduleData for better readability + const timelockTx = timelockContractFactory.interface.parseTransaction({data: scheduleData}); + const paramsArray = timelockTx?.fragment.inputs; + const objectDecoded = {}; + + 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, + }); + + const resultDecodeProxyAdmin = {}; + resultDecodeProxyAdmin.signature = decodedProxyAdmin?.signature; + resultDecodeProxyAdmin.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; + } + } + } + + outputJson.decodedScheduleData = objectDecoded; + + fs.writeFileSync(pathOutputJson, JSON.stringify(utils.stringifyBigInts(outputJson), null, 1)); } main().catch((e) => {