Skip to content
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

Proxy InboxValidatorManager for more efficient deploys #365

Closed
nambrot opened this issue Apr 28, 2022 · 5 comments
Closed

Proxy InboxValidatorManager for more efficient deploys #365

nambrot opened this issue Apr 28, 2022 · 5 comments
Assignees
Milestone

Comments

@nambrot
Copy link
Contributor

nambrot commented Apr 28, 2022

Abacus core deployments are relatively expensive. One way to easily save gas is to use EIP1667 proxies for the InboxValidatorManager

@nambrot nambrot moved this to Backlog in Hyperlane Tasks Apr 28, 2022
@nambrot nambrot moved this from Backlog to Sprint Backlog in Hyperlane Tasks May 10, 2022
@asaj
Copy link
Contributor

asaj commented May 12, 2022

Also for Inboxes, no?

@nambrot
Copy link
Contributor Author

nambrot commented May 13, 2022

I thought you made the point that being able to upgrade implementations is important for Inboxes in a way that is less so for the InboxValidatorManager?

@nambrot nambrot changed the title Make core deployments more gas-efficient Proxy InboxValidatorManager for more efficient deploys May 18, 2022
@yorhodes yorhodes self-assigned this May 18, 2022
@yorhodes
Copy link
Member

Abacus core deployments are relatively expensive. One way to easily save gas is to use EIP1667 proxies for the InboxValidatorManager

I assume you meant EIP1167
IIUC the beacon pattern we are already employing allows us to make upgrades with minimal proxies
ie just swap out the minimal proxy address instead of the implementation address?

@nambrot
Copy link
Contributor Author

nambrot commented May 19, 2022

Yes 1167.

Yeah maybe its easier to just use beacon proxy pattern, but the original point was that using 1167 is technically the minimal approach as it preserves the current property that InboxValidatorManagers are not upgradable. It's less of a need since governance can always upgrade via repointing to new InboxValidatorManager contracts on the Inbox, so it seems unnecessary to support upgrading

@nambrot nambrot added this to the alpha milestone Jun 6, 2022
@yorhodes
Copy link
Member

yorhodes commented Jun 8, 2022

After spending far too much time on this, I realized that _domain and _domainHash are immutable on MultisigValidatorManager. Therefore, "cloning runtime bytecode" with EIP-1167 only works if we move _domain/_domainHash out of bytecode and into storage. However, _domainHash is used by _recoverCheckpointSigner (used in isQuorum), which implies at least one additional SLOAD for InboxValidatorManager.process (in addition to the extra call from proxying).

Posting back of napkin math from chat with @asaj offline
InboxValidatorManager costs 1539485 to deploy
Minimal proxy is at least 41000 (32000 static + 200 * 45 bytes)
savingsPerChain(numberOfRemotes) = 1539485 * numberOfRemotes - (1539485 + 41000 * numberOfRemotes)
Even with 10 chains at current gas prices of 72 gwei on mainnet, this is only 1.37 ETH.

One day I will learn the lesson of premature optimization.

@yorhodes yorhodes closed this as completed Jun 8, 2022
Repository owner moved this from Sprint Backlog to Done in Hyperlane Tasks Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants