-
Couldn't load subscription status.
- Fork 75
feat: Transfer Ownership on Universal SpokePool Deployment #1121
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
feat: Transfer Ownership on Universal SpokePool Deployment #1121
Conversation
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.
LGTM; two queries.
|
|
||
| const provider = hre.ethers.provider; | ||
| const safeCode = await provider.getCode(EXPECTED_SAFE_ADDRESS); | ||
| if (safeCode !== "0x" && proxyAddress) { |
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.
Also worth checking the owners of the safe deployment here?
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.
used safe kit to match the deployed mutisig 8c03b88
| const owner = await contract.owner(); | ||
| if (owner !== EXPECTED_SAFE_ADDRESS) { | ||
| await contract.transferOwnership(EXPECTED_SAFE_ADDRESS); | ||
| console.log("Transferred ownership to Expected Safe address:", EXPECTED_SAFE_ADDRESS); |
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.
wdyt about waiting for transaction confirmation and then reading the updated value here?
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.
done 8c03b88
…isal/transfer-ownership-universal-spokepool
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.
Minor style nit, but otherwise LGTM:
| const isDeployed = await existingProtocolKit.isSafeDeployed(); | ||
| if (proxyAddress) { | ||
| if (isDeployed) { | ||
| const factory = await hre.ethers.getContractFactory("Universal_SpokePool"); | ||
| const contract = factory.attach(proxyAddress); | ||
|
|
||
| const owner = await contract.owner(); | ||
| if (owner !== EXPECTED_SAFE_ADDRESS) { | ||
| await (await contract.transferOwnership(EXPECTED_SAFE_ADDRESS)).wait(); | ||
| console.log("Transferred ownership to Expected Safe address:", await contract.owner()); | ||
| } else { | ||
| console.log("Expected Safe address is already the owner of the Universal SpokePool"); | ||
| } | ||
| } else { | ||
| console.log("Safe is not deployed, skipping ownership transfer"); | ||
| } | ||
| } |
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 don't quite follow the logic here. If there's no proxyAddress is there any point to the code between lines 66 and 78?
It also seems possible to squash a couple of levels of indentation by inverting the logic and returning early on various conditions, i.e.:
if (!proxyAddress) {
return;
}
if (!isDeployed) {
console.log(...);
return;
}
// ...
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.
looks much cleaner now, 9bd543b
| console.log("Expected Safe address is already the owner of the Universal SpokePool"); | ||
| } | ||
| } else { | ||
| console.log("Safe is not deployed, skipping ownership transfer"); |
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.
Actually one additional thing - shouldn't we consider this to be an error condition? We basically require a safe to own each Universal SpokePool; if for whatever reason we end up on this code path, I feel like it should be obvious to the deployer that something is wrong.
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.
Converted the log to throw an error instead 9bd543b
Signed-off-by: Faisal Usmani <[email protected]>
Closes https://linear.app/uma/issue/ACX-4470/contracts-support-ownership-transfer-to-new-safe-address-post