-
Notifications
You must be signed in to change notification settings - Fork 72
feat: Added upgradeToAndCall to Spoke Pool Upgrade task #1095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Faisal Usmani <[email protected]>
462340a
to
4b60fdd
Compare
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
2e4e5ce
to
acb0084
Compare
Signed-off-by: Faisal Usmani <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Co-authored-by: nicholaspai <[email protected]> Signed-off-by: Faisal Usmani <[email protected]>
0d5917e
to
3520c92
Compare
tasks/upgradeSpokePool.ts
Outdated
@@ -17,13 +18,75 @@ task("upgrade-spokepool", "Generate calldata to upgrade a SpokePool deployment") | |||
} | |||
|
|||
// @dev Any spoke pool's interface can be used here since they all should have the same upgradeTo function signature. | |||
const abi = ["function upgradeTo(address newImplementation) external"]; | |||
const abi = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooc, can we draw on the ABI via typechain?
I'm generally pretty wary of using typechain, but given that the ABI is local to this repo it feels like we should be able to source it from somewhere dynamically, rather than have to redefine it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pxrl good point, I was able to get the abi directly from the artifact instead
@@ -3,8 +3,9 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; | |||
|
|||
task("upgrade-spokepool", "Generate calldata to upgrade a SpokePool deployment") | |||
.addParam("implementation", "New SpokePool implementation address") | |||
.addOptionalParam("upgradeOnly", "Upgrade only, do not pause/unpause deposits") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think there's a scenario where we wouldn't want the atomic pause/unpause?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On EVM chains we are absolutely sure there is no difference from the L1 EVM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just kept it in case someone is looking for the old upgrade only behaviour. @pxrl do you think its better (and safer) to only have atomic pause/unpause option?
/** | ||
* We perform this seemingly unnecessary pause/unpause sequence because we want to ensure that the | ||
* upgrade is successful and the new implementation gets forwarded calls by the proxy contract as expected | ||
* | ||
* Since the upgrade and call happens atomically, the upgrade will revert if the new implementation | ||
* is not functioning correctly. | ||
*/ | ||
const data = spokePool.interface.encodeFunctionData("multicall", [ | ||
[ | ||
spokePool.interface.encodeFunctionData("pauseDeposits", [true]), | ||
spokePool.interface.encodeFunctionData("pauseDeposits", [false]), | ||
], | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice; I like this!
Signed-off-by: Faisal Usmani <[email protected]>
We want to ensure that the new implementation is working as expected by toggling
pauseDeposits
function post upgrade