Skip to content

Commit 0c7f606

Browse files
authored
Merge pull request #309 from ethereum/evmc_upgrade
Upgrade EVMC to 8.0.0
2 parents 3361221 + 3c9ea6d commit 0c7f606

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

evmc

Submodule evmc updated from 56650cd to b1f4f23

lib/evmone/baseline.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ evmc_result baseline_execute(ExecutionState& state, const JumpdestMap& jumpdest_
214214
sar(state.stack);
215215
break;
216216

217-
case OP_SHA3:
217+
case OP_KECCAK256:
218218
{
219-
const auto status_code = sha3(state);
219+
const auto status_code = keccak256(state);
220220
if (status_code != EVMC_SUCCESS)
221221
{
222222
state.status = status_code;

lib/evmone/instruction_traits.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ constexpr inline std::array<Traits, 256> traits = []() noexcept {
6767
table[OP_SHR] = {"SHR", 2, -1};
6868
table[OP_SAR] = {"SAR", 2, -1};
6969

70-
table[OP_SHA3] = {"SHA3", 2, -1};
70+
table[OP_KECCAK256] = {"KECCAK256", 2, -1};
7171

7272
table[OP_ADDRESS] = {"ADDRESS", 0, 1};
7373
table[OP_BALANCE] = {"BALANCE", 1, 0};
@@ -233,7 +233,7 @@ constexpr inline std::array<int16_t, 256> gas_costs<EVMC_FRONTIER> = []() noexce
233233
table[OP_XOR] = 3;
234234
table[OP_NOT] = 3;
235235
table[OP_BYTE] = 3;
236-
table[OP_SHA3] = 30;
236+
table[OP_KECCAK256] = 30;
237237
table[OP_ADDRESS] = 2;
238238
table[OP_BALANCE] = 20;
239239
table[OP_ORIGIN] = 2;

lib/evmone/instructions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ constexpr std::array<instruction_exec_fn, 256> instruction_implementations = [](
227227
table[OP_SHR] = op<shr>;
228228
table[OP_SAR] = op<sar>;
229229

230-
table[OP_SHA3] = op<sha3>;
230+
table[OP_KECCAK256] = op<keccak256>;
231231

232232
table[OP_ADDRESS] = op<address>;
233233
table[OP_BALANCE] = op<balance>;

lib/evmone/instructions.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ inline void sar(evm_stack& stack) noexcept
253253
}
254254

255255

256-
inline evmc_status_code sha3(ExecutionState& state) noexcept
256+
inline evmc_status_code keccak256(ExecutionState& state) noexcept
257257
{
258258
const auto index = state.stack.pop();
259259
auto& size = state.stack.top();

test/unittests/evm_test.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ TEST_P(evm, invalid)
598598
EXPECT_EQ(result.gas_left, 0);
599599
}
600600

601-
TEST_P(evm, sha3)
601+
TEST_P(evm, keccak256)
602602
{
603603
execute("6108006103ff2060005260206000f3");
604604
EXPECT_EQ(result.status_code, EVMC_SUCCESS);
@@ -608,9 +608,9 @@ TEST_P(evm, sha3)
608608
EXPECT_EQ(bytes(&result.output_data[0], 32), hash);
609609
}
610610

611-
TEST_P(evm, sha3_empty)
611+
TEST_P(evm, keccak256_empty)
612612
{
613-
auto code = push(0) + OP_DUP1 + OP_SHA3 + ret_top();
613+
auto code = push(0) + OP_DUP1 + OP_KECCAK256 + ret_top();
614614
execute(code);
615615
ASSERT_EQ(result.output_size, 32);
616616
auto keccak256_empty = "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470";
@@ -820,11 +820,11 @@ TEST_P(evm, mstore8_memory_cost)
820820
EXPECT_EQ(result.status_code, EVMC_OUT_OF_GAS);
821821
}
822822

823-
TEST_P(evm, sha3_memory_cost)
823+
TEST_P(evm, keccak256_memory_cost)
824824
{
825-
execute(45, sha3(0, 1));
825+
execute(45, keccak256(0, 1));
826826
EXPECT_EQ(result.status_code, EVMC_SUCCESS);
827-
execute(44, sha3(0, 1));
827+
execute(44, keccak256(0, 1));
828828
EXPECT_EQ(result.status_code, EVMC_OUT_OF_GAS);
829829
}
830830

@@ -894,7 +894,7 @@ struct memory_access_params
894894
};
895895

896896
memory_access_opcode memory_access_opcodes[] = {
897-
{OP_SHA3, 0, 1},
897+
{OP_KECCAK256, 0, 1},
898898
{OP_CALLDATACOPY, 0, 2},
899899
{OP_CODECOPY, 0, 2},
900900
{OP_MLOAD, 0, -1},

test/utils/bytecode.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ inline bytecode ret(bytecode c)
188188
return c + ret_top();
189189
}
190190

191-
inline bytecode sha3(bytecode index, bytecode size)
191+
inline bytecode keccak256(bytecode index, bytecode size)
192192
{
193-
return size + index + OP_SHA3;
193+
return size + index + OP_KECCAK256;
194194
}
195195

196196
inline bytecode calldataload(bytecode index)

0 commit comments

Comments
 (0)