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

fix(relayer): Use precomputed gas limits #1876

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

pxrl
Copy link
Contributor

@pxrl pxrl commented Oct 25, 2024

The relayer has had a bug for a while where it is incorrectly dropping the precomputed gas limit for non-message fills. Instead, it was retaining the limit for message fills. This can lead to unnecessary transaction simulation later on, increasing RPC consumption and potentially delaying fills.

In practice, it's totally unnecessary for the top-level relayer logic to consider whether the deposit has a message at all. This is because the ProfitClient handles that internally and takes responsibility for setting the gas limit. It's inherently required to do this because otherwise the relayer risks making a vastly unprofitable fill (if gas consumption varies between the initial estimate and any subsequent estimate).

The relayer has had a bug for a while where it is incorrectly dropping
the precomputed gas limit for non-message fills. Instead, it was
retaining the limit for message fills. This can lead to unnecessary
transaction simulation later on, increasing RPC consumption and
potentially delaying fills.
nicholaspai
nicholaspai previously approved these changes Oct 25, 2024
@pxrl pxrl changed the title fix(relayer): Invert gasLimit nullification fix(relayer): Drop gasLimit nullification Oct 25, 2024
@pxrl
Copy link
Contributor Author

pxrl commented Oct 25, 2024

One thing holding this back: some ERC20s consume a lot more gas on transfers than others. This PR would probably break filling for SNX and UMA at least.

james-a-morris
james-a-morris previously approved these changes Oct 25, 2024
@pxrl pxrl changed the title fix(relayer): Drop gasLimit nullification fix(relayer): Use precomputed gas limits Oct 25, 2024
@pxrl
Copy link
Contributor Author

pxrl commented Oct 25, 2024

One thing holding this back: some ERC20s consume a lot more gas on transfers than others. This PR would probably break filling for SNX and UMA at least.

Fixed by precomputing all types on startup: 6bf012a

This isn't as efficient as it could be, but it still miles better than the current status quo that's performing simulation for every single fill.

@pxrl pxrl dismissed stale reviews from james-a-morris and nicholaspai via 276b191 December 18, 2024 19:53
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