Skip to content

Commit

Permalink
fix(simulator): use nullifier.value in client's pendingNullifier se…
Browse files Browse the repository at this point in the history
…t so `set.has()` works (#1534)
  • Loading branch information
dbanks12 authored Aug 11, 2023
1 parent 7e33431 commit a78daf7
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ export class ClientTxExecutionContext {
* If a nullifier for a note in this list is emitted, the note will be REMOVED. */
private pendingNotes: PendingNoteData[] = [],
/** The list of nullifiers created in this transaction. The commitment/note which is nullified
* might be pending or not (i.e., was generated in a previous transaction) */
private pendingNullifiers: Set<Fr> = new Set<Fr>(),
* might be pending or not (i.e., was generated in a previous transaction)
* Note that their value (bigint representation) is used because Frs cannot be looked up in Sets. */
private pendingNullifiers: Set<bigint> = new Set<bigint>(),

private log = createDebugLogger('aztec:simulator:client_execution_context'),
) {}
Expand Down Expand Up @@ -131,8 +132,7 @@ export class ClientTxExecutionContext {

const dbNotes = await this.db.getNotes(contractAddress, storageSlotField);

// Remove notes which were already nullified during this transaction.
const dbNotesFiltered = dbNotes.filter(n => !this.pendingNullifiers.has(n.siloedNullifier as Fr));
const dbNotesFiltered = dbNotes.filter(n => !this.pendingNullifiers.has((n.siloedNullifier as Fr).value));

// Nullified pending notes are already removed from the list.
const notes = pickNotes([...dbNotesFiltered, ...pendingNotes], {
Expand Down Expand Up @@ -245,7 +245,7 @@ export class ClientTxExecutionContext {
public async pushNewNullifier(innerNullifier: Fr, contractAddress: AztecAddress) {
const wasm = await CircuitsWasm.get();
const siloedNullifier = siloNullifier(wasm, contractAddress, innerNullifier);
this.pendingNullifiers.add(siloedNullifier);
this.pendingNullifiers.add(siloedNullifier.value);
}

/**
Expand Down

0 comments on commit a78daf7

Please sign in to comment.