fix: claim contract & improve nullif docs#21234
Open
nventuro wants to merge 6 commits intomerge-train/fairiesfrom
Open
fix: claim contract & improve nullif docs#21234nventuro wants to merge 6 commits intomerge-train/fairiesfrom
nventuro wants to merge 6 commits intomerge-train/fairiesfrom
Conversation
benesjan
approved these changes
Mar 8, 2026
| /// nullifiers. | ||
| /// The `nullification_note_hash` must be the result of calling | ||
| /// [`crate::note::utils::compute_confirmed_note_hash_for_nullification`] for pending notes, and `0` for settled | ||
| /// notes (which cannot be squashed). |
Contributor
There was a problem hiding this comment.
Unrelated but what do you think about typing this nullifier?
Or would you say this is too low-level for it to be worthy here?
Comment on lines
+75
to
+76
| .at(note_hash_for_nullification) | ||
| .at(confirmed_note.owner) |
Contributor
There was a problem hiding this comment.
Is this double "at" here what you meant by the SingleUseClaim being awkward?
AI came up with these alternative names for Owned::at:
.of(owner) — reads naturally: "the claim of this owner". The chain becomes .at(hash).of(owner).claim()
.for_owner(owner) — more explicit but verbose: .at(hash).for_owner(owner).claim()
.owned_by(owner) — very readable: .at(hash).owned_by(owner).claim()
I would say "of" is nice.
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.
This fixes the
Claimscontract (which is a bit odd anyway) by usingSingleUseClaiminstead of dangerously pushing a raw nullifier into state. It's another example ofSingleUseClaimbeing a bit awkward to use - we may want to revisit that a bit.I took the opportunity to review and improve the docs sorrounding nullifiers, mostly noting how dangerous it is to use these functions directly. I moved the docs on what a nullifier even is to the
nullifiermod, which seems like a better home for an explanation of the concept.