Description
accept_issuer_transfer rejects with IssuerTransferExpired when now > timestamp + ISSUER_TRANSFER_EXPIRY_SECS, which is an exclusive comparison. The exact-boundary case (now == timestamp + expiry, which should still be accepted) and the saturating-add overflow case are untested. Add ledger-timestamp-controlled tests for these.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/lib.rs (accept_issuer_transfer, propose_issuer_transfer, PendingTransfer)
- Use
env.ledger().set_timestamp to drive the boundary
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/issuer-transfer-expiry-tests
- Implement changes
- Propose, advance to exact expiry, assert accept succeeds
- Advance one second past expiry, assert
IssuerTransferExpired
- Test
timestamp.saturating_add near u64::MAX
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Exact boundary, one-past, overflow saturation, self-transfer (new==old)
- Include test output and security notes
Example commit message
test: cover issuer transfer expiry boundary and overflow
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
accept_issuer_transferrejects withIssuerTransferExpiredwhennow > timestamp + ISSUER_TRANSFER_EXPIRY_SECS, which is an exclusive comparison. The exact-boundary case (now == timestamp + expiry, which should still be accepted) and the saturating-add overflow case are untested. Add ledger-timestamp-controlled tests for these.Requirements and context
src/lib.rs(accept_issuer_transfer,propose_issuer_transfer,PendingTransfer)env.ledger().set_timestampto drive the boundarySuggested execution
git checkout -b feat/issuer-transfer-expiry-testsIssuerTransferExpiredtimestamp.saturating_addnearu64::MAXTest and commit
cargo testExample commit message
test: cover issuer transfer expiry boundary and overflowGuidelines