You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contract_interface.md
+15-10
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,21 @@ Every contract must be stored in the [WebAssembly Binary Encoding](https://githu
10
10
11
11
A contract can only import symbols specified in the [Ethereum Environment Interface](./eth_interface.md).
12
12
13
+
As mentioned below, there is a `debug` namespace as well, but that is disallowed in production systems.
14
+
15
+
#### Debug-mode
16
+
17
+
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
18
+
symbols should be rejected.
19
+
20
+
The imports are available under the `debug` namespace:
-`printMemHex(offset: i32, len: i32)` - print memory segment as hex
25
+
-`printStorage(pathOffset: i32)` - print storage value as printable characters
26
+
-`printStorageHex(pathOffset: i32)` - print storage value as hex
27
+
13
28
### Exports
14
29
15
30
A contract must have exactly two exported symbols:
@@ -23,13 +38,3 @@ The method exported as `main` will be executed by the VM.
23
38
On successful execution, the code should return via a normal code path.
24
39
25
40
If it needs to abort due to a failure, an *unreachable* instruction should be executed.
26
-
27
-
### Debug-mode
28
-
29
-
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
30
-
symbols should be rejected.
31
-
32
-
The imports are available under the `debug` namespace:
33
-
-`print(i64)`: print a number
34
-
-`printMem(i32 offset, i32 length)`: print a string as pointed by `offset`
35
-
-`printMemHex(i32 offset, i32 length)`: print a hex representation of the memory pointed to by `offset`
0 commit comments