From 684fb599beae49cc00a0bac293805dead34e39f6 Mon Sep 17 00:00:00 2001 From: Henry <11198460+godzillaba@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:48:09 -0400 Subject: [PATCH 1/8] add script to patch proposal --- .../proposals/NovaFeeSweep/patchProposal.ts | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 scripts/proposals/NovaFeeSweep/patchProposal.ts diff --git a/scripts/proposals/NovaFeeSweep/patchProposal.ts b/scripts/proposals/NovaFeeSweep/patchProposal.ts new file mode 100644 index 000000000..89447716b --- /dev/null +++ b/scripts/proposals/NovaFeeSweep/patchProposal.ts @@ -0,0 +1,56 @@ +// takes proposal data as input and adds a transaction to sweep ETH from the L1 Timelock alias on Nova +// context: https://www.tally.xyz/gov/arbitrum/proposal/108288822474129076868455956066667369439381709547570289793612729242368710728616 + +import { ethers } from 'ethers' +import { + IInbox__factory, + L1ArbitrumTimelock__factory, +} from '../../../typechain-types' +import { JsonRpcProvider } from '@ethersproject/providers' + +;(async () => { + const inputData = + '0x8f2a0bb000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000000e13fb8241eb0e976305ff5f40d43d783c08468da55f38eee093510e004f512aa000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000000070000000000000000000000003fffbadaf827559da092217e474760e2b2c3cedd0000000000000000000000003fffbadaf827559da092217e474760e2b2c3cedd000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c00000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000008e000000000000000000000000000000000000000000000000000000000000000841cff79cd00000000000000000000000019b715cf310c28c9020e53aaa11ce9df42e718b500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000658afc9d5ec4476fa6bb7033ea465f9901fbff2700000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001800000000000000000000000004dbd4fc535ac27206064b68ffcf827b0a60bab3f000000000000000000000000cf57572261c7c2bcf21ffd220ea7d1a27d40a82700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000af81c82ec98f86d0017d78cd66f1026f1a5cf1db00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001800000000000000000000000004dbd4fc535ac27206064b68ffcf827b0a60bab3f000000000000000000000000cf57572261c7c2bcf21ffd220ea7d1a27d40a82700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000b040b105a4a0c7a9cc290164accbc3285536832200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a15394900000000000000000000000086a02dd71363c440b21f4c0e5b2ad01ffe1a748200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd0000000000000000000000006dd43360d2a69bb9fffc5349f2511f2a3bcbc2da00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a15394900000000000000000000000086a02dd71363c440b21f4c0e5b2ad01ffe1a748200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd00000000000000000000000061703bf337341f2e09d96dd6488c2907718a8e2600000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a15394900000000000000000000000086a02dd71363c440b21f4c0e5b2ad01ffe1a748200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000849e360a247132f961c9cbe95ba39106c72e126800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + + const l1TimelockAlias = '0xf7951d92b0c345144506576ec13ecf5103ac905a' + const novaInbox = '0xc4448b71118c9071Bcb9734A0EAc55D18A153949' + const novaToParentRouter = '0x36D0170D92F66e8949eB276C3AC4FEA64f83704d' + const maxSubmissionCost = ethers.utils.parseEther('0.01') + const callValue = await new JsonRpcProvider('https://nova.arbitrum.io/rpc').getBalance(l1TimelockAlias) + + const timelockIface = L1ArbitrumTimelock__factory.createInterface() + const inboxIface = IInbox__factory.createInterface() + + const unsafeCreateRetryableCalldata = inboxIface.encodeFunctionData( + 'unsafeCreateRetryableTicket', + [ + novaToParentRouter, // to + callValue, // 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], maxSubmissionCost], + [...decodedScheduleBatch[2], unsafeCreateRetryableCalldata], + decodedScheduleBatch[3], + decodedScheduleBatch[4], + decodedScheduleBatch[5], + ] + ) + + console.log(patchedScheduleBatchCalldata) +})() From e122a9b057c64f22080e84ff4110e81bef87f11d Mon Sep 17 00:00:00 2001 From: Henry <11198460+godzillaba@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:50:25 -0400 Subject: [PATCH 2/8] add comment --- scripts/proposals/NovaFeeSweep/patchProposal.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/proposals/NovaFeeSweep/patchProposal.ts b/scripts/proposals/NovaFeeSweep/patchProposal.ts index 89447716b..c56a0ff13 100644 --- a/scripts/proposals/NovaFeeSweep/patchProposal.ts +++ b/scripts/proposals/NovaFeeSweep/patchProposal.ts @@ -9,6 +9,8 @@ import { import { JsonRpcProvider } from '@ethersproject/providers' ;(async () => { + // this is the bianca payload and serves as an example + // TODO: this should be replaced with some future proposal const inputData = '0x8f2a0bb000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000000e13fb8241eb0e976305ff5f40d43d783c08468da55f38eee093510e004f512aa000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000000070000000000000000000000003fffbadaf827559da092217e474760e2b2c3cedd0000000000000000000000003fffbadaf827559da092217e474760e2b2c3cedd000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c00000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000008e000000000000000000000000000000000000000000000000000000000000000841cff79cd00000000000000000000000019b715cf310c28c9020e53aaa11ce9df42e718b500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000658afc9d5ec4476fa6bb7033ea465f9901fbff2700000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001800000000000000000000000004dbd4fc535ac27206064b68ffcf827b0a60bab3f000000000000000000000000cf57572261c7c2bcf21ffd220ea7d1a27d40a82700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000af81c82ec98f86d0017d78cd66f1026f1a5cf1db00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001800000000000000000000000004dbd4fc535ac27206064b68ffcf827b0a60bab3f000000000000000000000000cf57572261c7c2bcf21ffd220ea7d1a27d40a82700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000b040b105a4a0c7a9cc290164accbc3285536832200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a15394900000000000000000000000086a02dd71363c440b21f4c0e5b2ad01ffe1a748200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd0000000000000000000000006dd43360d2a69bb9fffc5349f2511f2a3bcbc2da00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a15394900000000000000000000000086a02dd71363c440b21f4c0e5b2ad01ffe1a748200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd00000000000000000000000061703bf337341f2e09d96dd6488c2907718a8e2600000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a15394900000000000000000000000086a02dd71363c440b21f4c0e5b2ad01ffe1a748200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000849e360a247132f961c9cbe95ba39106c72e126800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' From 0867b4e4d2c5594bd05957924a7d250455a9fbb3 Mon Sep 17 00:00:00 2001 From: Henry <11198460+godzillaba@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:46:18 -0400 Subject: [PATCH 3/8] present gas price instead of submission cost --- scripts/proposals/NovaFeeSweep/patchProposal.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/proposals/NovaFeeSweep/patchProposal.ts b/scripts/proposals/NovaFeeSweep/patchProposal.ts index c56a0ff13..45b1709ee 100644 --- a/scripts/proposals/NovaFeeSweep/patchProposal.ts +++ b/scripts/proposals/NovaFeeSweep/patchProposal.ts @@ -1,7 +1,7 @@ // takes proposal data as input and adds a transaction to sweep ETH from the L1 Timelock alias on Nova // context: https://www.tally.xyz/gov/arbitrum/proposal/108288822474129076868455956066667369439381709547570289793612729242368710728616 -import { ethers } from 'ethers' +import { BigNumber, ethers } from 'ethers' import { IInbox__factory, L1ArbitrumTimelock__factory, @@ -17,12 +17,14 @@ import { JsonRpcProvider } from '@ethersproject/providers' const l1TimelockAlias = '0xf7951d92b0c345144506576ec13ecf5103ac905a' const novaInbox = '0xc4448b71118c9071Bcb9734A0EAc55D18A153949' const novaToParentRouter = '0x36D0170D92F66e8949eB276C3AC4FEA64f83704d' - const maxSubmissionCost = ethers.utils.parseEther('0.01') + const maxL1GasPrice = ethers.utils.parseUnits('1000', 'gwei') // used to calculate maxSubmissionCost const callValue = 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', [ @@ -56,3 +58,9 @@ import { JsonRpcProvider } from '@ethersproject/providers' console.log(patchedScheduleBatchCalldata) })() + +function calcSubmissionCost(baseFee: BigNumber) { + // data length is zero + // from the contract: return (1400 + 6 * dataLength) * (baseFee == 0 ? block.basefee : baseFee); + return baseFee.mul(1400) +} From f3f732f405abc4cd0b5efd6dd63033b3d5b28cb5 Mon Sep 17 00:00:00 2001 From: Henry <11198460+godzillaba@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:48:53 -0400 Subject: [PATCH 4/8] use l2 balance for submission fee --- scripts/proposals/NovaFeeSweep/patchProposal.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/proposals/NovaFeeSweep/patchProposal.ts b/scripts/proposals/NovaFeeSweep/patchProposal.ts index 45b1709ee..c2112d9a9 100644 --- a/scripts/proposals/NovaFeeSweep/patchProposal.ts +++ b/scripts/proposals/NovaFeeSweep/patchProposal.ts @@ -18,7 +18,7 @@ import { JsonRpcProvider } from '@ethersproject/providers' const novaInbox = '0xc4448b71118c9071Bcb9734A0EAc55D18A153949' const novaToParentRouter = '0x36D0170D92F66e8949eB276C3AC4FEA64f83704d' const maxL1GasPrice = ethers.utils.parseUnits('1000', 'gwei') // used to calculate maxSubmissionCost - const callValue = await new JsonRpcProvider('https://nova.arbitrum.io/rpc').getBalance(l1TimelockAlias) + const aliasBalance = await new JsonRpcProvider('https://nova.arbitrum.io/rpc').getBalance(l1TimelockAlias) const timelockIface = L1ArbitrumTimelock__factory.createInterface() const inboxIface = IInbox__factory.createInterface() @@ -29,7 +29,7 @@ import { JsonRpcProvider } from '@ethersproject/providers' 'unsafeCreateRetryableTicket', [ novaToParentRouter, // to - callValue, // l2CallValue + aliasBalance.sub(maxSubmissionCost), // l2CallValue maxSubmissionCost, // maxSubmissionCost novaToParentRouter, // excessFeeRefundAddress novaToParentRouter, // callValueRefundAddress @@ -48,7 +48,7 @@ import { JsonRpcProvider } from '@ethersproject/providers' 'scheduleBatch', [ [...decodedScheduleBatch[0], novaInbox], - [...decodedScheduleBatch[1], maxSubmissionCost], + [...decodedScheduleBatch[1], 0], [...decodedScheduleBatch[2], unsafeCreateRetryableCalldata], decodedScheduleBatch[3], decodedScheduleBatch[4], From 857b3eb21169dd03f29f667ac14a7eb17fc5485c Mon Sep 17 00:00:00 2001 From: Henry <11198460+godzillaba@users.noreply.github.com> Date: Fri, 3 Jan 2025 09:44:24 -0500 Subject: [PATCH 5/8] standalone proposal --- scripts/proposals/NovaFeeSweep/generate.ts | 58 ++++++++++++++++ .../proposals/NovaFeeSweep/patchProposal.ts | 66 ------------------- scripts/proposals/NovaFeeSweep/proposal.txt | 1 + 3 files changed, 59 insertions(+), 66 deletions(-) create mode 100644 scripts/proposals/NovaFeeSweep/generate.ts delete mode 100644 scripts/proposals/NovaFeeSweep/patchProposal.ts create mode 100644 scripts/proposals/NovaFeeSweep/proposal.txt diff --git a/scripts/proposals/NovaFeeSweep/generate.ts b/scripts/proposals/NovaFeeSweep/generate.ts new file mode 100644 index 000000000..5541762d8 --- /dev/null +++ b/scripts/proposals/NovaFeeSweep/generate.ts @@ -0,0 +1,58 @@ +// generates a proposal payload to sweep the Nova L1 Timelock alias ETH balance to the fee router contract. + +import { BigNumber, ethers } from 'ethers' +import { + IInbox__factory, + L1ArbitrumTimelock__factory, +} from '../../../typechain-types' +import { JsonRpcProvider } from '@ethersproject/providers' +import fs from 'fs' +;(async () => { + 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 scheduleCalldata = timelockIface.encodeFunctionData('schedule', [ + novaInbox, + 0, + unsafeCreateRetryableCalldata, + '0x0000000000000000000000000000000000000000000000000000000000000000', + '0xafa240dd4c6513a86965b2fdce079dc265548e8d301653ccf5602a9126c06bf8', + 259200, + ]) + + console.log(scheduleCalldata) + + fs.writeFileSync( + './scripts/proposals/NovaFeeSweep/proposal.txt', + scheduleCalldata + ) +})() + +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/NovaFeeSweep/patchProposal.ts b/scripts/proposals/NovaFeeSweep/patchProposal.ts deleted file mode 100644 index c2112d9a9..000000000 --- a/scripts/proposals/NovaFeeSweep/patchProposal.ts +++ /dev/null @@ -1,66 +0,0 @@ -// takes proposal data as input and adds a transaction to sweep ETH from the L1 Timelock alias on Nova -// context: https://www.tally.xyz/gov/arbitrum/proposal/108288822474129076868455956066667369439381709547570289793612729242368710728616 - -import { BigNumber, ethers } from 'ethers' -import { - IInbox__factory, - L1ArbitrumTimelock__factory, -} from '../../../typechain-types' -import { JsonRpcProvider } from '@ethersproject/providers' - -;(async () => { - // this is the bianca payload and serves as an example - // TODO: this should be replaced with some future proposal - const inputData = - '0x8f2a0bb000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000000e13fb8241eb0e976305ff5f40d43d783c08468da55f38eee093510e004f512aa000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000000070000000000000000000000003fffbadaf827559da092217e474760e2b2c3cedd0000000000000000000000003fffbadaf827559da092217e474760e2b2c3cedd000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c00000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000008e000000000000000000000000000000000000000000000000000000000000000841cff79cd00000000000000000000000019b715cf310c28c9020e53aaa11ce9df42e718b500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000658afc9d5ec4476fa6bb7033ea465f9901fbff2700000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001800000000000000000000000004dbd4fc535ac27206064b68ffcf827b0a60bab3f000000000000000000000000cf57572261c7c2bcf21ffd220ea7d1a27d40a82700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000af81c82ec98f86d0017d78cd66f1026f1a5cf1db00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001800000000000000000000000004dbd4fc535ac27206064b68ffcf827b0a60bab3f000000000000000000000000cf57572261c7c2bcf21ffd220ea7d1a27d40a82700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000b040b105a4a0c7a9cc290164accbc3285536832200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a15394900000000000000000000000086a02dd71363c440b21f4c0e5b2ad01ffe1a748200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd0000000000000000000000006dd43360d2a69bb9fffc5349f2511f2a3bcbc2da00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a15394900000000000000000000000086a02dd71363c440b21f4c0e5b2ad01ffe1a748200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd00000000000000000000000061703bf337341f2e09d96dd6488c2907718a8e2600000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a15394900000000000000000000000086a02dd71363c440b21f4c0e5b2ad01ffe1a748200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000841cff79cd000000000000000000000000849e360a247132f961c9cbe95ba39106c72e126800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004b147f40c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' - - 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], - ] - ) - - console.log(patchedScheduleBatchCalldata) -})() - -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/NovaFeeSweep/proposal.txt b/scripts/proposals/NovaFeeSweep/proposal.txt new file mode 100644 index 000000000..eb47c1637 --- /dev/null +++ b/scripts/proposals/NovaFeeSweep/proposal.txt @@ -0,0 +1 @@ +0x01d5062a000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a153949000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000afa240dd4c6513a86965b2fdce079dc265548e8d301653ccf5602a9126c06bf8000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000001246e6e8a6a00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d0000000000000000000000000000000000000000000000663a9d579527ee69800000000000000000000000000000000000000000000000000004f94ae6af800000000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \ No newline at end of file From a1a2e57265e5b5faf5773e49f3339d96ff1145cd Mon Sep 17 00:00:00 2001 From: Henry <11198460+godzillaba@users.noreply.github.com> Date: Fri, 3 Jan 2025 09:48:07 -0500 Subject: [PATCH 6/8] salt --- scripts/proposals/NovaFeeSweep/generate.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/proposals/NovaFeeSweep/generate.ts b/scripts/proposals/NovaFeeSweep/generate.ts index 5541762d8..7009094c3 100644 --- a/scripts/proposals/NovaFeeSweep/generate.ts +++ b/scripts/proposals/NovaFeeSweep/generate.ts @@ -7,7 +7,8 @@ import { } from '../../../typechain-types' import { JsonRpcProvider } from '@ethersproject/providers' import fs from 'fs' -;(async () => { +;import { keccak256 } from 'ethers/lib/utils'; +(async () => { const l1TimelockAlias = '0xf7951d92b0c345144506576ec13ecf5103ac905a' const novaInbox = '0xc4448b71118c9071Bcb9734A0EAc55D18A153949' const novaToParentRouter = '0x36D0170D92F66e8949eB276C3AC4FEA64f83704d' @@ -39,7 +40,7 @@ import fs from 'fs' 0, unsafeCreateRetryableCalldata, '0x0000000000000000000000000000000000000000000000000000000000000000', - '0xafa240dd4c6513a86965b2fdce079dc265548e8d301653ccf5602a9126c06bf8', + keccak256('Nova Fee Sweep'), 259200, ]) From 5d285eb95326067bbf325664283dea5b838ecd45 Mon Sep 17 00:00:00 2001 From: Henry <11198460+godzillaba@users.noreply.github.com> Date: Fri, 3 Jan 2025 09:48:43 -0500 Subject: [PATCH 7/8] salt and gen --- scripts/proposals/NovaFeeSweep/generate.ts | 4 ++-- scripts/proposals/NovaFeeSweep/proposal.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/proposals/NovaFeeSweep/generate.ts b/scripts/proposals/NovaFeeSweep/generate.ts index 7009094c3..3ceec2a61 100644 --- a/scripts/proposals/NovaFeeSweep/generate.ts +++ b/scripts/proposals/NovaFeeSweep/generate.ts @@ -7,7 +7,7 @@ import { } from '../../../typechain-types' import { JsonRpcProvider } from '@ethersproject/providers' import fs from 'fs' -;import { keccak256 } from 'ethers/lib/utils'; +;import { keccak256, toUtf8Bytes } from 'ethers/lib/utils'; (async () => { const l1TimelockAlias = '0xf7951d92b0c345144506576ec13ecf5103ac905a' const novaInbox = '0xc4448b71118c9071Bcb9734A0EAc55D18A153949' @@ -40,7 +40,7 @@ import fs from 'fs' 0, unsafeCreateRetryableCalldata, '0x0000000000000000000000000000000000000000000000000000000000000000', - keccak256('Nova Fee Sweep'), + keccak256(toUtf8Bytes('Nova Fee Sweep')), 259200, ]) diff --git a/scripts/proposals/NovaFeeSweep/proposal.txt b/scripts/proposals/NovaFeeSweep/proposal.txt index eb47c1637..293ae1c54 100644 --- a/scripts/proposals/NovaFeeSweep/proposal.txt +++ b/scripts/proposals/NovaFeeSweep/proposal.txt @@ -1 +1 @@ -0x01d5062a000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a153949000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000afa240dd4c6513a86965b2fdce079dc265548e8d301653ccf5602a9126c06bf8000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000001246e6e8a6a00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d0000000000000000000000000000000000000000000000663a9d579527ee69800000000000000000000000000000000000000000000000000004f94ae6af800000000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \ No newline at end of file +0x01d5062a000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a153949000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000001d64bfd58bbc5089313cbb4cac6bc0dc5cf3e849834e8a91537a8ba2ba553146000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000001246e6e8a6a00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d0000000000000000000000000000000000000000000000663a9d579527ee69800000000000000000000000000000000000000000000000000004f94ae6af800000000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \ No newline at end of file From 52ccaeb2ee9448e3b5b9a64475d93b65a5066924 Mon Sep 17 00:00:00 2001 From: Henry <11198460+godzillaba@users.noreply.github.com> Date: Fri, 3 Jan 2025 09:55:48 -0500 Subject: [PATCH 8/8] common format --- scripts/proposals/NovaFeeSweep/data.json | 6 ++++++ scripts/proposals/NovaFeeSweep/generate.ts | 17 ++++++++++++----- scripts/proposals/NovaFeeSweep/proposal.txt | 1 - 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 scripts/proposals/NovaFeeSweep/data.json delete mode 100644 scripts/proposals/NovaFeeSweep/proposal.txt diff --git a/scripts/proposals/NovaFeeSweep/data.json b/scripts/proposals/NovaFeeSweep/data.json new file mode 100644 index 000000000..d86359b59 --- /dev/null +++ b/scripts/proposals/NovaFeeSweep/data.json @@ -0,0 +1,6 @@ +{ + "arbSysSendTxToL1Args": { + "l1Timelock": "0xE6841D92B0C345144506576eC13ECf5103aC7f49", + "calldata": "0x01d5062a000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a153949000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000001d64bfd58bbc5089313cbb4cac6bc0dc5cf3e849834e8a91537a8ba2ba553146000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000001246e6e8a6a00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d0000000000000000000000000000000000000000000000663a9d579527ee69800000000000000000000000000000000000000000000000000004f94ae6af800000000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } +} \ No newline at end of file diff --git a/scripts/proposals/NovaFeeSweep/generate.ts b/scripts/proposals/NovaFeeSweep/generate.ts index 3ceec2a61..4acb2e077 100644 --- a/scripts/proposals/NovaFeeSweep/generate.ts +++ b/scripts/proposals/NovaFeeSweep/generate.ts @@ -7,8 +7,8 @@ import { } from '../../../typechain-types' import { JsonRpcProvider } from '@ethersproject/providers' import fs from 'fs' -;import { keccak256, toUtf8Bytes } from 'ethers/lib/utils'; -(async () => { +import { keccak256, toUtf8Bytes } from 'ethers/lib/utils' +;(async () => { const l1TimelockAlias = '0xf7951d92b0c345144506576ec13ecf5103ac905a' const novaInbox = '0xc4448b71118c9071Bcb9734A0EAc55D18A153949' const novaToParentRouter = '0x36D0170D92F66e8949eB276C3AC4FEA64f83704d' @@ -44,11 +44,18 @@ import fs from 'fs' 259200, ]) - console.log(scheduleCalldata) + const output = { + arbSysSendTxToL1Args: { + l1Timelock: '0xE6841D92B0C345144506576eC13ECf5103aC7f49', + calldata: scheduleCalldata, + }, + } + + console.log(output) fs.writeFileSync( - './scripts/proposals/NovaFeeSweep/proposal.txt', - scheduleCalldata + './scripts/proposals/NovaFeeSweep/data.json', + JSON.stringify(output, null, 2) ) })() diff --git a/scripts/proposals/NovaFeeSweep/proposal.txt b/scripts/proposals/NovaFeeSweep/proposal.txt deleted file mode 100644 index 293ae1c54..000000000 --- a/scripts/proposals/NovaFeeSweep/proposal.txt +++ /dev/null @@ -1 +0,0 @@ -0x01d5062a000000000000000000000000c4448b71118c9071bcb9734a0eac55d18a153949000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000001d64bfd58bbc5089313cbb4cac6bc0dc5cf3e849834e8a91537a8ba2ba553146000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000001246e6e8a6a00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d0000000000000000000000000000000000000000000000663a9d579527ee69800000000000000000000000000000000000000000000000000004f94ae6af800000000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d00000000000000000000000036d0170d92f66e8949eb276c3ac4fea64f83704d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \ No newline at end of file