ewasm / design

Ewasm Design Overview and Specification
Apache License 2.0
1.02k stars 125 forks source link

Separate init and deployment code #174

Open chfast opened 5 years ago

chfast commented 5 years ago

Instead of having single init code that outputs the deployment code change the process of creating new contract accounts as follows:

  1. The "create" message contains the "contract code" which is going to be deployed in the newly created account.
  2. The "create" message optionally has the "init code" which is executed by the VM once and then disposed.

Small details to figure out

  1. Is the "contract code" already deployed when "init code" runs?
  2. When calling itself from "init code" should the "contract code" be executable?

Pros

  1. Much less confusing for dapp devs and users than the current system.
  2. The contract code has to be metered ones (?).
  3. Because the init code is ephemeral, we can make it execution multiple times more expensive to allow to be always executed in interpreters.

Cons

  1. The EVM1 system is more generic (you can do more with it than with the init + contract code).
axic commented 5 years ago

For context, this was discussed between the ewasm and research team as well as it was one of the options before the launch of original Eth 1.0.

chfast commented 5 years ago

For context, this was discussed between the ewasm and research team as well as it was one of the options before the launch of original Eth 1.0.

Yes, this is a consequence of this discussion.