Skip to content

Commit

Permalink
decryptedIncoming and decryptedOutgoing
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Jun 5, 2024
1 parent 6370db9 commit daa6177
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
6 changes: 4 additions & 2 deletions yarn-project/circuit-types/src/stats/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ export type NoteProcessorStats = {
seen: number;
/** How many notes had decryption deferred due to a missing contract */
deferred: number;
/** How many notes were successfully decrypted. */
decrypted: number;
/** How many incoming notes were successfully decrypted. */
decryptedIncoming: number;
/** How many outgoing notes were successfully decrypted. */
decryptedOutgoing: number;
/** How many notes failed processing. */
failed: number;
/** How many blocks were spanned. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ describe('e2e_pending_note_hashes_contract', () => {
await deployedContract.methods.test_emit_bad_note_log(owner, outgoingViewer).send().wait();

const syncStats = await wallet.getSyncStats();
// Expect two decryptable note logs to be emitted
expect(syncStats[owner.toString()].decrypted).toEqual(2);
// Expect two incoming decryptable note logs to be emitted
expect(syncStats[owner.toString()].decryptedIncoming).toEqual(2);
// Expect one note log to be dropped
expect(syncStats[owner.toString()].failed).toEqual(1);
});
Expand Down
16 changes: 12 additions & 4 deletions yarn-project/pxe/src/note_processor/note_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ export class NoteProcessor {
public readonly timer: Timer = new Timer();

/** Stats accumulated for this processor. */
public readonly stats: NoteProcessorStats = { seen: 0, decrypted: 0, deferred: 0, failed: 0, blocks: 0, txs: 0 };
public readonly stats: NoteProcessorStats = {
seen: 0,
decryptedIncoming: 0,
decryptedOutgoing: 0,
deferred: 0,
failed: 0,
blocks: 0,
txs: 0,
};

private constructor(
public readonly account: AztecAddress,
Expand Down Expand Up @@ -182,11 +190,11 @@ export class NoteProcessor {

if (incomingNote) {
incomingNotes.push(incomingNote);
this.stats.decrypted++;
this.stats.decryptedIncoming++;
}
if (outgoingNote) {
outgoingNotes.push(outgoingNote);
this.stats.decrypted++;
this.stats.decryptedOutgoing++;
}
if (incomingDeferredNote) {
deferredNoteDaosIncoming.push(incomingDeferredNote);
Expand Down Expand Up @@ -314,7 +322,7 @@ export class NoteProcessor {
}

incomingNotes.push(incomingNote);
this.stats.decrypted++;
this.stats.decryptedIncoming++;
}

return incomingNotes;
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/scripts/src/benchmarks/aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ function processCircuitWitnessGeneration(entry: CircuitWitnessGenerationStats, r
* Processes an entry with event name 'note-processor-caught-up' and updates results
*/
function processNoteProcessorCaughtUp(entry: NoteProcessorCaughtUpStats, results: BenchmarkCollectedResults) {
const { decrypted, blocks, dbSize } = entry;
if (BENCHMARK_HISTORY_CHAIN_LENGTHS.includes(blocks) && decrypted > 0) {
const { decryptedIncoming, decryptedOutgoing, blocks, dbSize } = entry;
if (BENCHMARK_HISTORY_CHAIN_LENGTHS.includes(blocks) && (decryptedIncoming > 0 || decryptedOutgoing > 0)) {
append(results, 'pxe_database_size_in_bytes', blocks, dbSize);
}
}
Expand Down

0 comments on commit daa6177

Please sign in to comment.