fn compare_balances_values<T: LazyBalanceMarker, M: ManualBalanceModel<T>>(
lazy: T::Asset,
manual: T::Asset,
seq: &[BalanceOp<T, M>],
allowed_bps: u32,
allowed_diff: u32,
) -> Result<(), BalanceExit<T, M>>Expand description
Compares lazy and manual withdrawal results and evaluates drift.
Computes the absolute difference (diff) between lazy and manual
values and checks it against allowed tolerance thresholds:
- Ignores negligible differences (diff <= 1) (rounding differences)
- Computes basis points (bps) relative to the larger value
- Accepts results within
allowed_bpsorallowed_diffthresholds
If the deviation exceeds both thresholds, returns a BalanceExit
containing:
- lazy and manual values
- absolute difference
- basis points difference
- execution trace (sequence)
This is used to validate that the lazy model maintains acceptable precision relative to the manual reference model.