Skip to content

Commit

Permalink
Rename Merge revision to Paris
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Mar 16, 2022
1 parent 472c188 commit 1efdfeb
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions bindings/go/evmc/evmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const (
Istanbul Revision = C.EVMC_ISTANBUL
Berlin Revision = C.EVMC_BERLIN
London Revision = C.EVMC_LONDON
Paris Revision = C.EVMC_PARIS
Shanghai Revision = C.EVMC_SHANGHAI
MaxRevision Revision = C.EVMC_MAX_REVISION
LatestStableRevision Revision = C.EVMC_LATEST_STABLE_REVISION
Expand Down
6 changes: 3 additions & 3 deletions include/evmc/evmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -880,11 +880,11 @@ enum evmc_revision
EVMC_LONDON = 9,

/**
* The Merge revision.
* The Paris revision (aka The Merge).
*
* https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/merge.md
* https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md
*/
EVMC_MERGE = 10,
EVMC_PARIS = 10,

/**
* The Shanghai revision.
Expand Down
4 changes: 2 additions & 2 deletions include/evmc/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ static inline const char* evmc_revision_to_string(enum evmc_revision rev)
return "Berlin";
case EVMC_LONDON:
return "London";
case EVMC_MERGE:
return "Merge";
case EVMC_PARIS:
return "Paris";
case EVMC_SHANGHAI:
return "Shanghai";
}
Expand Down
2 changes: 1 addition & 1 deletion lib/instructions/instruction_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -2369,7 +2369,7 @@ const struct evmc_instruction_metrics* evmc_get_instruction_metrics_table(
{
case EVMC_SHANGHAI:
return shanghai_metrics;
case EVMC_MERGE:
case EVMC_PARIS:
case EVMC_LONDON:
return london_metrics;
case EVMC_BERLIN:
Expand Down
2 changes: 1 addition & 1 deletion lib/instructions/instruction_names.c
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,7 @@ const char* const* evmc_get_instruction_names_table(enum evmc_revision revision)
{
case EVMC_SHANGHAI:
return shanghai_names;
case EVMC_MERGE:
case EVMC_PARIS:
case EVMC_LONDON:
return london_names;
case EVMC_BERLIN:
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/cpp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ TEST(cpp, revision_to_string)
TEST_CASE(EVMC_ISTANBUL),
TEST_CASE(EVMC_BERLIN),
TEST_CASE(EVMC_LONDON),
TEST_CASE(EVMC_MERGE),
TEST_CASE(EVMC_PARIS),
TEST_CASE(EVMC_SHANGHAI),
};
#undef TEST_CASE
Expand Down
20 changes: 10 additions & 10 deletions test/unittests/instructions_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,38 +354,38 @@ TEST(instructions, london_hard_fork)

TEST(instructions, merge_hard_fork)
{
const auto m = evmc_get_instruction_metrics_table(EVMC_MERGE);
const auto p = evmc_get_instruction_metrics_table(EVMC_PARIS);
const auto l = evmc_get_instruction_metrics_table(EVMC_LONDON);
const auto mn = evmc_get_instruction_names_table(EVMC_MERGE);
const auto pn = evmc_get_instruction_names_table(EVMC_PARIS);
const auto ln = evmc_get_instruction_names_table(EVMC_LONDON);

for (int op = 0x00; op <= 0xff; ++op)
{
EXPECT_EQ(m[op], l[op]) << op;
EXPECT_STREQ(mn[op], ln[op]) << op;
EXPECT_EQ(p[op], l[op]) << op;
EXPECT_STREQ(pn[op], ln[op]) << op;
}
}

TEST(instructions, shanghai_hard_fork)
{
const auto s = evmc_get_instruction_metrics_table(EVMC_SHANGHAI);
const auto m = evmc_get_instruction_metrics_table(EVMC_MERGE);
const auto p = evmc_get_instruction_metrics_table(EVMC_PARIS);
const auto sn = evmc_get_instruction_names_table(EVMC_SHANGHAI);
const auto mn = evmc_get_instruction_names_table(EVMC_MERGE);
const auto pn = evmc_get_instruction_names_table(EVMC_PARIS);

for (int op = 0x00; op <= 0xff; ++op)
{
if (op == OP_PUSH0)
continue;
EXPECT_EQ(s[op], m[op]) << op;
EXPECT_STREQ(sn[op], mn[op]) << op;
EXPECT_EQ(s[op], p[op]) << op;
EXPECT_STREQ(sn[op], pn[op]) << op;
}

// EIP-3855: PUSH0 instruction
EXPECT_EQ(s[OP_PUSH0].gas_cost, 2);
EXPECT_EQ(s[OP_PUSH0].stack_height_required, 0);
EXPECT_EQ(s[OP_PUSH0].stack_height_change, 1);
EXPECT_EQ(m[OP_PUSH0].gas_cost, 0);
EXPECT_EQ(p[OP_PUSH0].gas_cost, 0);
EXPECT_EQ(sn[OP_PUSH0], std::string{"PUSH0"});
EXPECT_TRUE(mn[OP_PUSH0] == nullptr);
EXPECT_TRUE(pn[OP_PUSH0] == nullptr);
}

0 comments on commit 1efdfeb

Please sign in to comment.