From 63a9243bd8d6067c895e5485c73584b71ac30f27 Mon Sep 17 00:00:00 2001 From: Sebastien La Duca Date: Tue, 12 Sep 2023 14:51:30 -0400 Subject: [PATCH] add logs for next time bug shows up (#438) * add logs for next time bug shows up * add insertion writer and plog to codeowners --- .github/CODEOWNERS | 12 ++++--- actors/insertion-writer/src/index.ts | 15 ++++++--- .../src/sync/subgraph/adapter.ts | 33 ++++++++++++------- yarn.lock | 2 +- 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 75e3bce1e..3bb809b20 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,10 +12,11 @@ packages/snap @luketchang @Sladuca # actors -packages/bundler @luketchang @Sladuca -packages/subtree-updater @Sladuca -packages/deposit-screener @Sladuca @luketchang -packages/test-actor @Sladuca @luketchang +actors/bundler @luketchang @Sladuca +actors/subtree-updater @Sladuca +actors/deposit-screener @Sladuca @luketchang +actors/test-actor @Sladuca @luketchang +actors/insertion-log @Sladuca # SDKs @@ -28,4 +29,5 @@ packages/config @luketchang packages/deploy @luketchang packages/e2e-tests @luketchang @Sladuca packages/local-prover @Sladuca -packages/crypto-utils @Sladuca \ No newline at end of file +packages/crypto-utils @Sladuca +packages/persistent-log @Sladuca \ No newline at end of file diff --git a/actors/insertion-writer/src/index.ts b/actors/insertion-writer/src/index.ts index 173f35d24..02fe2e2a2 100644 --- a/actors/insertion-writer/src/index.ts +++ b/actors/insertion-writer/src/index.ts @@ -31,9 +31,13 @@ export class InsertionWriter { this.logger.debug(`current log tip: ${logTip}`); this.logger.debug("starting iterator"); - const newInsertionBatches = this.adapter.iterInsertions(logTip ?? 0, { - throttleMs: queryThrottleMs, - }); + // start a logTip + 1 because we want to start at the next merkle index + const newInsertionBatches = this.adapter.iterInsertions( + logTip ? logTip + 1 : 0, + { + throttleMs: queryThrottleMs, + } + ); const runProm = (async () => { this.logger.debug("starting main loop"); @@ -43,7 +47,10 @@ export class InsertionWriter { endMerkleIndex: insertions[insertions.length - 1].merkleIndex, }; - this.logger.info(`got batch of ${insertions.length} insertions`, meta); + this.logger.info( + `got batch of ${insertions.length} insertions starting at merkle index ${meta.startMerkleIndex}`, + meta + ); await this.insertionLog.push(insertions); this.logger.info( `pushed batch of ${insertions.length} into insertion log`, diff --git a/actors/insertion-writer/src/sync/subgraph/adapter.ts b/actors/insertion-writer/src/sync/subgraph/adapter.ts index 1ca322ee2..a73d3ae19 100644 --- a/actors/insertion-writer/src/sync/subgraph/adapter.ts +++ b/actors/insertion-writer/src/sync/subgraph/adapter.ts @@ -99,10 +99,13 @@ export class SubgraphTreeInsertionSyncAdapter numZeros: insertion.numZeros, }; logger && - logger.debug("yielding zeros", { - insertionKind: "zeros", - insertion: meta, - }); + logger.debug( + `yielding ${insertion.numZeros} zeros starting at merkle index ${insertion.merkleIndex}`, + { + insertionKind: "zeros", + insertion: meta, + } + ); const batch = range(0, insertion.numZeros).map((i) => ({ noteCommitment: TreeConstants.ZERO_VALUE, @@ -120,10 +123,13 @@ export class SubgraphTreeInsertionSyncAdapter }; logger && - logger.debug("yielding encrypted note", { - insertionKind: "encrypted note", - meta, - }); + logger.debug( + `yielding encrypted note at merkle index ${insertion.merkleIndex}`, + { + insertionKind: "encrypted note", + meta, + } + ); const res = { noteCommitment, @@ -138,10 +144,13 @@ export class SubgraphTreeInsertionSyncAdapter note: insertion, }; logger && - logger.debug("yielding note", { - insertionKind: "note", - meta, - }); + logger.debug( + `yielding note at merkle index ${insertion.merkleIndex}`, + { + insertionKind: "note", + meta, + } + ); yield [insertion as IncludedNote]; } diff --git a/yarn.lock b/yarn.lock index 843e8fd9a..99d64537e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12479,7 +12479,7 @@ circomlibjs@nocturne-xyz/circomlibjs: dependencies: bn.js: ^4.11.8 ethereumjs-util: ^6.0.0 - checksum: 03127d09960e5f8a44167463faf25b2894db2f746376dbb8195b789ed11762f93db9c574eaa7c498c400063508e9dfc1c80de2edf5f0e1406b25c87d860ff2f1 + checksum: ae074be0bb012857ab5d3ae644d1163b908a48dd724b7d2567cfde309dc72222d460438f2411936a70dc949dc604ce1ef7118f7273bd525815579143c907e336 languageName: node linkType: hard