Files
precompile/dex
zeekay c928fc49eb fix(dex): exact-integer settlement price floor — kill float64 >2^53 truncation on the 0x9999 money path
enforceProceedsPriceFloor reconstructed the realized fill price in float64
(float64(spent), float64(out)) before comparing against the taker's recorded
MEV floor. spent/out are uint256-domain token amounts that routinely exceed
2^53, so the conversion silently dropped their low bits: a fill strictly BELOW
the taker's floor compared EQUAL and was ACCEPTED — the exact sandwich the
floor exists to refuse. (Proven: float64(2^53+1)==float64(2^53), old SELL floor
returns no-reject where exact integer math rejects.)

Replace with exact arithmetic: the recorded limit is taken as its lossless
rational value (big.Rat.SetFloat64) and cross-multiplied with the amounts as
big.Ints. Every term is an exact integer, so the verdict is byte-identical on
every validator (no float on the money path) and never truncates a uint256.

Regression: TestPriceFloor_Exact_Above2Pow53 (the flip case, both sides),
TestPriceFloor_MatchesExactReferenceSweep (cross-check vs independent big.Rat
reference across the 2^53 boundary), TestPriceFloor_EdgeCasesPreserved.
2026-06-27 21:23:06 -07:00
..