Skip to content

Commit

Permalink
Add cas cost for posh0, shr and missed log1 instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
akokoshn authored and akokoshn committed Aug 13, 2024
1 parent d2b4bb1 commit 1506df3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/assigner/evmone/instructions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,10 @@ struct instructions {
state.rw_trace.push_back(stack_operation<BlueprintFieldType>(state.call_id, (uint16_t)(stack.size(state.stack_space.bottom()) - addr), state.rw_trace.size(), true, stack[addr - 1]));
}

static void log(StackTop<BlueprintFieldType> /*stack*/, ExecutionState<BlueprintFieldType>& /*state*/) noexcept {
// do nothing
}

static code_iterator dupn(StackTop<BlueprintFieldType> stack, ExecutionState<BlueprintFieldType>& state, code_iterator pos) noexcept
{
const uint16_t n = pos[1] + 1;
Expand Down
3 changes: 3 additions & 0 deletions lib/assigner/evmone/instructions_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ constexpr inline GasCostTable gas_costs = []() noexcept {
table[EVMC_FRONTIER][OP_MSIZE] = 2;
table[EVMC_FRONTIER][OP_GAS] = 2;
table[EVMC_FRONTIER][OP_JUMPDEST] = 1;
table[EVMC_FRONTIER][OP_SHR] = 3;
table[EVMC_FRONTIER][OP_PUSH0] = 2;
for (auto op = size_t{OP_PUSH1}; op <= OP_PUSH32; ++op)
table[EVMC_FRONTIER][op] = 3;
for (auto op = size_t{OP_DUP1}; op <= OP_DUP16; ++op)
Expand All @@ -116,6 +118,7 @@ constexpr inline GasCostTable gas_costs = []() noexcept {
table[EVMC_FRONTIER][OP_RETURN] = 0;
table[EVMC_FRONTIER][OP_INVALID] = 0;
table[EVMC_FRONTIER][OP_SELFDESTRUCT] = 0;
table[EVMC_FRONTIER][OP_LOG1] = 0;

table[EVMC_HOMESTEAD] = table[EVMC_FRONTIER];
table[EVMC_HOMESTEAD][OP_DELEGATECALL] = 40;
Expand Down
1 change: 1 addition & 0 deletions lib/assigner/evmone/instructions_xmacro.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
\
ON_OPCODE_IDENTIFIER(OP_SWAP, instructions<BlueprintFieldType>::template swap<0>) \
ON_OPCODE_IDENTIFIER(OP_DUP, instructions<BlueprintFieldType>::template dup<0>) \
ON_OPCODE_IDENTIFIER(OP_LOG1, instructions<BlueprintFieldType>::log) \
ON_OPCODE_UNDEFINED(0xa8) \
ON_OPCODE_UNDEFINED(0xa9) \
ON_OPCODE_UNDEFINED(0xaa) \
Expand Down

0 comments on commit 1506df3

Please sign in to comment.