Skip to content

feat(stellar): wraith-names bulk registration / renewal (#118) - #134

Open
lockoabosede8-byte wants to merge 3 commits into
wraith-protocol:developfrom
lockoabosede8-byte:feat/118-wraith-names-bulk-registration-renewal
Open

feat(stellar): wraith-names bulk registration / renewal (#118)#134
lockoabosede8-byte wants to merge 3 commits into
wraith-protocol:developfrom
lockoabosede8-byte:feat/118-wraith-names-bulk-registration-renewal

Conversation

@lockoabosede8-byte

@lockoabosede8-byte lockoabosede8-byte commented Jul 24, 2026

Copy link
Copy Markdown

Summary

Adds bulk_register and bulk_renew to 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-name register events (unchanged v1 topics) + one aggregate bulk_reg event 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-name extend events + one aggregate blk_renew event.

Pre-existing bugs fixed

While implementing, several compilation-breaking issues in the existing contract were fixed:

  • hash_name() now uses SHA-256 (was returning Ok(()) instead of BytesN<32>)
  • Duplicate enum variants removed — lines 85–93 were shadowing lines 67–84 with conflicting discriminant values
  • Missing constants added: MIN_LABEL_LEN, MAX_NAME_LEN, MAX_SUBDOMAIN_DEPTH, BULK_LIMIT
  • Missing require_manager() added for subdomain ownership checks (parent owner can manage subdomains)
  • Subdomain parsing in register_internal() — dot counting, parent hash computation, depth limit enforcement (rejects >1 dot)
  • Orphaned subdomain checkresolve() and name_of() now verify parent still exists for subdomains
  • Buffer overrunvalidate_name() no longer panics on names > 32 bytes

Events

Event Topics Data When
register ("register", name_hash) (name, stealth_meta_address) Per name in bulk_register (v1 compat)
bulk_reg ("bulk_reg", owner) Vec<BytesN<32>> (name hashes) Once per bulk_register
extend ("extend", name_hash) extend_to_ledger Per name in bulk_renew
blk_renew ("blk_renew",) (name_hashes, extend_to_ledger) Once per bulk_renew

Files changed

File Change
stellar/wraith-names/src/lib.rs Added bulk_register, bulk_renew, fixed bugs
stellar/wraith-names/tests/names_bulk.rs New — 12 integration tests
stellar/Cargo.lock ethnum 1.5.2 → 1.5.3 (compat fix)
stellar/wraith-names/test_snapshots/ Updated test snapshots

Test results

64 tests passing (zero warnings):

  • 22 lib tests (including 8 new bulk tests)
  • 30 audit tests (all existing)
  • 12 new integration tests in names_bulk.rs

Test coverage:

  • Happy path: both bulk_register and bulk_renew succeed with valid inputs
  • Atomicity: taken name, invalid meta length, invalid name char, missing name each cause full revert
  • Size cap: 21 names rejected with BulkLimitExceeded
  • Mismatched lengths caught
  • Invalid extend_to_ledger (past) rejected
  • Event emission: correct number of per-name + aggregate events

Closes #118

…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
@drips-wave

drips-wave Bot commented Jul 24, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@truthixify

Copy link
Copy Markdown
Contributor

Rebase against develop, conflicts appeared after related PRs landed.

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.

wraith-names bulk registration / renewal

2 participants