-
Notifications
You must be signed in to change notification settings - Fork 125
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
Use invalid opcode as part of the eWASM magic #39
base: master
Are you sure you want to change the base?
Conversation
@chriseth since you mentioned the requirement for this, can you please explain why we should have it? |
The idea is that multiple versions of evm bytecode can be introduced with limited backwards-compatibility breaks. We can at least be rather sure that no useful existing contract can have the same bytecode (prefix) as an ewasm contract. |
Currently all wasm binaries a prefixed with 0x00, which is stop. Wouldn't that eliminate all useful contracts? |
This aims for a general standard to select the proper VM for a given bytecode, without having to add metadata to an account. Since we do not have a VM identifier for EVM1, anything is valid EVM1. In order to avoid cases where an existing contract written for EVM1 is mistaken for eWASM bytecode which would change its semantics, I would propose to take a first byte that cannot be the start of a contract that is in use, and I think |
right, so if we go that route we probably should drop the wasm magic number 0x00, 0x61, 0x73, 0x6d and replace it with just a single |
No, I still think that a kind of version number of VM identifier should follow the |
0x00, 0x61, 0x73, 0x6d ("0asm") is wasm identifier, it is followed the version number (0x01). So if we replaced the identifier then we would still have the version number to go off of for future upgrades |
I would argue this is not needed, because wasm cannot be introduced without the client knowing about it, and if it does, it can easily detect the "wasm magic" as a pattern. |
In theory it would be nice for a client to be able to implement some, but not all, VMs and to be able to detect which VM a particular piece of contract bytecode targets, so that it can choose to execute that contract or not -- this wouldn't make sense for main chain but it could make sense for a private network, or maybe for a hypothetical world where different shards run different VMs. It would be nice to maintain optionality. |
Following the discussion: #20 (comment)