feat(solana-indexer): PR 7.3 decode settlements via the shared interface parser - #4666
feat(solana-indexer): PR 7.3 decode settlements via the shared interface parser#4666squadgazzz wants to merge 2 commits into
Conversation
| package = "settlement-interface", | ||
| git = "https://github.com/cowprotocol/solana-programs", | ||
| rev = "4e0bd7eaed7c237a327705425be2a4a50a8b4a3a" | ||
| branch = "make-parsing-generic-on-accounts" |
There was a problem hiding this comment.
This will be updated once cowprotocol/solana-programs#80 is merged.
|
Claude finished @squadgazzz's task in 3m 15s —— View job PR Review: decode settlements via the shared interface parser
This is a clean simplification — dropping the hand-rolled One substantive point, left as an inline comment:
Nits I did not flag (already acknowledged / fine): the I couldn't compile locally (the |
| let trades = begin_input | ||
| .orders | ||
| .iter() | ||
| .zip(received) |
There was a problem hiding this comment.
zip silently truncates to the shorter of orders / received. This function otherwise warns-and-skips on every layout mismatch (BeginSettle/FinalizeSettle parse failures) and treats the gRPC stream as untrusted (saturating adds), but here a pushes.len() != orders.len() mismatch — i.e. a violation of the "exactly one push per order" invariant this pairing relies on — produces a partial/misaligned trade set with no signal.
Consider guarding it explicitly so a broken invariant surfaces rather than silently corrupting the settlement:
if finalize_input.pushes.len() != begin_input.orders.len() {
tracing::warn!(
instruction_index = begin.instruction_index,
orders = begin_input.orders.len(),
pushes = finalize_input.pushes.len(),
"BeginSettle/FinalizeSettle order/push count mismatch, skipping"
);
continue;
}This is also the one place the correctness of amount_received_delta hinges entirely on pushes being 1:1 and in the same PDA order as orders — worth an explicit check now that the resolver is stubbed and the misalignment wouldn't show up in the emitted events yet.
Description
The settlement decoder hand-rolled the
BeginSettleandFinalizeSettlewire layout and stubbed the auction id and the buy-side amounts. It had to: the sharedsettlement-interfaceparser needed an on-chainAccountView, which the indexer cannot get off-chain. cowprotocol/solana-programs#80 makes that parser generic over the account type, so the indexer now decodes with its ownPubkeytype and drops the duplicated layout and the placeholders.Changes
CreateOrder,CreateBuffer,BeginSettle, andFinalizeSettlethrough the interface parser.BeginSettle(was a placeholder).FinalizeSettlepushes (was a placeholder).iis paid by pushi, per the on-chain invariant.parse_begin_settle_ordersand the account-position constants.How to test
Updated unit tests.