Skip to content

Commit be78de3

Browse files
feat: Added upgradeToAndCall to Spoke Pool Upgrade task (#1095)
* feat: Try upgradeTo for testing Signed-off-by: Faisal Usmani <[email protected]> * Added pause deposits toggle to spoke pool upgrade script Signed-off-by: Faisal Usmani <[email protected]> * Added option to only do upgrade Signed-off-by: Faisal Usmani <[email protected]> * Added comment explaning the multicall Signed-off-by: Faisal Usmani <[email protected]> * update comment Co-authored-by: nicholaspai <[email protected]> Signed-off-by: Faisal Usmani <[email protected]> * Using abi from artifact Signed-off-by: Faisal Usmani <[email protected]> * Dropped optional param Signed-off-by: Faisal Usmani <[email protected]> * feat: Upgrade CCTP V1 deployments to V2 * latest * deploy arbitrum * arbitrum * deploy optimism * optimism * deplooy optimism spoke pool and polygon adapter * update * deploy polygon spoke * polygon deployed * Deploy base and unichain adapters * deployments * Deploy unichain and base spoke pools * pdate deployed * Update upgradeSpokePool.ts * removed unsed var Signed-off-by: Faisal Usmani <[email protected]> * upgrade forge-std Signed-off-by: Faisal Usmani <[email protected]> * pin forge-std version Signed-off-by: Faisal Usmani <[email protected]> * forge install foundry-rs/forge-std * Update upgradeSpokePool.ts --------- Signed-off-by: Faisal Usmani <[email protected]> Co-authored-by: nicholaspai <[email protected]> Co-authored-by: nicholaspai <[email protected]>
1 parent 534a6a7 commit be78de3

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

tasks/upgradeSpokePool.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,30 @@ task("upgrade-spokepool", "Generate calldata to upgrade a SpokePool deployment")
1212

1313
const { ethers } = hre;
1414

15+
const artifact = await hre.artifacts.readArtifact("SpokePool");
16+
1517
// @dev Any spoke pool's interface can be used here since they all should have the same upgradeTo function signature.
16-
const abi = ["function upgradeTo(address newImplementation) external"];
18+
const abi = artifact.abi;
1719
const spokePool = new ethers.Contract(implementation, abi);
1820

19-
const upgradeTo = spokePool.interface.encodeFunctionData("upgradeTo", [implementation]);
20-
console.log(`upgradeTo bytes: `, upgradeTo);
21+
let calldata = "";
22+
23+
/**
24+
* We perform this seemingly unnecessary pause/unpause sequence because we want to ensure that the
25+
* upgrade is successful and the new implementation gets forwarded calls by the proxy contract as expected
26+
*
27+
* Since the upgrade and call happens atomically, the upgrade will revert if the new implementation
28+
* is not functioning correctly.
29+
*/
30+
const data = spokePool.interface.encodeFunctionData("multicall", [
31+
[
32+
spokePool.interface.encodeFunctionData("pauseDeposits", [true]),
33+
spokePool.interface.encodeFunctionData("pauseDeposits", [false]),
34+
],
35+
]);
2136

37+
calldata = spokePool.interface.encodeFunctionData("upgradeToAndCall", [implementation, data]);
2238
console.log(
23-
`Call relaySpokePoolAdminFunction() with the params [<chainId>, ${upgradeTo}] on the hub pool from the owner's account.`
39+
`Call relaySpokePoolAdminFunction() with the params [<chainId>, ${calldata}] on the hub pool from the owner's account.`
2440
);
2541
});

0 commit comments

Comments
 (0)