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

Compiler opton: target EVM version #1117

Closed
axic opened this issue Sep 26, 2016 · 5 comments
Closed

Compiler opton: target EVM version #1117

axic opened this issue Sep 26, 2016 · 5 comments
Assignees

Comments

@axic
Copy link
Member

axic commented Sep 26, 2016

I think we should add an option to select the target EVM version (frontier, homestead, metropolis, etc.)

Maybe this isn't such a big issue anymore for Frontier as everyone moved on to Homestead, but by the time we move on to Metropolis, Homestead will have a much bigger user base.

Key differences:

Alternatively we might put this into a pragma instead of a compiler option.

@axic
Copy link
Member Author

axic commented Oct 4, 2016

Probably we would need both:

  • the actual target version used in the compiler
  • pragma for defining the requirement in a given source code (that covers what inline assembly instructions are valid for that file and what the user expects in terms of gas usage; if the pragma is lacking, it accepts any version defined by the compiler):

pragma evm homestead;
pragma evm metropolis;

Then, we have two options:

  • reject compilation if different evm versions are requested
  • use the highest common denominator (I see this as a no go, as it is hard to decide what changes are compatible)

@axic
Copy link
Member Author

axic commented Nov 16, 2016

I think we should have the following components:

  1. target EVM version as a compiler flag
  2. target gas table (referred to by hardfork names) as a compiler flag
  3. required EVM version as a pragma following semver

EVM versioning is simple if we follow ethereum/EIPs#178 as the current semver handler can be reused:

pragma evm ^1.1; // to select homestead
pragma evm ^2.0; // to select EIP150

@chriseth
Copy link
Contributor

I would say the default should be to target the EVM that is active on the mainnet. Pragmas can revert specific features to older EVM versions.

@axic
Copy link
Member Author

axic commented Feb 13, 2018

Latest discussion have lead to considering pragma target byzantium, but eventually it turned out that due pragma being SourceUnit-local that would cause a headache during inheritance for users.

It seems to be a much better option to have a compiler option instead.

This should be presented to the user as:

  • --evm-version byzantium on the the commandline
  • settings: { evmVersion: "byzantium" } in jsonio

The evm versions are lowercase and we define homestead and byzantium as the two options for now. We default to byzantium.

The evmVersion must also be present in the settings in the metadata.

@chriseth
Copy link
Contributor

Added the "annoys users" label because this makes it impossible to use returndatacopy and others without warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants