Add solver authentication to the settlement - #127
Conversation
…d-functions-to-add-solver
…dding_solver_by_non_manager
Co-authored-by: Kaze <230549489+kaze-cow@users.noreply.github.com>
…d-functions-to-add-solver
There was a problem hiding this comment.
as I mentioned privately this PR turned out quite a lot more complicated than I would have expected
I think in a future PR the setup functions for the integration test suite should be revisited. IMNSHO what is currently called setup_settle_ready should be the new setup as most tests want a reasonably functional setup function as a starting point, and only specific tests that need special circumstances (ex. uninitialized, explicitly not wanting a solver registered for whatever reason) should be more elaborately named variants.
(random note from the token2022 side: we are looking at probably adding a 5th static account as a result of the token2022 token account being added to allow for both token accounts to be used at the same time. just want to put this on the radar)
…ico/sc-300-gate-settlement-on-a-solver-caller
I addressed a [comment](#127 (comment)) in a previous PR but it wasn't pushed. So I'm adding it as a new PR. Just a small change. ## How to test CI.
Gate
BeginSettleon a solver that both signs the transaction and is in the state PDA's solver list, so only approved solvers can settle.Design
Only
BeginSettleis gated.FinalizeSettlecan't run without a pairedBeginSettleearlier in the same atomic transaction (enforced by the counterpart/ordering checks). Considering that the solver signs an instruction that points to another one, it's fair to assume the solver agrees to the finalize as well.Cost: ~100/200 CU on a settlement.
Out of scope
The CLI payer for
settleneeds to be a solver now. This is poorly documented right now, but it should be easy to add a check.Tests
This is where most of the changes in this PR happen, and they are very boring. Only notable things: now all settlement test need to register a solver. Some tests have a dedicated transaction payer, some other are paid directly by the solver, based on how relevant the fee payment appeared to be.
Every time there was some metering test, I decided to have the solver be the payer to make it more realistic.
How to test
CI.