Skip to content

fix POI spentTXO filtering by tree to prevent cross-tree nullifier co…#132

Merged
jacobmakarsky merged 1 commit intomainfrom
fix/poi-nullifier-collision
Apr 6, 2026
Merged

fix POI spentTXO filtering by tree to prevent cross-tree nullifier co…#132
jacobmakarsky merged 1 commit intomainfrom
fix/poi-nullifier-collision

Conversation

@jacobmakarsky
Copy link
Copy Markdown
Contributor

This is a follow-up to PR #130. The same class of bug, cross-tree nullifier collision, was causing POI proof generation to fail.

The Problem

In generatePOIsAllSentCommitmentsAndUnshieldEvents, spent TXOs were filtered by nullifier value alone without scoping by tree. When the same nullifier exists across multiple trees, find() returns the first match, which may be from the wrong tree. The POI proof is then generated against the wrong commitment data, causing the merkle proof to fail.

The Fix

Extracted POI.filterSpentTXOs() to filter by both nullifier value and utxoTreeIn, ensuring the correct tree's TXOs are selected.
Updated both call sites: abstract-wallet.ts and poi-status-formatter.ts.
Added poi-nullifier-collision.test.ts with tests covering collision, ordering, and non-collision scenarios.

@jacobmakarsky jacobmakarsky requested a review from mesquka April 3, 2026 04:36
Copy link
Copy Markdown
Collaborator

@mesquka mesquka left a comment

Choose a reason for hiding this comment

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

Changes look minimal, test coverage update good.

@jacobmakarsky jacobmakarsky merged commit 4f5ca33 into main Apr 6, 2026
5 of 6 checks passed
@jacobmakarsky jacobmakarsky deleted the fix/poi-nullifier-collision branch April 6, 2026 16:52
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