fix(cow): keep a commitment the orderbook can still be asked about - #695
fix(cow): keep a commitment the orderbook can still be asked about#695mfw78 wants to merge 1 commit into
Conversation
Bumps the videre pin to 9ab1515 and supplies the CoW fault policy the seam there exists for. A receipt this keeper cannot correlate used to remove the commitment. The fork run reached `Post`, submitted, got a receipt that did not match the order, and destroyed a commitment whose order may well have been accepted. Only a re-registration brought it back. The orderbook keys an order by its uid and dedupes on that uid, so re-sending one it already holds comes back as already held rather than executed twice. That idempotency is what makes the retry safe, and it is a fact about this venue rather than about venues, which is why it is asserted here and not in the platform default. Denials now route through the shipped table for the reconcile pass as well as the submit path. They did not before: reconcile took the platform default, which knows nothing of `classification.toml`, so a stranded reservation for a clearable refusal was released while the same refusal on the submit path backed off. Closes #693. AI Assistance: Claude Code used for the policy and the tests.
|
Rolled into #691, which is where the receipt-mismatch bug was found and where the harness that found it lives. The commit rides there unchanged. It changed shape on the way, and the change matters. It classified It now ends the submission and keeps the commitment: the reservation is released, and the commitment takes a one-block grace because its next poll mints a later part with a different uid. |
Closes #693. Consumes the seam from nullislabs/videre-nexum-module#88; bumps the videre pin from
fd8af02to9ab1515across all eight declarations.The bug
A receipt this keeper could not correlate removed the commitment. The fork run in #691 reached
Post, submitted, got a receipt that did not match the order it sent, and the commitment was destroyed:The order was valid, the generator posted it, the conditional order was intact on chain. Only a re-registration brought the commitment back.
Why the fix belongs here and not upstream
The first attempt changed videre's default so receipt faults backed off everywhere, justified like this:
That is CoW behaviour. Videre is the venue platform and a venue is not necessarily an orderbook: repeating a submission at one that buys a label or books a slot repeats the act. videre#88 therefore keeps its conservative default and adds
FaultPolicyas the seam; this PR supplies the CoW one, where the claim is actually true.The orderbook keys an order by its uid and dedupes on that uid, so re-sending one it already holds comes back as already held rather than executed twice. That idempotency is what makes the retry safe.
What
CowFaultsdoesReceiptMismatch,InvalidReceiptDenied(_)classification.tomlalready classifies these by errorTypeInvalidBodyandUnsupportedkeep the default drop deliberately: both are re-derived from the commitment on every poll, so the next submission is byte-identical and refused the same way.UnknownVenuekeeps it too, since the composition root registers the cow venue at boot and a missing one fails there.A second bug this closes
Denials now route through the table for the reconcile pass as well as the submit path.
They did not before.
run.rsclassifiedDeniedwithclassify_deniedon the submit path, butreconcileused the platform default internally, which knows nothing ofclassification.toml. So a stranded reservation for a clearable refusal likeInsufficientBalancewas released, while the same refusal arriving on the submit path backed off. One policy now feeds both, which is whatis_terminalderiving fromactionin videre#88 is for.Verification
237 tests pass, up from 232 on
main.cargo fmt --check,cargo clippy --workspace --all-targets --all-features -- -D warnings,RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps,just build-modulesand the doctests all exit 0.Three mutations are each caught: receipt faults dropping again, denials bypassing the table, and the reconcile call site falling back to the platform default.
That last one initially was not caught. Swapping
&CowFaultsfor&DefaultFaultPolicyat the reconcile call site left all 236 tests green, which is the same gap I raised reviewing videre#88 and had to fix here too.reconcile_keeps_a_reservation_the_cow_policy_can_retrydrives a stranded reservation throughrunwith a receipt fault and asserts the marker survives.Note for #691
#691 also touches
crates/composable-cow/src/run.rsand is based onmain, so whichever lands second needs a rebase. The regions differ, so no conflict is expected.AI Assistance: Claude Code used for the policy and the tests.