Skip to content

Commit

Permalink
Add EXPERIMENTAL revision (#728)
Browse files Browse the repository at this point in the history
Add new `EVMC_EXPERIMENTAL` to `evmc_revision` to allow EVM
implementations to expose experimental features.
  • Loading branch information
chfast authored Feb 7, 2025
1 parent 521e486 commit 0bf52fe
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions bindings/go/evmc/evmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const (
Cancun Revision = C.EVMC_CANCUN
Prague Revision = C.EVMC_PRAGUE
Osaka Revision = C.EVMC_OSAKA
Experimental Revision = C.EVMC_EXPERIMENTAL
MaxRevision Revision = C.EVMC_MAX_REVISION
LatestStableRevision Revision = C.EVMC_LATEST_STABLE_REVISION
)
Expand Down
2 changes: 1 addition & 1 deletion bindings/go/evmc/evmc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestExecuteEmptyCode(t *testing.T) {
}

func TestRevision(t *testing.T) {
if MaxRevision != Osaka {
if MaxRevision != Experimental {
t.Errorf("missing constant for revision %d", MaxRevision)
}
if LatestStableRevision != Cancun {
Expand Down
16 changes: 11 additions & 5 deletions include/evmc/evmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1034,21 +1034,27 @@ enum evmc_revision
EVMC_CANCUN = 12,

/**
* The Prague revision.
* The Prague / Pectra revision.
*
* The future next revision after Cancun.
* https://eips.ethereum.org/EIPS/eip-7600
*/
EVMC_PRAGUE = 13,

/**
* The Osaka revision.
* The Osaka / Fusaka revision.
*
* The future next revision after Prague.
* https://eips.ethereum.org/EIPS/eip-7607
*/
EVMC_OSAKA = 14,

/**
* The unspecified EVM revision used for EVM implementations to expose
* experimental features.
*/
EVMC_EXPERIMENTAL = 15,

/** The maximum EVM revision supported. */
EVMC_MAX_REVISION = EVMC_OSAKA,
EVMC_MAX_REVISION = EVMC_EXPERIMENTAL,

/**
* The latest known EVM revision with finalized specification.
Expand Down
2 changes: 2 additions & 0 deletions include/evmc/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ static inline const char* evmc_revision_to_string(enum evmc_revision rev)
return "Prague";
case EVMC_OSAKA:
return "Osaka";
case EVMC_EXPERIMENTAL:
return "Experimental";
}
return "<unknown>";
}
Expand Down
1 change: 1 addition & 0 deletions lib/instructions/instruction_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -3146,6 +3146,7 @@ const struct evmc_instruction_metrics* evmc_get_instruction_metrics_table(
{
switch (revision)
{
case EVMC_EXPERIMENTAL:
case EVMC_OSAKA:
return osaka_metrics;
case EVMC_PRAGUE:
Expand Down
1 change: 1 addition & 0 deletions lib/instructions/instruction_names.c
Original file line number Diff line number Diff line change
Expand Up @@ -2857,6 +2857,7 @@ const char* const* evmc_get_instruction_names_table(enum evmc_revision revision)
{
switch (revision)
{
case EVMC_EXPERIMENTAL:
case EVMC_OSAKA:
return osaka_names;
case EVMC_PRAGUE:
Expand Down
1 change: 1 addition & 0 deletions test/unittests/cpp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@ TEST(cpp, revision_to_string)
TEST_CASE(EVMC_CANCUN),
TEST_CASE(EVMC_PRAGUE),
TEST_CASE(EVMC_OSAKA),
TEST_CASE(EVMC_EXPERIMENTAL),
};
#undef TEST_CASE

Expand Down

0 comments on commit 0bf52fe

Please sign in to comment.