Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EXPERIMENTAL revision #728

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the number is going to change with every added revision? Then if somebody has this hardcoded, e.g. in the command line to evmc-tool, it will break... Maybe not a huge concern.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in many places we use the fact that we have loop over revisions... I think it would be nice to have something like 100+, but I'm not sure I have time to investigate it right now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess it's mostly in tests, and it's not clear whether we would or would not want to include Experimental revision in them. Maybe rather we do want that, because experimental EVMs shouldn't break any existing functionality.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe if we put the EXPERIMENTAL outside of the MAX this would work somehow... but let's see first how this version works.


/** 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