-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
Description
Description
Create a dedicated set of tests to ensure there are no integer overflows, underflows, or panics across all arithmetic-heavy paths.
Requirements and context
- Must identify all arithmetic operations in the contract (e.g., distribution math, percentage calculations) and design test cases around them.
- Must include tests for maximum and minimum representable values, and any multiplication/division combinations used in payouts.
- Should consider enabling Rust-level overflow checks or using safe math patterns.
Suggested execution
- Branch:
git checkout -b test/panic-and-overflow-safety. - Add a test module (or extend
src/test.rs) that calls functions with extreme inputs to verify they behave correctly or fail in a controlled way. - Consider using property-based testing crates where appropriate for random stress.
- Document any changes made to the code to harden against overflow.
Test and commit
- Run
cargo test. - Verify that no panics occur in expected-success scenarios and that any intentional rejections are handled as contract errors.
- Include test output and a brief list of arithmetic invariants checked.
Example commit message
test(contracts): add comprehensive panic and overflow safety tests
Guidelines
- Minimum 95 percent test coverage.
- Clear documentation of arithmetic assumptions and safety measures.
- Timeframe: 96 hours.
Reactions are currently unavailable