Skip to content

resolver: report a subname's holder as its owner - #2091

Merged
epoberezkin merged 8 commits into
simplex-chat:masterfrom
brenzi-agent:ab/resolver-subname-holder
Nov 22, 2026
Merged

epoberezkin merged 8 commits into
simplex-chat:masterfrom
brenzi-agent:ab/resolver-subname-holder

Conversation

@brenzi-agent

@brenzi-agent brenzi-agent commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

A subname that the subname registrar created is owned in the registry by that contract; its holder is the holder of the 2LD above it, which the subname registrar's ownerOf returns. The resolver reported the registry owner as the record's owner, so a client received the subname registrar's address. smp7, asked for lap.brenzi.simplex with RSLV, answered nrOwner = "0x86d2248fb5f3b14a1ca3904978314ad5450d4dc9", the .simplex subname registrar. On mainnet, that contract's ownerOf(namehash("lap.brenzi.simplex")) returns 0xb519d8465d112a8a6c0da095f8c2efeb4b1c54f8, the registry owner of brenzi.simplex. smp7 answered mobile.foobar.testing and lap.brenzi.testing with the .testing subname registrar as owner in the same way.

scripts/resolver/service/snrc-resolve.py: subname_holder becomes record_owner, which returns the record's owner for every name, on /v2/resolve and /resolve:

  • a second-level name: its registry owner, read at node_of(name) as before, so a hashed query reaches the same node;
  • a subname owned in the registry by the 2LD's holder: that holder;
  • a subname owned by the subname registrar that the registrar's subnameHook() names: the address its ownerOf returns, unless that is zero;
  • any other subname, created or not, and one whose ownerOf is zero or reverts: None, which both routes answer as not registered, as before.

Both routes test None in place of the depth test and read the holder once per lookup, as master does. On /v2/resolve, registration reads the owner before the record and reads the record only for a held name, so the record of a subname nobody holds is no longer read: a subname the subname registrar owns but no longer holds is answered as not registered in 4 round trips, where master took 5. The labelNotRecorded check moved into the held branch with its comment unchanged.

scripts/resolver/README.md: for a held subname, owner is the 2LD's holder, on both routes.

scripts/resolver/service/test_snrc_resolve.py:

  • for a subname the subname registrar holds, /v2/resolve and /resolve give the holder as owner; on master both give the registry owner, the subname registrar;
  • for a subname the 2LD's holder owns, on both routes, and for a second-level name by text, by labelhash and on /resolve, owner is the registry owner;
  • a subname whose ownerOf reverts, and one under a TLD without a registrar, is answered as not registered;
  • against the fake node, a subname the subname registrar holds is answered in 3 round trips on both routes, and one it no longer holds is answered as not registered in 4, its record unread.

CI: on this head, resolver (python) passes 165 tests and ruff (https://github.com/simplex-chat/simplexmq/actions/runs/44943998691). The same tests on master 3f57fcd fail 4: both owner assertions of a held subname, the 3-round test on its owner, and the no-longer-held test with 5 rounds for 4 (https://github.com/brenzi-agent/simplexmq/actions/runs/44941154729, branch ci/ab/subname-holder-tests-on-master).

#2016 asserts addrs["SubnameRegistrar"] as the owner of menu.bakery.simplex in test_a_held_subname_is_registered (test_ground_truth.py); after this change the owner is LOCAL_OWNER, the account that holds bakery in its seed.

A running resolver serves the change after its image is rebuilt: docker compose up -d --build resolver.

@epoberezkin
epoberezkin merged commit b388429 into simplex-chat:master Nov 22, 2026
12 of 14 checks passed
@brenzi-agent
brenzi-agent deleted the ab/resolver-subname-holder branch November 23, 2026 07:24
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