diff --git a/scripts/proposals/NovaFeeSweep/patchProposal.ts b/scripts/proposals/NovaFeeSweep/patchProposal.ts new file mode 100644 index 000000000..81b7bba53 --- /dev/null +++ b/scripts/proposals/NovaFeeSweep/patchProposal.ts @@ -0,0 +1,65 @@ +import { BigNumber, ethers } from 'ethers' +import { + IInbox__factory, + L1ArbitrumTimelock__factory, +} from '../../../typechain-types' +import { JsonRpcProvider } from '@ethersproject/providers' +import fs from 'fs' + +;(async () => { + const proposalDataFile = process.argv[2] + const proposalData = JSON.parse(fs.readFileSync(proposalDataFile).toString()) + const inputData = proposalData.arbSysSendTxToL1Args.calldata + + const l1TimelockAlias = '0xf7951d92b0c345144506576ec13ecf5103ac905a' + const novaInbox = '0xc4448b71118c9071Bcb9734A0EAc55D18A153949' + const novaToParentRouter = '0x36D0170D92F66e8949eB276C3AC4FEA64f83704d' + const maxL1GasPrice = ethers.utils.parseUnits('1000', 'gwei') // used to calculate maxSubmissionCost + const aliasBalance = await new JsonRpcProvider('https://nova.arbitrum.io/rpc').getBalance(l1TimelockAlias) + + const timelockIface = L1ArbitrumTimelock__factory.createInterface() + const inboxIface = IInbox__factory.createInterface() + + const maxSubmissionCost = calcSubmissionCost(maxL1GasPrice) + + const unsafeCreateRetryableCalldata = inboxIface.encodeFunctionData( + 'unsafeCreateRetryableTicket', + [ + novaToParentRouter, // to + aliasBalance.sub(maxSubmissionCost), // l2CallValue + maxSubmissionCost, // maxSubmissionCost + novaToParentRouter, // excessFeeRefundAddress + novaToParentRouter, // callValueRefundAddress + 0, // gasLimit + 0, // maxFeePerGas + '0x', // calldata + ] + ) + + const decodedScheduleBatch = timelockIface.decodeFunctionData( + 'scheduleBatch', + inputData + ) + + const patchedScheduleBatchCalldata = timelockIface.encodeFunctionData( + 'scheduleBatch', + [ + [...decodedScheduleBatch[0], novaInbox], + [...decodedScheduleBatch[1], 0], + [...decodedScheduleBatch[2], unsafeCreateRetryableCalldata], + decodedScheduleBatch[3], + decodedScheduleBatch[4], + decodedScheduleBatch[5], + ] + ) + + proposalData.arbSysSendTxToL1Args.calldata = patchedScheduleBatchCalldata + + fs.writeFileSync(proposalDataFile, JSON.stringify(proposalData, null, 2)) +})() + +function calcSubmissionCost(baseFee: BigNumber) { + // data length is zero + // from the contract: return (1400 + 6 * dataLength) * (baseFee == 0 ? block.basefee : baseFee); + return baseFee.mul(1400) +} diff --git a/scripts/proposals/timeboost-extra-items/data.json b/scripts/proposals/timeboost-extra-items/data.json new file mode 100644 index 000000000..310f6023f --- /dev/null +++ b/scripts/proposals/timeboost-extra-items/data.json @@ -0,0 +1,16 @@ +{ + "actionChainIds": [ + 1, + 42161, + 42170 + ], + "actionAddresses": [ + "0xBB86bBd4871728938B30A54Cc08E0eb2bC75302d", + "0x734B78823c4d979045EC23F38B54A070df7769FF", + "0x7d91da41DaF1C2e1c3dBC6143289E077E0DbA1eF" + ], + "arbSysSendTxToL1Args": { + "l1Timelock": "0xE6841D92B0C345144506576eC13ECf5103aC7f49", + "calldata": "0x8f2a0bb000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000afa240dd4c6513a86965b2fdce079dc265548e8d301653ccf5602a9126c06bf8000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000000040000000000000000000000003fffbadaf827559da092217e474760e2b2c3cedd000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a153949000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000000e41cff79cd000000000000000000000000bb86bbd4871728938b30a54cc08e0eb2bc75302d00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064e17f52e90000000000000000000000005613af0474eb9c528a34701a5b1662e3c8fa06780000000000000000000000003fffbadaf827559da092217e474760e2b2c3cedd000000000000000000000000de505e42d50abd07c8d39dcf692920d56cba35da000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000004dbd4fc535ac27206064b68ffcf827b0a60bab3f000000000000000000000000cf57572261c7c2bcf21ffd220ea7d1a27d40a82700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000e41cff79cd000000000000000000000000734b78823c4d979045ec23f38b54a070df7769ff00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064e17f52e9000000000000000000000000db216562328215e010f819b5abe947bad4ca961e000000000000000000000000cf57572261c7c2bcf21ffd220ea7d1a27d40a82700000000000000000000000012b1389fbf261e781bdc3094d28636abfb03c5b3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a15394900000000000000000000000086a02dd71363c440b21f4c0e5b2ad01ffe1a748200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000e41cff79cd0000000000000000000000007d91da41daf1c2e1c3dbc6143289e077e0dba1ef00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064e17f52e9000000000000000000000000f58ea15b20983116c21b05c876cc8e6cdae5c2b900000000000000000000000086a02dd71363c440b21f4c0e5b2ad01ffe1a7482000000000000000000000000ebb11bbd7d72165fac86bb5ab1b07a602540b286000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001246e6e8a6a00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d0000000000000000000000000000000000000000000000663a9d579527ee69800000000000000000000000000000000000000000000000000004f94ae6af800000000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } +} \ No newline at end of file diff --git a/scripts/proposals/timeboost-extra-items/generate.bash b/scripts/proposals/timeboost-extra-items/generate.bash new file mode 100755 index 000000000..6f542a6d2 --- /dev/null +++ b/scripts/proposals/timeboost-extra-items/generate.bash @@ -0,0 +1,58 @@ +#!/bin/bash + +# We call ProxyUpgradeAction::perform(address admin, address payable target, address newLogic) + +# ProxyUpgradeAction contracts: +# L1: 0xBB86bBd4871728938B30A54Cc08E0eb2bC75302d +# Arb1: 0x734B78823c4d979045EC23F38B54A070df7769FF +# Nova: 0x7d91da41DaF1C2e1c3dBC6143289E077E0DbA1eF + +# UpgradeExecutor ProxyAdmins: +# L1: 0x5613AF0474EB9c528A34701A5b1662E3C8FA0678 +# Arb1: 0xdb216562328215E010F819B5aBe947bad4ca961e +# Nova: 0xf58eA15B20983116c21b05c876cc8e6CDAe5C2b9 + +# UpgradeExecutor Proxies: +# L1: 0x3ffFbAdAF827559da092217e474760E2b2c3CeDd +# Arb1: 0xCF57572261c7c2BCF21ffD220ea7d1a27D40A827 +# Nova: 0x86a02dD71363c440b21F4c0E5B2Ad01Ffe1A7482 + +# UpgradeExecutor Logics: +# L1: 0xDE505e42D50abd07c8D39Dcf692920d56cBA35Da +# Arb1: 0x12B1389Fbf261E781bdc3094d28636Abfb03C5b3 +# Nova: 0xebb11Bbd7d72165FaC86bb5AB1B07A602540b286 + +# First generate a proposal to upgrade the UpgradeExecutor on all 3 chains +yarn gen:proposalData \ + --govChainProviderRPC https://arb1.arbitrum.io/rpc \ + --predecessor 0x0000000000000000000000000000000000000000000000000000000000000000 \ + --upgradeValues 0 0 0 \ + --actionChainIds 1 42161 42170 \ + --actionAddresses \ + 0xBB86bBd4871728938B30A54Cc08E0eb2bC75302d \ + 0x734B78823c4d979045EC23F38B54A070df7769FF \ + 0x7d91da41DaF1C2e1c3dBC6143289E077E0DbA1eF \ + --upgradeDatas \ + $(cast calldata \ + "perform(address, address, address)" \ + 0x5613AF0474EB9c528A34701A5b1662E3C8FA0678 \ + 0x3ffFbAdAF827559da092217e474760E2b2c3CeDd \ + 0xDE505e42D50abd07c8D39Dcf692920d56cBA35Da \ + ) \ + $(cast calldata \ + "perform(address, address, address)" \ + 0xdb216562328215E010F819B5aBe947bad4ca961e \ + 0xCF57572261c7c2BCF21ffD220ea7d1a27D40A827 \ + 0x12B1389Fbf261E781bdc3094d28636Abfb03C5b3 \ + ) \ + $(cast calldata \ + "perform(address, address, address)" \ + 0xf58eA15B20983116c21b05c876cc8e6CDAe5C2b9 \ + 0x86a02dD71363c440b21F4c0E5B2Ad01Ffe1A7482 \ + 0xebb11Bbd7d72165FaC86bb5AB1B07A602540b286 \ + ) \ + --writeToJsonPath ./scripts/proposals/timeboost-extra-items/data.json + + +# Second, patch the proposal with the fee sweep +yarn ts-node ./scripts/proposals/NovaFeeSweep/patchProposal.ts ./scripts/proposals/timeboost-extra-items/data.json