-
Notifications
You must be signed in to change notification settings - Fork 152
Description
Background
Currently the baseline solver takes into account only the gas usage by the transaction itself (interacting with the settlement contract), with hooks that can use up arbitrarily large amount of gas (although bound to specifiable limit), this can cause Baseline to operate at a loss. The correct way to estimate gas would be to simulate the solution. The solution to this problem applies generically to all quotes, but is most needed for the same sell and buy token interactions.
Transactions with the same sell and buy token are expected to be mainly used for hooks execution, paying for gas with the sell token instead of the native one. One prominent specific case of that is the cross-chain bridging of the same token.
Details
Solvers will be able to simulate their solutions by reaching a newly exposed endpoint in the driver, giving them its gas usage precisely. While working on exposing such endpoint it is useful to consider factoring out the simulation related code currently residing in driver into its separate crate.
If that proves to be too involved, We can decide expose the endpoint in the driver right away, considering the refactoring as follow-up work.
Acceptance criteria
- Refactor simulation into separate crate
- Expose simulation endpoint in the driver
- Simulate created solutions in the solver
- The solver needs to be aware of driver’s endpoint. Currently, solver is only responding to incoming driver’s requests and responds with solutions