Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,13 @@ export class PXEOracleInterface implements ExecutionDataProvider {
const siloedNullifier = await siloNullifier(contractAddress, nullifier);

// We store notes by their index in the global note hash tree, which has the convenient side effect of validating
// note existence in said tree.
const [uniqueNoteHashTreeIndexInBlock] = await this.aztecNode.findLeavesIndexes(
syncedBlockNumber,
MerkleTreeId.NOTE_HASH_TREE,
[uniqueNoteHash],
);
// note existence in said tree. We concurrently also check if the note's nullifier exists, performing all node
// queries in a single round-trip.
const [[uniqueNoteHashTreeIndexInBlock], [nullifierIndex]] = await Promise.all([
this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NOTE_HASH_TREE, [uniqueNoteHash]),
this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NULLIFIER_TREE, [siloedNullifier]),
]);

if (uniqueNoteHashTreeIndexInBlock === undefined) {
throw new Error(
`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present on the tree at block ${syncedBlockNumber} (from tx ${txHash})`,
Expand Down Expand Up @@ -676,9 +677,6 @@ export class PXEOracleInterface implements ExecutionDataProvider {
nullifier: noteDao.siloedNullifier.toString(),
});

const [nullifierIndex] = await this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NULLIFIER_TREE, [
siloedNullifier,
]);
if (nullifierIndex !== undefined) {
const { data: _, ...blockHashAndNum } = nullifierIndex;
await this.noteDataProvider.removeNullifiedNotes([{ data: siloedNullifier, ...blockHashAndNum }], recipient);
Expand Down