Skip to content

feat(stellar): integrate on-chain metadata resolver for wraith-names#136

Open
OTimileyin wants to merge 2 commits into
wraith-protocol:mainfrom
OTimileyin:feature/wraith-names-onchain-metadata-resolver
Open

feat(stellar): integrate on-chain metadata resolver for wraith-names#136
OTimileyin wants to merge 2 commits into
wraith-protocol:mainfrom
OTimileyin:feature/wraith-names-onchain-metadata-resolver

Conversation

@OTimileyin

@OTimileyin OTimileyin commented Jul 24, 2026

Copy link
Copy Markdown

Closes #119

Summary

Add optional on-chain metadata resolver for wraith-names, allowing name
owners to attach text records and content hashes to their .wraith names,
similar to ENS text records. The feature is opt-in, owner-gated, and avoids
the resolution hot path.

Changes

New: src/metadata.rs

  • MetadataEntry struct with text_records: Map<String, String> and
    content_hash: BytesN<32>
  • MetadataError enum with 5 dedicated error codes (101–105):
    MetadataKeyTooLong, MetadataValueTooLong, MetadataRecordTooLong,
    MetadataTotalTooLong, MetadataNotFound
  • Validation functions with per-record (key ≤ 64B, value ≤ 256B) and total
    (≤ 1024B) size limits
  • Unit tests for validation logic

Modified: src/lib.rs

  • DataKey::Metadata(BytesN<32>) storage key variant for per-name metadata
  • 5 new NamesError variants (50–54) for metadata error propagation
  • set_metadata(env, owner, name, metadata) — owner-gated setter with full
    validation
  • get_metadata(env, name) — public reader, returns NameNotFound or
    MetadataNotFound
  • Metadata cleanup on release() — metadata is removed when a name is
    released
  • MetadataUpdated event emission on metadata changes

Hot path untouched

  • resolve() and name_of() remain completely unchanged — no metadata
    lookups added to the resolution path

Tests

  • test_set_and_get_metadata — happy path with avatar + twitter records
  • test_set_metadata_not_owner — non-owner rejected with NotOwner
  • test_set_metadata_key_too_long — 65B key → MetadataKeyTooLong
  • test_set_metadata_value_too_long — 257B value → MetadataValueTooLong
  • test_set_metadata_total_too_long — 5 records × 210B → MetadataTotalTooLong
  • test_get_metadata_not_found — name exists, no metadata → MetadataNotFound
  • test_get_metadata_unregistered_name — name doesn't exist → NameNotFound
  • test_metadata_cleaned_on_release — metadata removed when name is released
  • test_hot_path_unchanged_after_metadataresolve() and name_of() work
    identically before/after metadata
  • 3 existing metadata.rs module tests for isolated validation

All 23 tests pass across the workspace (wraith-names: 17, stealth-announcer: 2,
stealth-registry: 4), cargo fmt --all --check clean, zero warnings.

@drips-wave

drips-wave Bot commented Jul 24, 2026

Copy link
Copy Markdown

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

@truthixify

Copy link
Copy Markdown
Contributor

Retarget the base branch from main to develop (wave PRs merge into develop). While you're at it, rebase so the current CI workflow runs on the branch.

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.

2 participants