Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Component for Balance Overrides (#3125)
# Description This PR is the first in a stack to add a system for overriding balances so that more quotes can be verified. One limitation with the current quote verification system, is that it requires that the `from` account in the quote has the sell token balance available (or available after a pre-hook is executed) in order for the quote to be properly verified. This isn't always possible for all flows (and notably flows at Safe, where transactions to prepare the balance happens at the same time as the `setPreSignature` transaction executes, so after the quote). The overall solution I would propose (hopefully a pragmatic one that isn't considered _too_ hacky) would be enable special handling for the most commonly traded tokens, by configuring for each token how the storage slot is computed for the token balance. This way, you could maintain a file that contains a `token => computation_strategy` map for the most popular tokens allowing trades to be verified even for quotes from users without the balance available. This PR is the first piece for this overall solution, which introduces a component for computing storage slots needed for overriding balances for `eth_call` simulations. If this strategy is accepted, in a follow up PRs I would: 1. Add the component to the trade verifier and use it to fund the trader when simulating quotes (I have an idea on how to do this: you would override the balance of the `Solver` simulation entrypoint, which would top up the `Trader` balance if needed; this way the missing balance can be reported as part of the simulation and logged). 2. Pipe configuration to the trade verifier and balance overrides component # Changes - [x] Introduces a new `BalanceOverriding` component ## How to test Added unit tests verifying logic.
- Loading branch information