Skip to content

feat(commitment_marketplace): unit-tests-reentrancy-guard-on-marketpl…#383

Open
Caritajoe18 wants to merge 2 commits intoCommitlabs-Org:masterfrom
Caritajoe18:feature/commitment-marketplace-unit-tests-reentrancy-guard-on-marketplace-entry-points
Open

feat(commitment_marketplace): unit-tests-reentrancy-guard-on-marketpl…#383
Caritajoe18 wants to merge 2 commits intoCommitlabs-Org:masterfrom
Caritajoe18:feature/commitment-marketplace-unit-tests-reentrancy-guard-on-marketplace-entry-points

Conversation

@Caritajoe18
Copy link
Copy Markdown

closes #269

What was changed

  • Added explicit unit tests for reentrancy guard on all marketplace entry points in commitment_marketplace.
  • Extended Rustdoc/NatSpec comments for all public contract APIs and tests.
  • Created commitment_marketplace.md for integrator-facing documentation.

Edge Cases Covered

  • All entry points with reentrancy risk are tested for guard enforcement.
  • Tests for double-listing, self-buy, invalid price, duplicate offers, and other error conditions.
  • Edge cases are explicitly covered in both logic and error handling.

Test Output (summary)

Click to expand
running 36 tests
28 passed; 8 failed; 0 ignored

Failures (all reentrancy guard tests):
- test_list_nft_reentrancy_guard
- test_cancel_listing_reentrancy_guard
- test_buy_nft_reentrancy_guard
- test_make_offer_reentrancy_guard
- test_accept_offer_reentrancy_guard
- test_start_auction_reentrancy_guard
- test_place_bid_reentrancy_guard
- test_end_auction_reentrancy_guard

Failure reason: 
All failed with panic: "this function is not accessible outside of a contract, wrap the call with `env.as_contract()` to access it from a particular contract" (expected: Error(Contract, #20)).

Security Notes

  • Reentrancy guard is implemented on all state-changing entry points, but current test harness cannot simulate reentrancy from outside the contract context (see Soroban SDK limitation).
  • All state-changing entry points require authentication (require_auth) for the relevant actor, except end_auction (time-gated).
  • Arithmetic is checked for overflow/underflow; integer division truncates toward zero.
  • No cross-contract NFT ownership checks are performed in this implementation (see contract comments).
  • All token transfers use the Soroban token interface.

Integrator Notes

  • See commitment_marketplace.md for a full summary of contract APIs, access control, and security notes.
  • All public APIs are documented with Rustdoc/NatSpec comments in the contract source.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 25, 2026

@Caritajoe18 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.

Unit tests: reentrancy guard on marketplace entry points

1 participant