srml-contracts: Contract calls/instantiations to return exit statuses (#3320)

* srml-contracts: Rename ext_scratch_copy to ext_scratch_read.

This is to disambiguate from the next ext_scratch_write function.

* Remove unnecessary OutputBuf and EmptyOutputBuf.

* Replace VmExecError with a result type of custom structs.

* Do not drop the scratch buffer on traps and regular returns.

This just reduces the number of allocations required during nested
contract calls and instantiations.

* Semantics for returning a status code and data from contract calls.

* Remove CallReceipt and InstantiateReceipt.

With forthcoming changes to return data from instantiate calls, the two
types of receipts become very similar to each other and to
ExecReturnValue. Instead, replace them with ExecReturnValue and
a regular 2-tuple in the case of instantiation.

* Modify contract function signatures to allow returning status codes.

* Introduce ext_sandbox_write runtime function.

* Test all the things.

* Bump node runtime spec version.

* Style fixes.
This commit is contained in:
Jim Posen
2019-08-12 16:16:30 +02:00
committed by Gavin Wood
parent bf32626373
commit 36abb128f5
10 changed files with 1111 additions and 524 deletions
+9 -1
View File
@@ -371,7 +371,7 @@ This function returns the size of the scratch buffer.
**complexity**: This function is of constant complexity.
## ext_scratch_copy
## ext_scratch_read
This function copies slice of data from the scratch buffer to the sandbox memory. The calling code specifies the slice length. Execution of the function consists of the following steps:
@@ -379,6 +379,14 @@ This function copies slice of data from the scratch buffer to the sandbox memory
**complexity**: The computing complexity of this function is proportional to the length of the slice. No additional memory is required.
## ext_scratch_write
This function copies slice of data from the sandbox memory to the scratch buffer. The calling code specifies the slice length. Execution of the function consists of the following steps:
1. Loading a slice from the sandbox memory into the (see sandboxing memory get)
**complexity**: Complexity is proportional to the length of the slice.
## ext_set_rent_allowance
This function receives the following argument: