Test the per-call request floor and ceiling enforcement
Description
record_usage in contracts/escrow/src/lib.rs rejects calls above MaxRequestsPerCall (#8) and below MinRequestsPerCall (#9), but contracts/escrow/src/test.rs has no tests for either bound or for the set_*/get_* accessors. This issue adds boundary tests so these guards are protected against regressions.
Requirements and context
- Repository scope:
Agentpay-Org/Agentpay-contracts only.
- Cover: default (no cap =
u32::MAX, no floor = 0) allows any positive value; set max then a call above it panics #8; set min then a call below it panics #9; exactly-at-bound calls succeed.
- Assert
get_max_requests_per_call defaults to u32::MAX and get_min_requests_per_call defaults to 0.
- Use the existing
should_panic error-code conventions.
- Test-only change unless a genuine bug surfaces.
Suggested execution
- Fork the repo and create a branch
git checkout -b test/contracts-17-per-call-bounds-tests
- Implement changes
- Write code in:
contracts/escrow/src/lib.rs — no changes expected.
- Write comprehensive tests in:
contracts/escrow/src/test.rs — the bound scenarios above.
- Add documentation: note covered behaviour in the test module header.
- Include NatSpec-style doc comments (
///) on any test helpers.
- Validate security: bounds cannot be circumvented.
- Test and commit
Test and commit
- Run
cargo fmt --all -- --check, cargo build, and cargo test.
- Cover edge cases: min > max misconfiguration behaviour, exactly-min, exactly-max.
- Include the full
cargo test output and a short security notes section in the PR description.
Example commit message
test: cover min/max per-call request bounds in record_usage
Guidelines
- Minimum 95 percent test coverage for impacted modules.
- Clear, reviewer-focused documentation.
- Timeframe: 96 hours.
Community & contribution rewards
- 💬 Join the AgentPay community on Discord for questions, reviews, and faster merges: https://discord.gg/eXvRKkgcv
- ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Test the per-call request floor and ceiling enforcement
Description
record_usageincontracts/escrow/src/lib.rsrejects calls aboveMaxRequestsPerCall (#8)and belowMinRequestsPerCall (#9), butcontracts/escrow/src/test.rshas no tests for either bound or for theset_*/get_*accessors. This issue adds boundary tests so these guards are protected against regressions.Requirements and context
Agentpay-Org/Agentpay-contractsonly.u32::MAX, no floor = 0) allows any positive value; set max then a call above it panics#8; set min then a call below it panics#9; exactly-at-bound calls succeed.get_max_requests_per_calldefaults tou32::MAXandget_min_requests_per_calldefaults to0.should_panicerror-code conventions.Suggested execution
git checkout -b test/contracts-17-per-call-bounds-testscontracts/escrow/src/lib.rs— no changes expected.contracts/escrow/src/test.rs— the bound scenarios above.///) on any test helpers.Test and commit
cargo fmt --all -- --check,cargo build, andcargo test.cargo testoutput and a short security notes section in the PR description.Example commit message
test: cover min/max per-call request bounds in record_usageGuidelines
Community & contribution rewards