Skip to content

refactor: deduplicate MembershipWitness struct#21244

Merged
benesjan merged 1 commit intomerge-train/fairiesfrom
jan/deduplicate-membership-witness
Mar 10, 2026
Merged

refactor: deduplicate MembershipWitness struct#21244
benesjan merged 1 commit intomerge-train/fairiesfrom
jan/deduplicate-membership-witness

Conversation

@benesjan
Copy link
Contributor

@benesjan benesjan commented Mar 9, 2026

We had a superfluous generic param M defined on MembershipWitness type that was there probably because of some old Noir issue. Dropping it now resulted in the code normally compiling. Given that we already had MembershipWitness defined in protocol types I dropped the Aztec.nr version and use just the one from types.

Tackling this now as I am going through the oracles cleanup that is tracked by this issue.

AI Summary

  • Remove the duplicate MembershipWitness<N, M> struct from aztec-nr/oracle/get_membership_witness.nr and reuse the canonical MembershipWitness<N> from noir-protocol-circuits/types/merkle_tree/membership
  • Drop the unnecessary M generic parameter (was a workaround for a Noir limitation that no longer exists)
  • Add Deserialize/Serialize derives to the protocol-circuits MembershipWitness so it works with oracle deserialization
  • Improve doc comments on nullifier membership witness functions

…definition

Remove the duplicate `MembershipWitness` struct from the aztec-nr oracle module and reuse the
canonical one from `noir-protocol-circuits/types/merkle_tree/membership`. This also drops the
unnecessary `M` generic parameter that was a workaround for a Noir type-system limitation that
no longer exists.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@@ -17,8 +17,12 @@ unconstrained fn get_low_nullifier_membership_witness_oracle(
_nullifier: Field,
) -> NullifierMembershipWitness {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated change but the motivation for this was that the comment above get_nullifier_membership_witness was an incorrect copy from the comment above get_low_nullifier_membership_witness.

@benesjan benesjan requested a review from nchamo March 9, 2026 07:49
@benesjan benesjan changed the base branch from next to merge-train/fairies March 9, 2026 07:49
@benesjan
Copy link
Contributor Author

benesjan commented Mar 9, 2026

@LeilaWang is it fine to modify the circuits code here? Asking in case the code was already frozen or something. Thanks

Copy link
Contributor

@nchamo nchamo left a comment

Choose a reason for hiding this comment

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

Good work!

@benesjan benesjan merged commit f2a75f7 into merge-train/fairies Mar 10, 2026
24 checks passed
@benesjan benesjan deleted the jan/deduplicate-membership-witness branch March 10, 2026 09:50
github-merge-queue bot pushed a commit that referenced this pull request Mar 10, 2026
BEGIN_COMMIT_OVERRIDE
refactor: deduplicate MembershipWitness struct (#21244)
feat(pxe)!: pass BoundedVec sizes as oracle params (#21176)
refactor!: cleaning up public call and tx phase related oracles (#21209)
END_COMMIT_OVERRIDE
@ludamad
Copy link
Collaborator

ludamad commented Mar 11, 2026

backport-later handled: cherry-picked to v4-next in #21341

@AztecBot
Copy link
Collaborator

❌ Failed to cherry-pick to v4-next due to conflicts. Dispatching ClaudeBox to resolve. View backport run.

AztecBot added a commit that referenced this pull request Mar 11, 2026
The cherry-pick of #21244 only resolved the conflict region (first oracle name),
but missed renaming utilityGetBlockHashMembershipWitness to aztec_utl_getBlockHashMembershipWitness.
nventuro added a commit that referenced this pull request Mar 13, 2026
## Summary
- Backports 5 PRs from `merge-train/fairies` related to oracle changes:
  - #21101 - feat: improve oracle name prefixes
- #21349 - fix: skip oracle version check for pinned protocol contracts
  - #21244 - refactor: deduplicate MembershipWitness struct
  - #21176 - feat(pxe)!: pass BoundedVec sizes as oracle params
- #21209 - refactor!: cleaning up public call and tx phase related
oracles

## Test plan
- CI passes on backport branch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Nicolas Chamo <nicolas@chamo.com.ar>
Co-authored-by: benesjan <benesjan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants