Skip to content

Add fractional-share supply-cap rounding boundary tests to prevent one-wei over-issuance #609

Description

@greatest0fallt1me

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
    • cargo test --all
  • 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

Metadata

Metadata

Assignees

Labels

Stellar WaveStellar Wave issue batch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions