Verify commitment onchain at reveal and validate register inputs - #5
Draft
gskril wants to merge 2 commits into
Draft
Verify commitment onchain at reveal and validate register inputs#5gskril wants to merge 2 commits into
gskril wants to merge 2 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Prevent commit/reveal parameter drift (especially v2 resolver defaults) by deduplicating parameter resolution and checking v1 commitments onchain before generating reveal calldata. Co-authored-by: Cursor <cursoragent@cursor.com>
commit: |
gskril
marked this pull request as draft
July 2, 2026 20:42
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
register revealpreviously re-resolved default parameters independently of commit (notably the v2 owned-resolver lookup). If a user deployed their resolver between commit and reveal, the commitment hash would no longer match and the onchain register call would revert after they had already paid gas for commit and ERC-20 approval. Commit and reveal now share the same parameter-resolution helpers insrc/lib/register.ts.makeCommitment, readscommitments(bytes32)on the controller, and validates min/max commitment age. Fails early with a clear error when no matching commitment exists or timing is wrong. Includes commitment hash and committed-at timestamp in successful output.0x8c2E866B439358c41AE05De9cbE8A00BFEFafFcA) — it does not exposecommitments/minCommitmentAge/maxCommitmentAge. Reveal still recomputes and outputs the commitment, but skips onchain verification with awarningfield.--durationmust be a positive integer;--secretmust be exactly 32 bytes;--valuemust be a base-10 wei string.--skip-commitment-checkpreserves offline calldata generation.Test plan
bun run typecheckpassesens register commit sometestname12345.eth --owner 0xd8dA… --json(mainnet v1) produces commit calldata + secretens register reveal … --secret … --value …without prior onchain commit fails with "No matching commitment found"--skip-commitment-checkproduces calldata--duration 1.5→ validation error;--value abc→ validation errorMade with Cursor