Skip to content

test: add zero address validation tests for transfer and owner (#140)#194

Merged
1nonlypiece merged 7 commits intoCommitlabs-Org:masterfrom
edehvictor:test/issue-140-zero-address
Feb 26, 2026
Merged

test: add zero address validation tests for transfer and owner (#140)#194
1nonlypiece merged 7 commits intoCommitlabs-Org:masterfrom
edehvictor:test/issue-140-zero-address

Conversation

@edehvictor
Copy link
Contributor

Description

Resolves #140

This PR introduces comprehensive test coverage to ensure that zero/invalid addresses are properly rejected across the core and NFT contracts. Since Soroban does not have a native "zero address," these tests utilize a 32-byte array of zeroes to mock an invalid address execution environment.

Changes Made

  • Commitment NFT (contracts/commitment_nft): - Added test_zero_address.rs.
    • Added test_nft_mint_to_zero_address_fails to verify mint panics on a zero address.
    • Added test_nft_transfer_to_zero_address_fails to verify transfer panics when to is a zero address.
  • Commitment Core (contracts/commitment_core): - Added test_zero_address.rs.
    • Added test_create_commitment_zero_owner_fails to verify create_commitment panics when owner is a zero address.
  • Registered the new test modules in their respective lib.rs files.

Testing Instructions

To verify these tests pass locally, run the following commands from the root directory:

cargo test --package commitment_nft
cargo test --package commitment_core

@1nonlypiece 1nonlypiece self-requested a review February 26, 2026 18:55
@1nonlypiece 1nonlypiece merged commit fd90a1d into Commitlabs-Org:master Feb 26, 2026
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.

Add tests for zero/invalid address in transfer and owner

2 participants