π Description
update_user_volume in fees.rs accumulates a user's transaction volume into UserVolumeData and drives their VolumeTier, which feeds get_tier_discount. The tier must be monotonic in accumulated volume β adding volume can only keep or raise the tier, never lower it within a period. This is not yet asserted as a property.
Why this matters: a non-monotonic tier would mean a user's fee discount could randomly drop after they transact more β a correctness and fairness bug. A property test over arbitrary volume sequences proves monotonicity holds.
π― Requirements & Context
Context & constraints
- proptest
1.4; bound increments to avoid overflow-checks panics on accumulation.
π οΈ Suggested Execution
git checkout -b test/volume-tier-monotonic
cargo test -p quicklendx-contracts --features fuzz-tests test_volume_tier_monotonic -- --nocapture
cargo clippy -p quicklendx-contracts --all-targets -- -D warnings
- Edge cases: increments of zero (no tier change); crossing exactly one threshold; saturating to the top tier.
Example commit message
test(fees): prove update_user_volume tier transitions are monotonic
Property test over arbitrary increment sequences asserting tier and discount
never regress.
β
Acceptance Criteria & Guidelines
| Requirement |
Target |
| Tier + discount monotonicity asserted |
Required |
| Boundary correctness covered |
Required |
| Coverage of tier logic |
β₯ 95% |
cargo clippy clean |
Required |
| Timeframe |
96 hours from assignment |
π¬ Community & Support
Join Discord: https://discord.gg/VpngvTjWa β comment to claim. π
π Description
update_user_volumeinfees.rsaccumulates a user's transaction volume intoUserVolumeDataand drives theirVolumeTier, which feedsget_tier_discount. The tier must be monotonic in accumulated volume β adding volume can only keep or raise the tier, never lower it within a period. This is not yet asserted as a property.π― Requirements & Context
quicklendx-contracts/src/test_volume_tier_monotonic.rsunderfuzz-tests.VolumeTier.get_tier_discountis non-decreasing as tier rises.Context & constraints
1.4; bound increments to avoidoverflow-checkspanics on accumulation.π οΈ Suggested Execution
git checkout -b test/volume-tier-monotonic cargo test -p quicklendx-contracts --features fuzz-tests test_volume_tier_monotonic -- --nocapture cargo clippy -p quicklendx-contracts --all-targets -- -D warningsExample commit message
β Acceptance Criteria & Guidelines
cargo clippyclean㪠Community & Support
Join Discord: https://discord.gg/VpngvTjWa β comment to claim. π