Skip to content

Commit a66479f

Browse files
committed
statetest: print time and logs
1 parent 97bbf26 commit a66479f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/statetest/statetest_runner.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ void run_state_test(const StateTransitionTest& test, evmc::VM& vm, bool trace_su
2727
const auto tx = test.multi_tx.get(expected.indexes);
2828
auto state = test.pre_state;
2929

30+
const auto start_time = std::chrono::steady_clock::now();
31+
3032
const auto res = state::transition(state, test.block, tx, rev, vm, test.block.gas_limit,
3133
state::BlockInfo::MAX_BLOB_GAS_PER_BLOCK);
3234

35+
const auto exec_duration = std::chrono::steady_clock::now() - start_time;
36+
3337
// Finalize block with reward 0.
3438
state::finalize(state, rev, test.block.coinbase, 0, {}, {});
3539

@@ -46,8 +50,22 @@ void run_state_test(const StateTransitionTest& test, evmc::VM& vm, bool trace_su
4650
else
4751
std::clog << R"("pass":false,"error":")" << r.status << '"';
4852
std::clog << R"(,"gasUsed":"0x)" << std::hex << r.gas_used << R"(",)";
53+
54+
if (r.status == EVMC_SUCCESS)
55+
{
56+
std::clog << "LOGS:\n";
57+
for (const auto& log : r.logs)
58+
{
59+
std::clog << log.addr << ": " << hex(log.data) << "\n";
60+
}
61+
}
4962
}
5063
std::clog << R"("stateRoot":"0x)" << hex(state_root) << "\"}\n";
64+
65+
std::clog
66+
<< "time: " << std::dec
67+
<< std::chrono::duration_cast<std::chrono::microseconds>(exec_duration).count()
68+
<< "us\n";
5169
}
5270

5371
if (expected.exception)

0 commit comments

Comments
 (0)