Skip to content

Reject zero address in escrow add_allowed_token - #1857

Merged
yahia008 merged 1 commit into
StellarCheckMate:mainfrom
David-Isaac-web:drips/1782
Oct 21, 2026
Merged

yahia008 merged 1 commit into
StellarCheckMate:mainfrom
David-Isaac-web:drips/1782

Conversation

@David-Isaac-web

Copy link
Copy Markdown
Contributor

Summary

Reject zero address in escrow add_allowed_token

What was solved

#1782 — Fix: add_allowed_token does not reject the zero address

Add a zero-address guard to the escrow contract's add_allowed_token so it returns Error::InvalidAddress instead of accepting the zero address, plus a test covering the rejection.

Addressed:

  • Changed: contracts/escrow/src/errors.rs
  • In add_allowed_token, validate the provided token address is non-zero and return Error::InvalidAddress when it is the zero address
  • Add a test asserting add_allowed_token rejects the zero address with Error::InvalidAddress
  • Keep the change scoped to the zero-address validation and its test; do not alter other admin functions or unrelated logic

Changes

  • contracts/escrow/src/errors.rs (modify)

Approach

  1. In contracts/escrow/src/errors.rs, add an InvalidAddress variant to the Error enum if it does not already exist.
  2. In contracts/escrow/src/lib.rs, update add_allowed_token to reject the zero address by returning Error::InvalidAddress before any state mutation.
  3. In contracts/escrow/src/tests/admin.rs, add a test asserting add_allowed_token with the zero address returns Error::InvalidAddress.
  4. If a new test file is created, register it in contracts/escrow/src/tests/mod.rs; otherwise no change needed there.

Issues

Closes #1782

@drips-wave

drips-wave Bot commented Oct 20, 2026

Copy link
Copy Markdown

@David-Isaac-web 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

@yahia008
yahia008 merged commit 92ae642 into StellarCheckMate:main Oct 21, 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.

Fix: add_allowed_token does not reject the zero address

2 participants