feat(stellar): wraith-names bulk registration / renewal (#118) - #134
Open
lockoabosede8-byte wants to merge 3 commits into
Open
Conversation
…col#118) - Add bulk_register(owner, names, meta_addresses) — atomic multi-register with size cap of 20, upfront validation, per-name register events + aggregate bulk_reg event - Add bulk_renew(names, extend_to_ledger) — atomic multi-renew with size cap, upfront existence check, per-name extend events + aggregate blk_renew event - Fix hash_name to use SHA-256 (was broken — returned Ok(())) - Fix duplicate NamesError enum variants and missing error codes - Add MIN_LABEL_LEN, MAX_NAME_LEN, MAX_SUBDOMAIN_DEPTH, BULK_LIMIT - Add require_manager function supporting subdomain ownership - Add subdomain parsing (dot counting, parent hash, depth limit) in register_internal - Add parent existence check in resolve() and name_of() so orphaned subdomains no longer resolve - Fix buffer overrun panic in validate_name for names > 32 bytes - Add 22 tests: 8 unit tests (lib) + 12 integration tests (names_bulk) covering happy paths, atomicity, size cap, invalid inputs, events
|
@lockoabosede8-byte 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
|
Rebase against develop, conflicts appeared after related PRs landed. |
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.
Summary
Adds
bulk_registerandbulk_renewto the wraith-names Stellar contract, enabling teams to register or renew multiple project names (e.g.,app.wraith,docs.wraith,pay.wraith) in a single atomic transaction — cutting per-tx fees and per-op costs.New public functions
bulk_register(owner, names, meta_addresses)— Register up to 20 names atomically. Validates all inputs upfront (name format, not taken, meta-address length). If any name fails, the entire operation reverts. Emits per-nameregisterevents (unchanged v1 topics) + one aggregatebulk_regevent with the owner and list of name hashes.bulk_renew(names, extend_to_ledger)— Extend TTL for up to 20 names atomically. Validates all names exist before writing any storage. Emits per-nameextendevents + one aggregateblk_renewevent.Pre-existing bugs fixed
While implementing, several compilation-breaking issues in the existing contract were fixed:
hash_name()now uses SHA-256 (was returningOk(())instead ofBytesN<32>)MIN_LABEL_LEN,MAX_NAME_LEN,MAX_SUBDOMAIN_DEPTH,BULK_LIMITrequire_manager()added for subdomain ownership checks (parent owner can manage subdomains)register_internal()— dot counting, parent hash computation, depth limit enforcement (rejects >1 dot)resolve()andname_of()now verify parent still exists for subdomainsvalidate_name()no longer panics on names > 32 bytesEvents
register("register", name_hash)(name, stealth_meta_address)bulk_register(v1 compat)bulk_reg("bulk_reg", owner)Vec<BytesN<32>>(name hashes)bulk_registerextend("extend", name_hash)extend_to_ledgerbulk_renewblk_renew("blk_renew",)(name_hashes, extend_to_ledger)bulk_renewFiles changed
stellar/wraith-names/src/lib.rsbulk_register,bulk_renew, fixed bugsstellar/wraith-names/tests/names_bulk.rsstellar/Cargo.lockethnum1.5.2 → 1.5.3 (compat fix)stellar/wraith-names/test_snapshots/Test results
64 tests passing (zero warnings):
names_bulk.rsTest coverage:
bulk_registerandbulk_renewsucceed with valid inputsBulkLimitExceededextend_to_ledger(past) rejectedCloses #118