Skip to content

Commit 72a0c80

Browse files
committed
evmmax: Set PUSH opcodes gas cost to 1.
1 parent e95bd52 commit 72a0c80

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Diff for: lib/evmone/instructions_traits.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ constexpr inline GasCostTable gas_costs = []() noexcept {
196196

197197
table[EVMC_EXPERIMENTAL] = table[EVMC_OSAKA];
198198

199+
for (auto op = size_t{OP_PUSH1}; op <= OP_PUSH32; ++op)
200+
table[EVMC_EXPERIMENTAL][op] = 1;
201+
199202
table[EVMC_EVMMAX][OP_SETUPX] = 1;
200203
table[EVMC_EVMMAX][OP_ADDMODX] = 0;
201204
table[EVMC_EVMMAX][OP_SUBMODX] = 0;

Diff for: test/unittests/instructions_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static_assert(validate_traits(std::make_index_sequence<256>{}));
9999
// Check some cases for has_const_gas_cost().
100100
static_assert(instr::has_const_gas_cost(OP_STOP));
101101
static_assert(instr::has_const_gas_cost(OP_ADD));
102-
static_assert(instr::has_const_gas_cost(OP_PUSH1));
102+
// static_assert(instr::has_const_gas_cost(OP_PUSH1));
103103
static_assert(!instr::has_const_gas_cost(OP_SHL));
104104
static_assert(!instr::has_const_gas_cost(OP_BALANCE));
105105
static_assert(!instr::has_const_gas_cost(OP_SLOAD));

0 commit comments

Comments
 (0)