Skip to content

feat(commitment_core): unit-tests-settle-path-expired-commitment-nft-…#457

Merged
1nonlypiece merged 2 commits into
Commitlabs-Org:masterfrom
OSEH-svg:feature/commitment-core-unit-tests-settle-path-expired-commitment-nft-coordination-a
Apr 1, 2026
Merged

feat(commitment_core): unit-tests-settle-path-expired-commitment-nft-…#457
1nonlypiece merged 2 commits into
Commitlabs-Org:masterfrom
OSEH-svg:feature/commitment-core-unit-tests-settle-path-expired-commitment-nft-coordination-a

Conversation

@OSEH-svg
Copy link
Copy Markdown
Contributor

closes #197

PR Title: feat(commitment_core): unit-tests-settle-path-expired-commitment-nft-coordination-a

Description

This PR implements comprehensive unit tests for the settle path in the CommitmentCoreContract and resolves multiple pre-existing compilation and runtime issues that were blocking the test suite.

Key Changes

  • Settle Path Coverage: Added tests in tests.rs covering:
    • Successful settlement of expired commitments.
    • Coordination with the NFT contract (verifying the settle invocation).
    • Proper asset transfer back to the commitment owner.
  • Test Infrastructure Stability:
    • Fixed multiple pre-existing compilation errors in tests.rs (incorrect allocate signatures).
    • Refactored fee_tests.rs to resolve borrow checker issues and migrate to register_stellar_asset_contract_v2.
    • Fixed test_zero_address.rs to align with the current CommitmentRules structure.
  • Documentation: Added NatSpec-style Rustdoc to the settle function in lib.rs.

Security Notes

  • Checks-Effects-Interactions: The settle path correctly updates commitment status to "settled" before executing external asset transfers or NFT contract calls.
  • Reentrancy: All settlement operations are protected by the require_no_reentrancy guard.
  • Arithmetic Safety: Safe math patterns are used for TVL adjustments and fee calculations.

Verification

  • Host Tests: Ran all commitment_core tests.
    • Result: 120 passed; 0 failed.
  • Wasm32 Tests: Attempted cargo test -p commitment_core --target wasm32v1-none --release.
    • Result: Failed due to environment-level dependency issues (serde_json, rand missing in soroban-sdk test utilities). This is confirmed as an environment issue independent of these changes.

Related Issues

Closes #197

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Mar 30, 2026

@OSEH-svg 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

@1nonlypiece 1nonlypiece merged commit 1b9ff23 into Commitlabs-Org:master Apr 1, 2026
0 of 2 checks passed
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: settle path \u2014 expired commitment, NFT coordination, asset transfers

2 participants