EXTCODEHASH support in instructions lib
MODIFY
include/evmc/instructions.h
include/evmc/instructions.h
@@ -70,6 +70,7 @@ enum evmc_opcode
OP_EXTCODECOPY = 0x3c,
OP_RETURNDATASIZE = 0x3d,
OP_RETURNDATACOPY = 0x3e,
+ OP_EXTCODEHASH = 0x3f,
OP_BLOCKHASH = 0x40,
OP_COINBASE = 0x41,

MODIFY
lib/instructions/instruction_names.c
lib/instructions/instruction_names.c
@@ -69,7 +69,7 @@ static const char* constantinople_names[256] = {
/* 0x3c */ "EXTCODECOPY",
/* 0x3d */ "RETURNDATASIZE",
/* 0x3e */ "RETURNDATACOPY",
- /* 0x3f */ NULL,
+ /* 0x3f */ "EXTCODEHASH",
/* 0x40 */ "BLOCKHASH",
/* 0x41 */ "COINBASE",
/* 0x42 */ "TIMESTAMP",

MODIFY
test/unittests/test_instructions.cpp
test/unittests/test_instructions.cpp
@@ -101,6 +101,13 @@ TEST(instructions, constantinople_hard_fork)
EXPECT_EQ(b[OP_CREATE2].gas_cost, -1);
EXPECT_EQ(cn[OP_CREATE2], std::string{"CREATE2"});
EXPECT_EQ(bn[OP_CREATE2], nullptr);
+
+ EXPECT_EQ(c[OP_EXTCODEHASH].gas_cost, 400);
+ EXPECT_EQ(c[OP_EXTCODEHASH].num_stack_arguments, 1);
+ EXPECT_EQ(c[OP_EXTCODEHASH].num_stack_returned_items, 1);
+ EXPECT_EQ(b[OP_EXTCODEHASH].gas_cost, -1);
+ EXPECT_EQ(cn[OP_EXTCODEHASH], std::string{"EXTCODEHASH"});
+ EXPECT_EQ(bn[OP_EXTCODEHASH], nullptr);
}

EXTCODEHASH support in instructions lib