test(dlv): pin the SoFi §5.1 fused-rounding rule with a conformance vector - #749
Merged
Merged
Conversation
…ector The spec fixes ONE floor division for the constant-product output and forbids rounding the fee-adjusted input first. Nothing pinned that: an implementation that floors `a·(D−f)/D` before the curve passes every existing test and silently collapses a sub-unit input to zero, taking the whole output with it. At `a=1, x=1, y=3, fee_bps=30` the two rules part company — fused yields 1, doubly-rounded yields 0 — and the vector asserts both sides so a future edit cannot satisfy it by agreeing with the wrong rule. It also records the boundaries where the rules AGREE (`f=0`, `f=9999`). The spec's own example claims the divergence holds for "any fee_bps in the legal range", which overstates it; writing the agreeing cases down means a later reader cannot "fix" the vector by widening it to the spec's overstatement. Test-only. No production behaviour changes.
cryptskii
force-pushed
the
test/amm-fused-rounding-conformance-vector
branch
from
August 30, 2026 01:43
1e3e929 to
298c4e5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The spec fixes ONE floor division for the constant-product output and forbids
rounding the fee-adjusted input first. Nothing pinned that. An implementation
that floors
a·(D−f)/Dbefore the curve passes every existing test, andsilently collapses a sub-unit input to zero — taking the whole output with it.
At
a=1, x=1, y=3, fee_bps=30the two rules genuinely part company: the fusedrule yields 1, the doubly-rounded one yields 0. The vector asserts BOTH sides,
so a future edit cannot satisfy it by agreeing with the wrong rule.
It also records the boundaries where the two rules AGREE (
f=0, where there isno fee to round, and
f=9999, where both yield 0). The spec's own example saysthe divergence holds for "any fee_bps in the legal range", which overstates it.
Writing the agreeing cases down means a later reader cannot "fix" the vector by
widening it to match the spec's claim.
Test-only; no production behaviour changes. Split out of #748 to keep that
branch to one topic.