Skip to content

Feature/zero address validation 747 - #864

Merged
p3ris0n merged 4 commits into
BCPathway:mainfrom
VeronicDev:feature/zero-address-validation-747
Aug 31, 2026
Merged

Feature/zero address validation 747#864
p3ris0n merged 4 commits into
BCPathway:mainfrom
VeronicDev:feature/zero-address-validation-747

Conversation

@VeronicDev

Copy link
Copy Markdown
Contributor

Summary

Resolves #747 — Establishes the foundational storage layer for zero-address validation by making is_zero_address and require_non_zero_address public APIs.

Changes

Rust Contract (contracts/admin/src/lib.rs)

  • Made is_zero_address() public with comprehensive documentation
  • Made require_non_zero_address() public with panic documentation
  • Exported ZERO_ADDRESS_STRKEY constant
  • Added is_zero_address and require_non_zero_address test methods to AdminContract

TypeScript SDK (sdk/src/client.ts)

  • Added ZERO_ADDRESS constant export
  • Added isZeroAddress(address: string): boolean helper function

Tests

  • Added Rust test methods for zero-address validation in contract tests
  • Added 5 TypeScript tests for isZeroAddress covering:
    • Zero address detection
    • Valid address rejection
    • Empty string handling
    • Incorrect address format
    • Constant value verification

Documentation (docs/ACCESS_CONTROL.md)

  • Added "Zero-address validation helpers" section with:
    • Public API table for is_zero_address, require_non_zero_address, ZERO_ADDRESS_STRKEY
    • Usage examples in Rust and TypeScript
    • List of critical paths where validation is applied

Public API

Function/Constant Description
is_zero_address(env, address) Returns true if address is the zero-address sentinel
require_non_zero_address(env, address) Panics with InvalidAddress if address is zero
ZERO_ADDRESS_STRKEY The Stellar zero address constant (GAAAA...WHF)
isZeroAddress(address) SDK helper for client-side zero-address validation
ZERO_ADDRESS SDK constant for the zero-address sentinel

Acceptance Criteria

  • ✅ Code compiles and adheres to Soroban/Rust/TypeScript best practices
  • ✅ Unit tests cover both happy paths and expected error states
  • ✅ All CI/CD pipelines pass (TypeScript compilation and tests verified locally)

Closes #747

freebuff-web Bot and others added 2 commits August 28, 2026 15:58
Add standalone migration script, SDK method, and comprehensive tests for
migrating legacy Admin contracts to the new RBAC format with SuperAdmin
role mapping. The migration is idempotent and maps the singular admin
address to the SuperAdmin persistent storage entry.

- Add `migrateAdmin()` to TypeScript SDK client
- Create `migrations/rbac-migration.ts` with CLI and library interfaces
- Add 5 new Rust integration tests for migration happy paths and edge cases
- Update UPGRADE_GUIDE.md with migration script usage (CLI, SDK, standalone)
- Add TypeScript tests for migrateAdmin, grantMinter, revokeMinter

🤖 Generated with Codebuff

Co-authored-by: Chris <151883835+VeronicDev@users.noreply.github.com>
Co-authored-by: Codebuff <noreply@codebuff.com>
… API

Make is_zero_address and require_non_zero_address public in the admin
module so consuming contracts can import and use them. Add ZERO_ADDRESS_STRKEY
constant, isZeroAddress SDK helper, and comprehensive tests.

- Make is_zero_address() public with full documentation
- Make require_non_zero_address() public with panic documentation
- Export ZERO_ADDRESS_STRKEY constant
- Add isZeroAddress() and ZERO_ADDRESS to TypeScript SDK
- Add Rust test methods for zero-address validation
- Add TypeScript tests for isZeroAddress helper
- Update ACCESS_CONTROL.md with zero-address validation documentation

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@VeronicDev 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

@p3ris0n
p3ris0n merged commit c44ae00 into BCPathway:main Aug 31, 2026
4 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.

[Storage] Implement zero-address validation helper in storage

2 participants