diff --git a/src/main_generator/main_generator_10.cpp b/src/main_generator/main_generator_10.cpp index c71b8ca8e..84fd5a567 100644 --- a/src/main_generator/main_generator_10.cpp +++ b/src/main_generator/main_generator_10.cpp @@ -328,11 +328,11 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st code += " uint8_t polsBuffer[CommitPols::numPols()*sizeof(Goldilocks::Element)] = { 0 };\n"; code += " MainCommitPols pols((void *)polsBuffer, 1);\n"; } - code += " int32_t addrRel = 0; // Relative and absolute address auxiliary variables\n"; + code += " int32_t addrRel;\n"; code += " int32_t addr;\n"; code += " int32_t memAddr;\n"; code += " int32_t hashAddr;\n"; - code += " uint64_t context = 0;\n"; + code += " uint64_t context;\n"; if (!bFastMode) { // Declare op0CondConst only if condConst instruction is used @@ -368,7 +368,6 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st code += " }\n"; code += " mainExecutor.labelsUnlock();\n\n"; - code += " // Init execution flags\n"; code += " bool bProcessBatch = (proverRequest.type == prt_processBatch);\n"; code += " bool bUnsignedTransaction = (proverRequest.input.from != \"\") && (proverRequest.input.from != \"0x\");\n\n"; @@ -425,8 +424,7 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st code += " // Convert batch data to vector\n"; code += " vector batchDataVector;\n"; code += " ba2ba(proverRequest.input.publicInputsExtended.publicInputs.batchL2Data, batchDataVector);\n"; - - code += " // Load poseidon batch data into DB\n"; + //code += " // Load poseidon batch data into DB\n"; code += " Goldilocks::Element batchKey[4];\n"; code += " poseidonLinearHash(batchDataVector, batchKey);\n"; code += " mpz_class batchHashDataComputed;\n"; @@ -455,7 +453,7 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st code += " }\n"; code += " }\n\n"; - code += " // opN are local, uncommitted polynomials\n"; + //code += " // opN are local, uncommitted polynomials\n"; code += " Goldilocks::Element op0, op1, op2, op3, op4, op5, op6, op7;\n"; code += " Goldilocks::Element o;\n"; @@ -525,7 +523,6 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st code += " mpz_class w0, w1, _W0, _W1;\n"; code += " mpz_class _W;\n"; code += " MemAlignAction memAlignAction;\n"; - code += " mpz_class byteMaskOn256(\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\", 16);\n"; // Binary free in code += " mpz_class a, b, c, _a, _b;\n"; @@ -712,7 +709,7 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st // ECRECOVER PRE-CALCULATION if(rom["labels"].contains("ecrecover_store_args") && zkPC == rom["labels"]["ecrecover_store_args"]){ - code += " //ECRecover pre-calculation \n"; + //code += " //ECRecover pre-calculation \n"; code += " if(mainExecutor.config.ECRecoverPrecalc){\n"; code += " zkassert(ctx.ecRecoverPrecalcBuffer.filled == false);\n"; code += " mpz_class signature_, r_, s_, v_;\n"; @@ -737,7 +734,7 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st } if(rom["labels"].contains("ecrecover_end") && zkPC == rom["labels"]["ecrecover_end"]){ - code += " //ECRecover destroy pre-calculaiton buffer\n"; + //code += " //ECRecover destroy pre-calculaiton buffer\n"; code += " if( ctx.ecRecoverPrecalcBuffer.filled){\n"; code += " zkassert(ctx.ecRecoverPrecalcBuffer.pos == ctx.ecRecoverPrecalcBuffer.posUsed);\n"; code += " ctx.ecRecoverPrecalcBuffer.filled = false;\n"; @@ -752,7 +749,7 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st if (rom["program"][zkPC].contains("cmdBefore") && (rom["program"][zkPC]["cmdBefore"].size()>0)) { - code += " // Evaluate the list cmdBefore commands, and any children command, recursively\n"; + //code += " // Evaluate the list cmdBefore commands, and any children command, recursively\n"; code += " for (uint64_t j=0; j0) ) { - code += " // Evaluate the list cmdAfter commands of the previous ROM line,\n"; - code += " // and any children command, recursively\n"; + //code += " // Evaluate the list cmdAfter commands of the previous ROM line,\n"; + //code += " // and any children command, recursively\n"; code += " if (i < N_Max_minus_one)\n"; code += " {\n"; if (!bFastMode) @@ -5808,7 +5805,7 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st code += " if (i==N_Max_minus_one) goto " + functionName + "_end;\n"; code += " i++;\n"; if (!bFastMode) - code += " nexti=(i+1)%N_Max;\n"; + code += " nexti = (i==N_Max_minus_one) ? 0 : i+1;\n"; code += "\n"; // In case we had a pending jump, do it now, after the work has been done @@ -5852,7 +5849,7 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st code += " return;\n"; code += " }\n"; - code += " // Copy the counters\n"; + //code += " // Copy the counters\n"; code += " proverRequest.counters.arith = fr.toU64(pols.cntArith[0]);\n"; code += " proverRequest.counters.binary = fr.toU64(pols.cntBinary[0]);\n"; code += " proverRequest.counters.keccakF = fr.toU64(pols.cntKeccakF[0]);\n"; @@ -5871,10 +5868,10 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st code += " proverRequest.countersReserve.sha256F = zkmax(proverRequest.countersReserve.sha256F, proverRequest.counters.sha256F);\n"; code += " proverRequest.countersReserve.steps = zkmax(proverRequest.countersReserve.steps, proverRequest.counters.steps);\n"; - code += " // Set the error (all previous errors generated a return)\n"; + //code += " // Set the error (all previous errors generated a return)\n"; code += " proverRequest.result = ZKR_SUCCESS;\n"; - code += " // Check that we did not run out of steps during the execution\n"; + //code += " // Check that we did not run out of steps during the execution\n"; code += " if (ctx.lastStep == 0)\n"; code += " {\n"; code += " proverRequest.result = ZKR_SM_MAIN_OUT_OF_STEPS;\n"; @@ -5946,11 +5943,11 @@ string generate(const json &rom, uint64_t forkID, string forkNamespace, const st if (!bFastMode) // In fast mode, last nexti was not 0 but 1, and pols have only 2 evaluations { - code += " // Check that all registers are set to 0\n"; + //code += " // Check that all registers are set to 0\n"; code += " mainExecutor.checkFinalState(ctx);\n"; code += " mainExecutor.assertOutputs(ctx);\n\n"; - code += " // Generate Padding KK required data\n"; + //code += " // Generate Padding KK required data\n"; code += " for (uint64_t i=0; i