Skip to content

Commit 3c9ea6d

Browse files
committed
Rename sha3() instruction to keccak256()
1 parent 18499f4 commit 3c9ea6d

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

lib/evmone/baseline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ evmc_result baseline_execute(ExecutionState& state, const JumpdestMap& jumpdest_
216216

217217
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/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_KECCAK256] = 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: 5 additions & 5 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,7 +608,7 @@ 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
{
613613
auto code = push(0) + OP_DUP1 + OP_KECCAK256 + ret_top();
614614
execute(code);
@@ -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

test/utils/bytecode.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ 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
{
193193
return size + index + OP_KECCAK256;
194194
}

0 commit comments

Comments
 (0)