Skip to content

Commit ca95f71

Browse files
committed
Apply minimal changes to run bls bench state tests
1 parent 8e4a055 commit ca95f71

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

test/bench/bench.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@ std::vector<BenchmarkCase::Input> load_inputs(const StateTransitionTest& state_t
5050
std::vector<BenchmarkCase::Input> inputs;
5151
inputs.reserve(state_test.multi_tx.inputs.size());
5252
for (size_t i = 0; i < state_test.multi_tx.inputs.size(); ++i)
53-
inputs.emplace_back(state_test.input_labels.at(i), state_test.multi_tx.inputs[i]);
53+
{
54+
const auto it = state_test.input_labels.find(i);
55+
if (it != state_test.input_labels.end())
56+
inputs.emplace_back(it->second, state_test.multi_tx.inputs[i]);
57+
else
58+
inputs.emplace_back(std::to_string(i), state_test.multi_tx.inputs[i]);
59+
}
60+
5461
return inputs;
5562
}
5663

test/bench/helpers.hpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// SPDX-License-Identifier: Apache-2.0
44
#pragma once
55

6+
#include "test/state/host.hpp"
67
#include "test/utils/utils.hpp"
78
#include <benchmark/benchmark.h>
89
#include <evmc/evmc.hpp>
@@ -17,7 +18,7 @@ namespace evmone::test
1718
{
1819
extern std::map<std::string_view, evmc::VM> registered_vms;
1920

20-
constexpr auto default_revision = EVMC_ISTANBUL;
21+
constexpr auto default_revision = EVMC_PRAGUE;
2122
constexpr auto default_gas_limit = std::numeric_limits<int64_t>::max();
2223

2324

@@ -102,7 +103,10 @@ inline void bench_execute(benchmark::State& state, evmc::VM& vm, bytes_view code
102103
constexpr auto gas_limit = default_gas_limit;
103104

104105
const auto analysis = analyse_fn(rev, code);
105-
evmc::MockedHost host;
106+
state::State ss;
107+
state::BlockInfo blockInfo = {.gas_limit = gas_limit};
108+
state::Transaction tx = {.gas_limit = gas_limit};
109+
state::Host host{rev, vm, ss, blockInfo, tx};
106110
ExecutionStateT exec_state;
107111
evmc_message msg{};
108112
msg.kind = EVMC_CALL;

0 commit comments

Comments
 (0)