Skip to main content

Module benchmark

Module benchmark 

Source
Expand description

The reroute benchmark: how each re-quoted route did against the one L1 landed, as win/loss counts, volume-weighted bps, and the venues both sides routed through.

Population is the adapter’s to select — landed reroutes whose original also landed, with both realized amounts present and the two mints distinct. collect adds only what needs the whole population to decide: a signature seen twice is an ambiguous pairing and drops wholesale. ExactOut legs are measured input-side (amount is output-token-denominated and outputs tie by construction, so a win is paying less major input), which leaves a non-major-input ExactOut leg unpriceable — those are skipped.

Two deliberate differences from the pre-typed-plan reader, both forced by the typing. Hop amounts arrive as strings, so a float-typed string like "1.5e3" truncates to an integer instead of voiding the plan — the JSON number/string distinction died with the DOM parse; genuinely unparseable text still voids. And an explicit "inAmount": null used to void the whole plan where an absent key merely contributed zero — an Option<String> cannot tell the two apart, so both now contribute zero.

Structs§

LoadStats
Measurement
One measured leg: how our route compared and what it was worth.
RangeReport
Accumulated metrics for one range or a cross-range aggregate.
SideTotals
VenueTotals

Constants§

OUTLIER_BPS
Legs beyond this are treated as pricing artifacts, not routing outcomes.
VENUE_DUST_USD
Venues under this USD exposure on both sides are dust, hidden from the table.

Functions§

collect
Row order is preserved so float accumulation stays deterministic across runs. A signature seen more than once is an ambiguous multi-swap transaction — pairing is by signature — so its rows drop wholesale, and a skipped ExactOut row never claims a signature it could make ambiguous.
measure
ExactIn compares delivered output (buys valued at spend); ExactOut compares major input paid for the identical output. None = unpriceable or a |bps| > OUTLIER_BPS dollar-outlier.