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

Reject orders using too much gas #2551

Merged
merged 4 commits into from
Mar 24, 2024
Merged

Reject orders using too much gas #2551

merged 4 commits into from
Mar 24, 2024

Conversation

fleupold
Copy link
Contributor

Description

We are seeing inefficiency with some ERC1271 orders on Gnosis that are using a large amount of gas reducing settlement throughput for other traders. This PR limits the amount of gas an order can consume (including signature validation and hooks)

Changes

  • Introduce a new error type too much gas
  • Return this error if the total gas estimate (including hooks) exceeds a certain threshold

Considerations:

  • Should we also block native ETH flow orders below a certain validation limit?
  • Should we already warn during quoting when the order is likely going to exceed the gas limit?

Both of these would make the PR more involved while not directly addressing the somewhat pressing issue we have on Gnosis Chain.

How to test

Test for hooks. I'm also working on a test for ERC1271 orders, however it's a bit more involved because we need a fake verifier contract that uses a lot of gas

@fleupold fleupold requested a review from a team as a code owner March 20, 2024 22:02
Copy link
Contributor

@squadgazzz squadgazzz left a comment

Choose a reason for hiding this comment

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

LG. Regarding the considerations, maybe we should analyze how often the error occurs once the change is released.

@@ -1187,6 +1187,7 @@ components:
ZeroAmount,
IncompatibleSigningScheme,
TooManyLimitOrders,
TooMuchGas,
Copy link
Contributor

Choose a reason for hiding this comment

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

@mfw78 this introduces a new error type the watchtower needs to know about to not get stuck indexing these orders, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

@fleupold fleupold merged commit 7bababd into main Mar 24, 2024
9 checks passed
@fleupold fleupold deleted the max_gas_per_order branch March 24, 2024 17:24
@github-actions github-actions bot locked and limited conversation to collaborators Mar 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants