From c32bc7993599e9ed13c4b8d6c2e6f0559f0468e6 Mon Sep 17 00:00:00 2001 From: rodiazet Date: Fri, 25 Nov 2022 10:58:16 +0100 Subject: [PATCH] DUPN and SWAPN back in Cancun --- lib/instructions/instruction_metrics.c | 4 ++-- lib/instructions/instruction_names.c | 4 ++-- test/unittests/instructions_test.cpp | 20 -------------------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/lib/instructions/instruction_metrics.c b/lib/instructions/instruction_metrics.c index 8edb1f24d..7c1f35137 100644 --- a/lib/instructions/instruction_metrics.c +++ b/lib/instructions/instruction_metrics.c @@ -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}, diff --git a/lib/instructions/instruction_names.c b/lib/instructions/instruction_names.c index b6780c19b..6e21f0af9 100644 --- a/lib/instructions/instruction_names.c +++ b/lib/instructions/instruction_names.c @@ -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, diff --git a/test/unittests/instructions_test.cpp b/test/unittests/instructions_test.cpp index d665c4872..a4216be4c 100644 --- a/test/unittests/instructions_test.cpp +++ b/test/unittests/instructions_test.cpp @@ -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; } @@ -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); }