-
Notifications
You must be signed in to change notification settings - Fork 426
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
fix: Zksync gas estimation fix for aggregation ISMs #5220
base: main
Are you sure you want to change the base?
fix: Zksync gas estimation fix for aggregation ISMs #5220
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5220 +/- ##
=======================================
Coverage 77.53% 77.53%
=======================================
Files 103 103
Lines 2110 2110
Branches 190 190
=======================================
Hits 1636 1636
Misses 453 453
Partials 21 21
|
metadata.to_owned().into(), | ||
RawHyperlaneMessage::from(message).to_vec().into(), | ||
) | ||
.from(H160::random()); // We generate a random from address to ensure compatibility with zksync |
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.
appreciate the PR and investigation! 🙏
i had a look at zkSync-Community-Hub/zksync-developers#144 (reply in thread) and noticed it says that even when the from
field is specified, estimation can still fail because from
is not pointing to an actual smart account. This was the case with the Safe address in that thread:
When processing a transaction, the protocol checks the code of the from account and, in this case, as Safe accounts are not deployed as native accounts on zkSync (via createAccount or create2Account), it fails with the error above
so i wonder if it makes more sense to set from
to the relayer's smart account address set in the provider, to avoid running into a similar error
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 believe this is because of Safe-specific behavior. In the comment they mentioned, Safe accounts are not deployed as native accounts on zkSync (via createAccount or create2Account)
. This is likely because they're contracts that weren't deployed as accounts. What they're saying in that thread is that it the from
address has to be an account.
As I've successfully processed a transaction with this, it stands that the random addresses are interpreted as accounts despite not being initialized. This shouldn't encounter any errors, at least not above the probability of collision. It was probably failing for the Safe addresses because they were initialized as non-accounts.
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 see, can you please add this context to the comment
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 i'm fairly certain estimation fails on certain chains if from
has insufficient funds to theoretically pay for the simulated tx. We'd need to pass the signer address configured in the provider to make sure we don't run into that. Would you be down to do make that change as well?
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.
But then we'd run into the problem where if the relayer is a Safe on zksync it stops working, no? I've tested this on op bedrock, arb nitro, and zksync rollups, and it works on all three. Can you give an example chain where this might fail so I can test that?
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.
https://docs.ethers.org/v5/troubleshooting/errors/#help-INSUFFICIENT_FUNDS
I think that only applies when a gas price is specified, which isn't the case in this call. Happy to test this on the chains
Description
The aggregation ISM was non-functional on zksync chains. This is because of a difference in the zksync rpc api which failed all eth_estimateGas calls without a sender. See zkSync-Community-Hub/zksync-developers#144.
Only aggregation ISMs are affected, because they are the only ones making eth_estimateGas calls (in order to determine the cheapest subset of ISMs to verify with).
This PR fixes it by setting the from address to a random address for gas estimation. We are assuming that there is no vanity grinding for prefixes/gas optimization for the relayer account as this is uncommon.
Drive-by changes
n/a
Related issues
n/a
Backward compatibility
Yes
Testing
Manually tested on a zksync chain. Successful relay. https://zero-explorer.vercel.app/tx/0xc7cfd80b12585f507c2a0bf7fa9d6f84ff0b214c95960ca12293315c509f0e05#overview