Skip to content

Commit 1fb8241

Browse files
authored
Merge pull request #114 from jakelang/startfn-notes
Add an extra note about EEI imports and disallowing a start function
2 parents f94248e + 6a96e46 commit 1fb8241

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

contract_interface.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ Every contract must be stored in the [WebAssembly Binary Encoding](https://githu
88

99
### Imports
1010

11-
A contract can only import symbols specified in the [Ethereum Environment Interface](./eth_interface.md).
11+
A contract can only import symbols specified in the [Ethereum Environment Interface or EEI](./eth_interface.md).
12+
13+
In practice, this means that all imports specified by an eWASM module must be from the `ethereum` namespace,
14+
and having a function signature and name directly correspondent to a function specified in the EEI.
1215

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

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

4043
If it needs to abort due to a failure, an *unreachable* instruction should be executed.
44+
45+
### Start function
46+
47+
The use of a [start function](https://webassembly.github.io/spec/core/syntax/modules.html#start-function) is disallowed.
48+
49+
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.
50+
In the [WebAssembly Javascript API](https://webassembly.org/docs/js/) however the start function is executed right during instantiation, which
51+
leaves no time for the client to acquire the memory area.
52+
53+
*Note:* This decision was made on WebAssembly version 0xb (pre version 1) and should be revisited.

0 commit comments

Comments
 (0)