Skip to content

fix: claim contract & improve nullif docs#21234

Open
nventuro wants to merge 6 commits intomerge-train/fairiesfrom
nv/fix-claim
Open

fix: claim contract & improve nullif docs#21234
nventuro wants to merge 6 commits intomerge-train/fairiesfrom
nv/fix-claim

Conversation

@nventuro
Copy link
Contributor

@nventuro nventuro commented Mar 7, 2026

This fixes the Claims contract (which is a bit odd anyway) by using SingleUseClaim instead of dangerously pushing a raw nullifier into state. It's another example of SingleUseClaim being 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 nullifier mod, which seems like a better home for an explanation of the concept.

Copy link
Contributor

@benesjan benesjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

/// 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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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