Skip to content

Commit

Permalink
Merge pull request #114 from jakelang/startfn-notes
Browse files Browse the repository at this point in the history
Add an extra note about EEI imports and disallowing a start function
  • Loading branch information
axic committed Jul 30, 2018
2 parents f94248e + 6a96e46 commit 1fb8241
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion contract_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ Every contract must be stored in the [WebAssembly Binary Encoding](https://githu

### Imports

A contract can only import symbols specified in the [Ethereum Environment Interface](./eth_interface.md).
A contract can only import symbols specified in the [Ethereum Environment Interface or EEI](./eth_interface.md).

In practice, this means that all imports specified by an eWASM module must be from the `ethereum` namespace,
and having a function signature and name directly correspondent to a function specified in the EEI.

As mentioned below, there is a `debug` namespace as well, but that is disallowed in production systems.

Expand Down Expand Up @@ -38,3 +41,13 @@ The method exported as `main` will be executed by the VM.
On successful execution, the code should return via a normal code path.

If it needs to abort due to a failure, an *unreachable* instruction should be executed.

### Start function

The use of a [start function](https://webassembly.github.io/spec/core/syntax/modules.html#start-function) is disallowed.

The reason for this is that an eWASM VM would need to have access to the memory space of a contract and that must be acquired prior to executing it.
In the [WebAssembly Javascript API](https://webassembly.org/docs/js/) however the start function is executed right during instantiation, which
leaves no time for the client to acquire the memory area.

*Note:* This decision was made on WebAssembly version 0xb (pre version 1) and should be revisited.

0 comments on commit 1fb8241

Please sign in to comment.