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

bug: driver does not use access lists when simulating pre-hooks while computing balances #3252

Open
MartinquaXD opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working track:maintenance maintenance track

Comments

@MartinquaXD
Copy link
Contributor

Problem

This order was filled sub-optimally in 2 partial fills.
It contains a pre-hook that claims rewards to provide the full sell token balance to the owner. The driver already computes the available balances for an order based on the outcome of the pre-hooks (if there are any). But in this case the balance simulation didn't show that the owner would get all the necessary sell tokens from the hook so it reported the available balance to be whatever the owner currently has without the hook.
A solver picked up this order and executed it. In the actual settlement the hook got executed and unlocked the remaining sell tokens which led to another partial fill that then fulfilled the order completely.

When simulating the hook on its own it exceeds its gas limit and therefor reverts. This explains why no balance change happens in the simulation. However, in the actual settlement the balance change happened.
When comparing the hook simulation with the onchain settlement simulation it became apparent that executing the hook as part of the actual settlement was a lot cheaper.

The reason seems to be that the storage loads are a lot cheaper in the real settlement. That is likely caused by the fact that we use access lists for the real solution but not during the balance simulation.

Impact

The driver fails to compute an order's accurate available balance when hooks unlocking sell tokens set a tight gas limit.

Expected behaviour

The simulation for computing the available balance should be as close to the real settlement as possible to avoid these differences.
The easy fix is to just use access lists for during the balance simulation, too.

@MartinquaXD MartinquaXD added bug Something isn't working track:maintenance maintenance track labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working track:maintenance maintenance track
Projects
None yet
Development

No branches or pull requests

1 participant