Skip to content

Commit

Permalink
Merge pull request #634 from ethereum/rev_paris
Browse files Browse the repository at this point in the history
Rename Merge revision to Paris
  • Loading branch information
chfast committed Mar 17, 2022
2 parents 472c188 + 4590949 commit 32b115e
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 21 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ and this project adheres to [Semantic Versioning].
- Information about `PUSH0` instruction from [EIP-3855](https://eips.ethereum.org/EIPS/eip-3855)
for Shanghai revision.
[#628](https://github.com/ethereum/evmc/pull/628)
- The [Merge](https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/merge.md)
EVM revision.
[#627](https://github.com/ethereum/evmc/pull/627)
- The [Paris](https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md)
(aka The Merge) EVM revision.
[#627](https://github.com/ethereum/evmc/pull/627)
[#634](https://github.com/ethereum/evmc/pull/634)
- The error code `EVMC_LOADER_UNSPECIFIED_ERROR` has been defined to provide
a convenient way of initializing `evmc_loader_error_code` objects.
[#617](https://github.com/ethereum/evmc/pull/617)
Expand Down
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 32b115e

Please sign in to comment.