Skip to content

Commit

Permalink
DUPN and SWAPN back in Cancun
Browse files Browse the repository at this point in the history
  • Loading branch information
rodiazet committed Nov 25, 2022
1 parent 69120d3 commit c32bc79
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
4 changes: 2 additions & 2 deletions lib/instructions/instruction_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@ static struct evmc_instruction_metrics shanghai_metrics[256] = {
/* = 0xaf */ {UNDEFINED, 0, 0},
/* = 0xb0 */ {UNDEFINED, 0, 0},
/* = 0xb1 */ {UNDEFINED, 0, 0},
/* DUPN = 0xb2 */ {VERYLOW, 0, 1},
/* SWAPN = 0xb3 */ {VERYLOW, 0, 0},
/* = 0xb2 */ {UNDEFINED, 0, 0},
/* = 0xb3 */ {UNDEFINED, 0, 0},
/* = 0xb4 */ {UNDEFINED, 0, 0},
/* = 0xb5 */ {UNDEFINED, 0, 0},
/* = 0xb6 */ {UNDEFINED, 0, 0},
Expand Down
4 changes: 2 additions & 2 deletions lib/instructions/instruction_names.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ static const char* shanghai_names[256] = {
/* 0xaf */ NULL,
/* 0xb0 */ NULL,
/* 0xb1 */ NULL,
/* 0xb2 */ "DUPN",
/* 0xb3 */ "SWAPN",
/* 0xb2 */ NULL,
/* 0xb3 */ NULL,
/* 0xb4 */ NULL,
/* 0xb5 */ NULL,
/* 0xb6 */ NULL,
Expand Down
20 changes: 0 additions & 20 deletions test/unittests/instructions_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,6 @@ TEST(instructions, shanghai_hard_fork)
{
if (op == OP_PUSH0)
continue;
if (op == OP_DUPN)
continue;
if (op == OP_SWAPN)
continue;
EXPECT_EQ(s[op], p[op]) << op;
EXPECT_STREQ(sn[op], pn[op]) << op;
}
Expand All @@ -397,20 +393,4 @@ TEST(instructions, shanghai_hard_fork)
EXPECT_EQ(p[OP_PUSH0].gas_cost, 0);
EXPECT_EQ(sn[OP_PUSH0], std::string{"PUSH0"});
EXPECT_TRUE(pn[OP_PUSH0] == nullptr);

// EIP-663: DUPN instruction
EXPECT_EQ(s[OP_DUPN].gas_cost, 3);
EXPECT_EQ(s[OP_DUPN].stack_height_required, 0);
EXPECT_EQ(s[OP_DUPN].stack_height_change, 1);
EXPECT_EQ(p[OP_DUPN].gas_cost, 0);
EXPECT_EQ(sn[OP_DUPN], std::string{"DUPN"});
EXPECT_TRUE(pn[OP_DUPN] == nullptr);

// EIP-663: SWAPN instruction
EXPECT_EQ(s[OP_SWAPN].gas_cost, 3);
EXPECT_EQ(s[OP_SWAPN].stack_height_required, 0);
EXPECT_EQ(s[OP_SWAPN].stack_height_change, 0);
EXPECT_EQ(p[OP_SWAPN].gas_cost, 0);
EXPECT_EQ(sn[OP_SWAPN], std::string{"SWAPN"});
EXPECT_TRUE(pn[OP_SWAPN] == nullptr);
}

0 comments on commit c32bc79

Please sign in to comment.