Skip to content

EVM Version Identifier #154

@chriseth

Description

@chriseth

A version identifier or EVM identifier should be added to the code of each contract to facilitate virtual machine upgrades and allow different virtual machines.

With upcoming breaking changes to the functionality of the EVM, it makes sense to add a field that represents the version or type of EVM that should run the given code. This would allow to introduce breaking feature changes without harming older contracts (breaking security changes like #150 would of course also affect older contracts). This is especially useful if we want to change the EVM due to performance reasons and could allow changing the gas costs of individual opcodes (because they can be implemented faster in that particular EVM) and even introducing whole new features of the EVM (like ewasm).

Any time code is loaded and run (i.e. at a call, create or beginning of a transaction), the EVM version number is extracted from the code or that account and the relevant VM is started. If the EVM is not know, this results in an OOG exception.

Drawbacks of this proposal are that we have to support older versions of the EVM, although this is a choice that is made during a hard fork: We can chose to drop older versions and handle that in the same way as it was done previously: Either compile old code to new code or just force the new rules on the old system.

Implementation details:

If the code starts with 0xef, the byte (ewasm uses four bytes) that follows this is the version number, both are ignored when executing the code. If it does not start with 0xef, use the homestead VM, which is version number 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions