feat(stellar): integrate on-chain metadata resolver for wraith-names#136
Open
OTimileyin wants to merge 2 commits into
Open
feat(stellar): integrate on-chain metadata resolver for wraith-names#136OTimileyin wants to merge 2 commits into
OTimileyin wants to merge 2 commits into
Conversation
|
@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! 🚀 |
Contributor
|
Retarget the base branch from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #119
Summary
Add optional on-chain metadata resolver for wraith-names, allowing name
owners to attach text records and content hashes to their
.wraithnames,similar to ENS text records. The feature is opt-in, owner-gated, and avoids
the resolution hot path.
Changes
New:
src/metadata.rsMetadataEntrystruct withtext_records: Map<String, String>andcontent_hash: BytesN<32>MetadataErrorenum with 5 dedicated error codes (101–105):MetadataKeyTooLong,MetadataValueTooLong,MetadataRecordTooLong,MetadataTotalTooLong,MetadataNotFound(≤ 1024B) size limits
Modified:
src/lib.rsDataKey::Metadata(BytesN<32>)storage key variant for per-name metadataNamesErrorvariants (50–54) for metadata error propagationset_metadata(env, owner, name, metadata)— owner-gated setter with fullvalidation
get_metadata(env, name)— public reader, returnsNameNotFoundorMetadataNotFoundrelease()— metadata is removed when a name isreleased
MetadataUpdatedevent emission on metadata changesHot path untouched
resolve()andname_of()remain completely unchanged — no metadatalookups added to the resolution path
Tests
test_set_and_get_metadata— happy path with avatar + twitter recordstest_set_metadata_not_owner— non-owner rejected withNotOwnertest_set_metadata_key_too_long— 65B key →MetadataKeyTooLongtest_set_metadata_value_too_long— 257B value →MetadataValueTooLongtest_set_metadata_total_too_long— 5 records × 210B →MetadataTotalTooLongtest_get_metadata_not_found— name exists, no metadata →MetadataNotFoundtest_get_metadata_unregistered_name— name doesn't exist →NameNotFoundtest_metadata_cleaned_on_release— metadata removed when name is releasedtest_hot_path_unchanged_after_metadata—resolve()andname_of()workidentically before/after metadata
metadata.rsmodule tests for isolated validationAll 23 tests pass across the workspace (wraith-names: 17, stealth-announcer: 2,
stealth-registry: 4),
cargo fmt --all --checkclean, zero warnings.