Skip to content

Conversation

@fusmanii
Copy link
Contributor

@fusmanii fusmanii commented Sep 24, 2025

Copy link
Contributor

@pxrl pxrl left a 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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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);
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 8c03b88

@fusmanii fusmanii requested a review from pxrl September 25, 2025 14:17
pxrl
pxrl previously approved these changes Oct 8, 2025
Copy link
Contributor

@pxrl pxrl left a 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:

Comment on lines 78 to 94
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");
}
}
Copy link
Contributor

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;
}

// ...

Copy link
Contributor Author

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");
Copy link
Contributor

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.

Copy link
Contributor Author

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

@linear
Copy link

linear bot commented Oct 8, 2025

@fusmanii fusmanii merged commit 9f31ae4 into master Oct 27, 2025
10 checks passed
@fusmanii fusmanii deleted the faisal/transfer-ownership-universal-spokepool branch October 27, 2025 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants