Skip to content

Commit

Permalink
Add check
Browse files Browse the repository at this point in the history
  • Loading branch information
fractasy committed Feb 12, 2024
1 parent 50d3c15 commit c9cd8dc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 30 deletions.
21 changes: 10 additions & 11 deletions src/main_generator/main_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5432,6 +5432,15 @@ code += " #endif\n";
//code += " goto *" + functionName + "_labels[addr]; // If op<0, jump to addr: zkPC'=addr\n";
code += " bJump = true;\n";
bConditionalJump = true;

if ((proverForkID == 7) && rom["program"][zkPC].contains("jmpAddrLabel") && (rom["program"][zkPC]["jmpAddrLabel"] == "funcModexp"))
{
code += " proverRequest.result = ZKR_SM_MAIN_ASSERT;\n";
code += " mainExecutor.logError(ctx, \"Invalid funcModexp call\");\n";
code += " mainExecutor.pHashDB->cancelBatch(proverRequest.uuid);\n";
code += " return;\n";
}

code += " }\n";
// If op>=0, simply increase zkPC'=zkPC+1
code += " else if (jmpnCondValue <= FrLast32Positive)\n";
Expand Down Expand Up @@ -5553,17 +5562,7 @@ code += " #endif\n";
{
code += " pols.zkPC[nexti] = fr.fromU64(addr);\n";
}
}

bool bCheck = (proverForkID == 7) && rom["program"][zkPC].contains("jmpAddrLabel") && (rom["program"][zkPC]["jmpAddrLabel"] == "modexp");

if (bCheck)
{
code += " proverRequest.result = ZKR_SM_MAIN_ASSERT;\n";
code += " mainExecutor.logError(ctx, \"Invalid modexp call\");\n";
code += " mainExecutor.pHashDB->cancelBatch(proverRequest.uuid);\n";
code += " return;\n";
}
}
}
// If return
else if (rom["program"][zkPC].contains("return") && (rom["program"][zkPC]["return"] == 1))
Expand Down
Loading

0 comments on commit c9cd8dc

Please sign in to comment.