Skip to content

Validate registry_credit_id Length/Charset to Prevent Malformed Leaf Construction #314

@Oluwaseyi89

Description

@Oluwaseyi89

Summary

Update the merkle_bridge contract to validate the registry_credit_id field for both length and allowed character set before using it in Merkle leaf construction, preventing malformed or ambiguous leaves and ensuring compatibility with relayer and off-chain verification tools.

Social Media Link

Let's collaborate on Discord. And ensure to star our repo.

Technical Context

  • Motivation: Unvalidated or malformed registry_credit_id values can result in ambiguous, non-unique, or invalid Merkle leaves, breaking proof verification and interoperability. Enforcing strict validation ensures robust, predictable Merkle tree construction.
  • Current State: The contract does not enforce any length or character set restrictions on registry_credit_id.

Requirements

Contract Changes

  • Define and document the allowed length range (min/max) and permitted character set for registry_credit_id.
  • During all relevant entry points (e.g., mint, bridge, proof), validate that the provided registry_credit_id meets these constraints.
  • Reject any operation with an invalid registry_credit_id, returning a clear error message.

Acceptance Criteria

  • Only valid registry_credit_id values are accepted for Merkle leaf construction.
  • Invalid values are rejected with clear errors.
  • Unit tests cover:
    • Attempted use of invalid (too short/long or bad charset) IDs (should fail)
    • Use of valid IDs (should succeed)

Definition of Done

  • PR with contract code changes and tests
  • Documentation updated to describe the validation rules
  • Team review completed

Working Directory:

stellar-core/verifiable-registry/contracts/merkle_bridge


Metadata

Metadata

Assignees

Labels

RustThis issue is to be implemented with Rust programming language.SorobanThis issue is to be implemented with Soroban SDKStellar WaveIssues in the Stellar wave program

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions