Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cas cost for posh0, shr and log1 #31

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading