Description
Enforce checked arithmetic in matching/statistics/snapshot core paths and remove saturating_* from financial logic.
Depends on
Problem
Current use of saturating_* and unchecked arithmetic can silently hide overflow/underflow in financial calculations.
Scope
- Replace saturating/raw arithmetic with checked variants.
- Define explicit error behavior for arithmetic failures.
- Add tests for overflow/underflow paths.
Tasks
Technical Details
Representative current patterns to eliminate:
saturating_sub, saturating_add, saturating_mul in production paths.
- implicit multiplication/addition on financial values without checked handling.
Breaking Changes
- Some operations that previously clamped may now return errors.
- Public method signatures may become fallible (
Result) where necessary.
Acceptance Criteria
Out of Scope
Description
Enforce checked arithmetic in matching/statistics/snapshot core paths and remove
saturating_*from financial logic.Depends on
Problem
Current use of
saturating_*and unchecked arithmetic can silently hide overflow/underflow in financial calculations.Scope
Tasks
src/execution/match_result.rssrc/price_level/statistics.rssrc/price_level/snapshot.rssrc/price_level/level.rsTechnical Details
Representative current patterns to eliminate:
saturating_sub,saturating_add,saturating_mulin production paths.Breaking Changes
Result) where necessary.Acceptance Criteria
saturating_*in production financial core logic.Out of Scope