From a66479faea163f2fc06caf4dd1c1533369c3e037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 6 Jun 2024 13:29:30 +0200 Subject: [PATCH 1/2] statetest: print time and logs --- test/statetest/statetest_runner.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/statetest/statetest_runner.cpp b/test/statetest/statetest_runner.cpp index e1e2718db5..39df1e10d1 100644 --- a/test/statetest/statetest_runner.cpp +++ b/test/statetest/statetest_runner.cpp @@ -27,9 +27,13 @@ void run_state_test(const StateTransitionTest& test, evmc::VM& vm, bool trace_su const auto tx = test.multi_tx.get(expected.indexes); auto state = test.pre_state; + const auto start_time = std::chrono::steady_clock::now(); + const auto res = state::transition(state, test.block, tx, rev, vm, test.block.gas_limit, state::BlockInfo::MAX_BLOB_GAS_PER_BLOCK); + const auto exec_duration = std::chrono::steady_clock::now() - start_time; + // Finalize block with reward 0. state::finalize(state, rev, test.block.coinbase, 0, {}, {}); @@ -46,8 +50,22 @@ void run_state_test(const StateTransitionTest& test, evmc::VM& vm, bool trace_su else std::clog << R"("pass":false,"error":")" << r.status << '"'; std::clog << R"(,"gasUsed":"0x)" << std::hex << r.gas_used << R"(",)"; + + if (r.status == EVMC_SUCCESS) + { + std::clog << "LOGS:\n"; + for (const auto& log : r.logs) + { + std::clog << log.addr << ": " << hex(log.data) << "\n"; + } + } } std::clog << R"("stateRoot":"0x)" << hex(state_root) << "\"}\n"; + + std::clog + << "time: " << std::dec + << std::chrono::duration_cast(exec_duration).count() + << "us\n"; } if (expected.exception) From c1fabc6d6c80e9247f6f2d12dd430380f1023a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 6 Jun 2024 14:51:54 +0200 Subject: [PATCH 2/2] baseline: disable jumpdest analysis --- lib/evmone/baseline.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/evmone/baseline.cpp b/lib/evmone/baseline.cpp index 94a79bdc66..e4f08fdbf7 100644 --- a/lib/evmone/baseline.cpp +++ b/lib/evmone/baseline.cpp @@ -33,15 +33,7 @@ CodeAnalysis::JumpdestMap analyze_jumpdests(bytes_view code) // static_cast(op) <= OP_PUSH32 is always true and can be skipped. static_assert(OP_PUSH32 == std::numeric_limits::max()); - CodeAnalysis::JumpdestMap map(code.size()); // Allocate and init bitmap with zeros. - for (size_t i = 0; i < code.size(); ++i) - { - const auto op = code[i]; - if (static_cast(op) >= OP_PUSH1) // If any PUSH opcode (see explanation above). - i += op - size_t{OP_PUSH1 - 1}; // Skip PUSH data. - else if (INTX_UNLIKELY(op == OP_JUMPDEST)) - map[i] = true; - } + CodeAnalysis::JumpdestMap map(code.size(), true); // Allocate and init bitmap with ones. return map; }