feat(stellar): wraith-names bulk registration / renewal (#118) - #134
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! 🚀 |
|
Rebase against develop, conflicts appeared after related PRs landed. |
|
Quick sanity check on this PR: it deletes ~200 test snapshot files (net -62k lines) alongside the wraith-names bulk-registration code. If that snapshot deletion is intentional (the register-on-behalf snapshots got regenerated wrong and you're clearing them), leave a note saying so. If it's accidental (rebase artifact, etc.), please restore them before I look at the code. |
…issing NamesError variants, hash_name regression, parent-storage lookup bug, and stale test_name_too_deep expectation
|
No CI signal on this branch. It predates recent workflow fixes on develop (pnpm 10 corepack pin, ci.yml trigger updates, etc). Rebase against latest |
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