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

Clear logs array on finish tx #106

Merged
merged 1 commit into from
Dec 21, 2022
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
30 changes: 28 additions & 2 deletions src/sm/sm_main/debug/full-tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class FullTracer {
if (this.finalTrace.responses[this.txCount]) {
this.finalTrace.responses[this.txCount].error = errorName;
} else {
this.finalTrace.responses[this.txCount] = {error: errorName};
this.finalTrace.responses[this.txCount] = { error: errorName };
}
return;
}
Expand Down Expand Up @@ -310,7 +310,8 @@ class FullTracer {
for (const l of this.logs) {
this.finalTrace.responses[this.txCount].logs = this.finalTrace.responses[this.txCount].logs.concat(Object.values(l));
}

// clear logs array
this.logs = [];
fs.writeFileSync(`${this.pathLogFile}_${this.txCount}.json`, JSON.stringify(this.finalTrace.responses[this.txCount], null, 2));

this.verbose.printTx(`finish ${this.txCount}`);
Expand Down Expand Up @@ -355,6 +356,31 @@ class FullTracer {
cnt_padding_pg: Number(ctx.cntPaddingPG),
cnt_poseidon_g: Number(ctx.cntPoseidonG),
cont_steps: Number(ctx.step),
}
try {
if (Number(ctx.cntArith) > getConstantFromCtx(ctx, "MAX_CNT_ARITH")) {
console.log("WARNING: max arith counters exceed")
}
if (Number(ctx.cntBinary) > getConstantFromCtx(ctx, "MAX_CNT_BINARY")) {
console.log("WARNING: max binary counters exceed")
}
if (Number(ctx.cntMemAlign) > getConstantFromCtx(ctx, "MAX_CNT_MEM_ALIGN")) {
console.log("WARNING: max mem align counters exceed")
}
if (Number(ctx.cntKeccakF) > getConstantFromCtx(ctx, "MAX_CNT_KECCAK_F")) {
console.log("WARNING: max keccack counters exceed")
}
if (Number(ctx.cntPaddingPG) > getConstantFromCtx(ctx, "MAX_CNT_PADDING_PG")) {
console.log("WARNING: max padding counters exceed")
}
if (Number(ctx.cntPoseidonG) > getConstantFromCtx(ctx, "MAX_CNT_POSEIDON_G")) {
console.log("WARNING: max poseidon counters exceed")
}
if (Number(ctx.step) > getConstantFromCtx(ctx, "MAX_CNT_STEPS")) {
console.log("WARNING: max steps counters exceed")
}
} catch (e) {

}
//If some counter exceed, notify
//if(this.finalTrace.counters.cnt_arith > )
Expand Down