Skip to content

test/docs(invoice): u64::MAX ID boundary tests + public entrypoint Rustdoc - #177

Open
softnationz wants to merge 3 commits into
WHEELBACK:mainfrom
softnationz:test/invoice-id-u64max-wrap-and-docs
Open

softnationz wants to merge 3 commits into
WHEELBACK:mainfrom
softnationz:test/invoice-id-u64max-wrap-and-docs

Conversation

@softnationz

Copy link
Copy Markdown

Summary

Two issues addressed in separate commits.

Closes #24 — u64::MAX invoice ID boundary and wrap-around test

The existing boundary tests used the old 4-arg create_invoice signature, so they would not have compiled since the 7-arg form was introduced. Fixed:

  • Added MaybeBytes to the import line in invoice_id_boundary_test.rs.
  • Updated every create_invoice / try_create_invoice call to pass &MaybeBytes::None, &MaybeBytes::None, &0.
  • test_overflow_wrapping_at_u64_max_is_not_silent: seeds InvoiceCount to u64::MAX - 1 via env.as_contract, asserts the first call returns u64::MAX, then asserts the next call errors (arithmetic overflow on count + 1) rather than silently wrapping to 0 and colliding with the missing-invoice sentinel.

Closes #25 — Rustdoc on all public entrypoints

Added /// doc comments to every pub fn in contracts/invoice/src/lib.rs that had none:
initialize, create_invoice, mark_paid, get_invoice, get_invoice_status, cancel_invoice, request_refund, pause, unpause.

Each comment documents parameters, return value, auth requirement, and the full error list, following the style of the existing release_escrow and set_grace_window comments.

- Import MaybeBytes in invoice_id_boundary_test.rs
- Fix all create_invoice / try_create_invoice calls to match the
  7-arg signature (metadata_hash, payment_link_hash, merchant_nonce)
- test_overflow_wrapping_at_u64_max_is_not_silent: seeds InvoiceCount
  to MAX-1, asserts first call lands at u64::MAX, then asserts the
  next call errors (arithmetic overflow) rather than silently wrapping
  to 0 and colliding with the missing-invoice sentinel

Closes WHEELBACK#24
Add /// doc comments to every pub fn in contracts/invoice/src/lib.rs
that lacked them: initialize, create_invoice, mark_paid, get_invoice,
get_invoice_status, cancel_invoice, request_refund, pause, unpause.
Documents parameters, return values, errors, and auth requirements.
Expands the existing create_invoice comment from 3 lines to full
per-param and error-list coverage matching the release_escrow style.

Closes WHEELBACK#25
@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@softnationz Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(invoice): add inline doc comments to all public entrypoints test(invoice): ID boundary tests — invoice ID wraps at u64::MAX

1 participant