mirror of https://github.com/status-im/evmc.git
instructions: add SELFBALANCE from EIP-1884
This commit is contained in:
parent
d2621264fd
commit
3e9e76d5d6
|
@ -79,6 +79,7 @@ enum evmc_opcode
|
|||
OP_DIFFICULTY = 0x44,
|
||||
OP_GASLIMIT = 0x45,
|
||||
OP_CHAINID = 0x46,
|
||||
OP_SELFBALANCE = 0x47,
|
||||
|
||||
OP_POP = 0x50,
|
||||
OP_MLOAD = 0x51,
|
||||
|
|
|
@ -93,7 +93,7 @@ static struct evmc_instruction_metrics istanbul_metrics[256] = {
|
|||
/* DIFFICULTY = 0x44 */ {BASE, 0, 1},
|
||||
/* GASLIMIT = 0x45 */ {BASE, 0, 1},
|
||||
/* CHAINID = 0x46 */ {BASE, 0, 1},
|
||||
/* = 0x47 */ {UNDEFINED, 0, 0},
|
||||
/* SELFBALANCE = 0x47 */ {LOW, 0, 1},
|
||||
/* = 0x48 */ {UNDEFINED, 0, 0},
|
||||
/* = 0x49 */ {UNDEFINED, 0, 0},
|
||||
/* = 0x4a */ {UNDEFINED, 0, 0},
|
||||
|
|
|
@ -77,7 +77,7 @@ static const char* istanbul_names[256] = {
|
|||
/* 0x44 */ "DIFFICULTY",
|
||||
/* 0x45 */ "GASLIMIT",
|
||||
/* 0x46 */ "CHAINID",
|
||||
/* 0x47 */ NULL,
|
||||
/* 0x47 */ "SELFBALANCE",
|
||||
/* 0x48 */ NULL,
|
||||
/* 0x49 */ NULL,
|
||||
/* 0x4a */ NULL,
|
||||
|
|
|
@ -254,6 +254,7 @@ TEST(instructions, istanbul_hard_fork)
|
|||
switch (op)
|
||||
{
|
||||
case OP_CHAINID:
|
||||
case OP_SELFBALANCE:
|
||||
continue;
|
||||
default:
|
||||
EXPECT_EQ(i[op], p[op]) << op;
|
||||
|
@ -268,6 +269,13 @@ TEST(instructions, istanbul_hard_fork)
|
|||
EXPECT_EQ(p[OP_CHAINID].gas_cost, -1);
|
||||
EXPECT_EQ(in[OP_CHAINID], std::string{"CHAINID"});
|
||||
EXPECT_TRUE(pn[OP_CHAINID] == nullptr);
|
||||
|
||||
EXPECT_EQ(i[OP_SELFBALANCE].gas_cost, 5);
|
||||
EXPECT_EQ(i[OP_SELFBALANCE].num_stack_arguments, 0);
|
||||
EXPECT_EQ(i[OP_SELFBALANCE].num_stack_returned_items, 1);
|
||||
EXPECT_EQ(p[OP_SELFBALANCE].gas_cost, -1);
|
||||
EXPECT_EQ(in[OP_SELFBALANCE], std::string{"SELFBALANCE"});
|
||||
EXPECT_TRUE(pn[OP_SELFBALANCE] == nullptr);
|
||||
}
|
||||
|
||||
TEST(instructions, berlin_hard_fork)
|
||||
|
|
Loading…
Reference in New Issue