diff --git a/src/config/version.hpp b/src/config/version.hpp index 915951bf0..f6cf4f374 100644 --- a/src/config/version.hpp +++ b/src/config/version.hpp @@ -1,6 +1,6 @@ #ifndef ZKEVM_PROVER_VERSION_HPP #define ZKEVM_PROVER_VERSION_HPP -#define ZKEVM_PROVER_VERSION "v5.0.9-RC3" +#define ZKEVM_PROVER_VERSION "v5.0.9" #endif diff --git a/src/main_sm/fork_8/main/full_tracer.cpp b/src/main_sm/fork_8/main/full_tracer.cpp index 864f7dbfd..24235cfcd 100644 --- a/src/main_sm/fork_8/main/full_tracer.cpp +++ b/src/main_sm/fork_8/main/full_tracer.cpp @@ -452,17 +452,15 @@ zkresult FullTracer::onError(Context &ctx, const RomCommand &cmd) if ( (responseErrors.find(lastError) != responseErrors.end()) || full_trace.empty() ) { - if (currentBlock.responses.size() > txIndex) - { - currentBlock.responses[txIndex].error = lastError; - } - else + if (currentBlock.responses.empty()) { zklog.error("FullTracer::onError() got error=" + lastError + " with txIndex=" + to_string(txIndex) + " but currentBlock.responses.size()=" + to_string(currentBlock.responses.size())); exitProcess(); } + currentBlock.responses[currentBlock.responses.size() - 1].error = lastError; + #ifdef LOG_FULL_TRACER_ON_ERROR - zklog.info("FullTracer::onError() 4 error=" + lastError + " zkPC=" + to_string(*ctx.pZKPC) + " rom=" + ctx.rom.line[*ctx.pZKPC].toString(ctx.fr) + " block=" + to_string(currentBlock.block_number) + " responses.size=" + to_string(currentBlock.responses.size())); + zklog.info("FullTracer::onError() 4 error=" + lastError + " zkPC=" + to_string(*ctx.pZKPC) + " rom=" + ctx.rom.line[*ctx.pZKPC].toString(ctx.fr) + " block=" + to_string(currentBlock.block_number) + " responses.size=" + to_string(currentBlock.responses.size()) + " txIndex=" + to_string(txIndex)); #endif #ifdef LOG_TIME_STATISTICS tms.add("onError", TimeDiff(t)); @@ -514,7 +512,7 @@ zkresult FullTracer::onError(ContextC &ctxc, const string &error) lastErrorOpcode = numberOfOpcodesInThisTx; // Intrinsic error should be set at tx level (not opcode) - if ( (responseErrors.find(lastError) != responseErrors.end()) || + /*if ( (responseErrors.find(lastError) != responseErrors.end()) || (full_trace.size() == 0) ) { if (currentBlock.responses.size() > txIndex) @@ -540,7 +538,7 @@ zkresult FullTracer::onError(ContextC &ctxc, const string &error) } // Revert logs - /*uint64_t CTX = ctx.fr.toU64(ctx.pols.CTX[*ctx.pStep]); + uint64_t CTX = ctx.fr.toU64(ctx.pols.CTX[*ctx.pStep]); mpz_class auxScalar; zkr = getVarFromCtx(ctx, true, ctx.rom.lastCtxUsedOffset, auxScalar); if (zkr != ZKR_SUCCESS) @@ -642,8 +640,13 @@ zkresult FullTracer::onStoreLog (Context &ctx, const RomCommand &cmd) return zkr; } it->second.block_number = auxScalar.get_ui(); - it->second.tx_hash = currentBlock.responses[txIndex].tx_hash; - it->second.tx_hash_l2 = currentBlock.responses[txIndex].tx_hash_l2; + if (currentBlock.responses.empty()) + { + zklog.error("FullTracer::onStoreLog() found currentBlock.responses empty"); + exitProcess(); + } + it->second.tx_hash = currentBlock.responses[currentBlock.responses.size() - 1].tx_hash; + it->second.tx_hash_l2 = currentBlock.responses[currentBlock.responses.size() - 1].tx_hash_l2; it->second.tx_index = txIndex; it->second.index = indexLog; @@ -1509,7 +1512,7 @@ zkresult FullTracer::onFinishTx(Context &ctx, const RomCommand &cmd) } zkresult zkr; - ResponseV2 &response = currentBlock.responses[txIndex]; + ResponseV2 &response = currentBlock.responses[currentBlock.responses.size() - 1]; // Set from address mpz_class fromScalar; @@ -1658,9 +1661,6 @@ zkresult FullTracer::onFinishTx(Context &ctx, const RomCommand &cmd) currentBlock.responses[currentBlock.responses.size() - 1].has_gasprice_opcode = hasGaspriceOpcode; currentBlock.responses[currentBlock.responses.size() - 1].has_balance_opcode = hasBalanceOpcode; - // Increase transaction index - txIndex++; - // Check TX status if ((responseErrors.find(response.error) == responseErrors.end()) && ( (response.error.empty() && (response.status == 0)) || @@ -1723,6 +1723,7 @@ zkresult FullTracer::onFinishTx (ContextC &ctxc) gettimeofday(&t, NULL); #endif //zkresult zkr; +#if 0 ResponseV2 &response = currentBlock.responses[txIndex]; // Set from address @@ -1734,7 +1735,6 @@ zkresult FullTracer::onFinishTx (ContextC &ctxc) response.gas_used = ctxc.batch.tx[ctxc.tx].gas.get_ui(); response.full_trace.context.gas_used = response.gas_used; accBatchGas += response.gas_used; - /* // Set return data always; get it from memory { @@ -1779,7 +1779,7 @@ zkresult FullTracer::onFinishTx (ContextC &ctxc) // Set gas left response.gas_left -= response.gas_used; -*/ + // Set new State Root fea2scalar(ctxc.fr, auxScalar, ctxc.root); response.state_root = NormalizeTo0xNFormat(auxScalar.get_str(16), 64); @@ -1865,6 +1865,9 @@ zkresult FullTracer::onFinishTx (ContextC &ctxc) #ifdef LOG_FULL_TRACER //zklog.info("FullTracer::onFinishTx() txCount=" + to_string(txCount) + " finalTrace.responses.size()=" + to_string(finalTrace.responses.size()) + " create_address=" + response.create_address + " state_root=" + response.state_root); #endif + +#endif + #ifdef LOG_TIME_STATISTICS tms.add("onFinishTx", TimeDiff(t)); #endif @@ -2186,8 +2189,13 @@ zkresult FullTracer::onOpcode(Context &ctx, const RomCommand &cmd) return zkr; } it->second.block_number = auxScalar.get_ui(); - it->second.tx_hash = currentBlock.responses[txIndex].tx_hash; - it->second.tx_hash_l2 = currentBlock.responses[txIndex].tx_hash_l2; + if (currentBlock.responses.empty()) + { + zklog.error("FullTracer::onOpcode() found currentBlock.responses empty"); + exitProcess(); + } + it->second.tx_hash = currentBlock.responses[currentBlock.responses.size() - 1].tx_hash; + it->second.tx_hash_l2 = currentBlock.responses[currentBlock.responses.size() - 1].tx_hash_l2; it->second.tx_index = txIndex; it->second.index = indexLog; }