Repository navigation
registrar, SimplexNamePolicy: claim an offered name under the terms in one transaction - #54
Draft
brenzi-agent wants to merge 8 commits into
Draft
brenzi-agent wants to merge 8 commits into
brenzi-agent wants to merge 8 commits into
Conversation
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.
A recipient claims an offered name in two transactions today:
acceptGeneralTermsForClaim/acceptCommunityTermsForClaimon the name policy, thentransferFromon the registrar. Registration takes the terms and the commitment in one (commitUnderGeneralTerms). This adds a one-transaction claim, sent by the recipient.Change (~40 contract lines; no storage change; no change to any existing function, event or error)
BaseRegistrarImplementation.claimUnderTerms(from, tokenId, offer, acceptedTermsHash), sent by the recipient: the checks ofclaimWithSig(ownerOf == from, elseNotNameOwner;getApproved == msg.sender && offer == offers[tokenId], elseNotOffered), then the new policy hookrecordClaimTerms(tokenId, from, offer, hash, msg.sender), then_transfer.SimplexNamePolicy.recordClaimTerms(registrar only, elseNotRegistrar) stores the hash inacceptedClaimTermsand nothing else._transfer's existing hook callsconsumeTransfer, which checks the hash against the current terms of the name's kind, emits the acceptance event and deletes the record, as for the two-step claim. A stale or wrong-kind hash revertsTermsNotAccepted.INamePolicygainsrecordClaimTerms;docs/upgrades.mdgains its row.NewOwner,Transfer(tests and rehearsals).Why on the registrar: a policy-only change cannot move the token (
transferFromrequires an approved caller, OpenZeppelinERC721.sol:152); an entry point on the policy would skipconsumeTransfer(the policy is a controller,BaseRegistrarImplementation.sol:605) and give an upgradeable contract the power to move any offered name to its offeree without the offeree's call.Upgrade: two proxies, the policy first (admin Safe nonce n), then the registrar (n + 1); in either order no executed step calls code not yet deployed, and the two-step claim keeps working throughout. Procedure, rollback and rehearsals:
docs/plans/one-step-claim.mdin brenzi/simplex-namespace-contract.Evidence
claimUnderTermsandrecordClaimTerms. Runtime size: registrar 21,248 → 21,731 bytes, policy 18,177 → 18,462.acceptGeneralTermsForClaim52,640 +transferFrom138,136 = 190,776;claimUnderTerms142,381 (−25%).prepareUpgradeand the decoder accepted both candidates with emptyINTENDED; claims of real names between and after the upgrades; rollback).test/simplex/TestClaimUnderTerms.test.ts, committed before the code (2b6a44b, then 6baded6). The fork runs no CI on pushes of this branch, so no CI run records the tests failing before the code. This pull request's run at cc024cc passes: 66 test files, 1313 tests (run 45995268131).The two commits 488e50d / 52a95ac (a CI trigger and its removal) cancel out; a squash merge drops them.