Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add logs for next time bug shows up #438

Merged
merged 2 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
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
12 changes: 7 additions & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -28,4 +29,5 @@ packages/config @luketchang
packages/deploy @luketchang
packages/e2e-tests @luketchang @Sladuca
packages/local-prover @Sladuca
packages/crypto-utils @Sladuca
packages/crypto-utils @Sladuca
packages/persistent-log @Sladuca
15 changes: 11 additions & 4 deletions actors/insertion-writer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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`,
Expand Down
33 changes: 21 additions & 12 deletions actors/insertion-writer/src/sync/subgraph/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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];
}
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading