-
Notifications
You must be signed in to change notification settings - Fork 48
Description
Problem
Solvers can theoretically submit solutions outside of the competition (simply calling settle with a bunch of signed orders). The way this is prevented is by requiring large bonds being put up by solvers in order to get allow listed. Those bonds pose a barrier to entry for the protocol. In the current state, they cannot be easily reduced without adding additional risk to the system.
The potential damage can be broadly differentiated into two parts
- Economic damage to the protocol (withdrawal of token balances stored in the settlement contract, e.g. by incurring high slippage, setting a bad allowance, or simply transferring out funds)
- Economic damage to the user (settling orders out of competition at limit price, omission of pre/post interactions, etc).
While 1. is fairly contained and can be mitigated by frequently withdrawing internal buffers, 2. poses a much bigger risk to the protocol and is the main reason high bonds are required.
Suggested solution
Have the off-chain auction provide a signature attesting that a specific solver has indeed won the settlement they are trying to settle. The signature would attest to the following things:
- Which solver has won the competition
- Which order uids are expected to be executed and at what clearing prices (exact match, ie the solver is not allowed to add more orders)
- Any pre/post interactions those orders are expected to yield (the solver may add additional pre and post interactions)
We would then have an intermediary contract intercept a solver's settle call, verify that their solution is indeed in line with the attestation committed to by the auctioneer and in this case forward the settle call to the main settlement contract. The intermediary contract would be associated with a full bond and allow-listed in the main settlement contract. Solvers would still require to post some amount of bond (cf. risk 1 above), but the bond could be significantly smaller and in a separate allow-list. in the future there could be many such intermediary contracts (one per bonding pool).
This would allow smaller capitalised solvers participate in the auction.
Acceptance Criteria
- Smart contract built with foundry and extensive test suite
- Implements the following logic:
- Expose a method that accepts a solution and signature
- Checks msg.sender is registered
- Furthermore, computes commitment by hashing
- msg.sender
- auction id
- included order uids and executions (buy/sell amounts)
- a subset of interactions
- Ecrecovers signer from signature using the commitment and asserts it matches the configured auctioneer
- Forwards provided solution into the GPv2Settlement contract's settle call
