-
Notifications
You must be signed in to change notification settings - Fork 127
Add eWASM Contract Interface specification #29
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# eWASM Contract Interface (ECI) Specification; Version 0 | ||
|
||
The eWASM Contract Interface (ECI) specifies the structure of a contract module. | ||
|
||
### Wire format | ||
|
||
Every contract must be stored in the [WebAssembly Binary Encoding](https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md) format (in short, WASM bytecode). | ||
|
||
### Imports | ||
|
||
A contract can only import symbols specified in the [Ethereum Environment Interface](./eth_interface.md). | ||
|
||
### Exports | ||
|
||
A contract must have exactly two exported symbols: | ||
- `memory`: the shared memory space available for the EEI to write into. | ||
- `main`: a function with no parameters and no result value. | ||
|
||
### Entry point | ||
|
||
The method exported as `main` will be executed by the VM. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This functionality could be replaces with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
|
||
|
||
### Debug-mode | ||
|
||
Debug-mode is a special VM option, where an additional set of debugging interfaces are available to contracts. On a live VM, any bytecode trying to import these | ||
symbols should be rejected. | ||
|
||
The imports are available under the `debug` namespace: | ||
- `print(i32 offset, i32 length)`: print a string as pointed by `offset` | ||
- `printHex(i32 offset, i32 length)`: print a hex representation of the memory pointed to by `offset` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be optional and we could assume that kernel will also just have access to memory. Currently we also export the memory becuase there is no other way to accesses it. But according to JSapi we should be able to create a wasm instance with memory externally defined (i think).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The memory supplied to instantiate will be copied over to the instance memory. It is not a pointer as far as I see.