Description
Rounding during fractional-share issuance must never push the total one wei over the supply cap. Add boundary tests exercising every rounding mode at the near-cap edge.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/normalize_share_tests.rs, src/test_compute_share_invariants.rs
- Tests must cover RoundHalfUp, RoundHalfDown, RoundDown, RoundUp
Suggested execution
- Fork the repo and create a branch
git checkout -b test/supply-cap-rounding-boundary
- Implement changes
- Fixture total_issued at cap - 1
- Issue amounts producing fractional shares
- Assert final total never exceeds cap
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Rounding mode causing an off-by-one push over cap
- Include test output and security notes
Example commit message
test: bound fractional supply-cap rounding
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
Rounding during fractional-share issuance must never push the total one wei over the supply cap. Add boundary tests exercising every rounding mode at the near-cap edge.
Requirements and context
src/normalize_share_tests.rs,src/test_compute_share_invariants.rsSuggested execution
git checkout -b test/supply-cap-rounding-boundaryTest and commit
cargo test --allExample commit message
test: bound fractional supply-cap roundingGuidelines