EWasm eth interface https://github.com/ewasm/design/blob/master/eth_interface.md
Glosarry:
- pwasm - Parity Wasm
- ewasm - Ethereum Wasm
Notable differences:
In pwasm, runtime prepares the environment, i.e. allocates memory for and copies input data into this memory,
and then calls into _call(*const Descriptor)
function. To return the execution result, contract needs to write result's data
into a location in the memory designated by the Descriptor
.
Descriptor definition looks like this:
struct Descriptor {
args_ptr: *const u8,
args_len: usize,
result_ptr: *const u8,
result_len: usize,
}
pwasm publishes some functions that can be commonly found in the libc
, namely:
malloc
,free
,memcpy
,memmemove
,memset
,
Extracting this functions might improve binary size and performance of a contract.
Also, pwasm provides several functions:
debug
, log message into the console,panic
, traps immediatelly with provided message/payload,
- pwasm's uses
U256
to representvalue
, whereas ewasm usesu128
, - pwasm's
gas
expects i32 arguments, whereas ewasm'suseGas
uses i64, - pwasm's
blockhash
might return error (according to signature), ewasm's not. - at the moment, there is no way to limit amount of gas transfered into a
call
in pwasm, but it is planned to fix this, - pwasm's
call
returns-1
to denote error state, - pwasm's
log
acceptstopic_count
and pointer to array of the topic values, whereas ewasm'slog
takes pointers to eachtopic
's value separately. - pwasm's
gaslimit
returnsU256
, whereas ewasm uses i64,
few notes
it's not intentionally, will be fixed
U256 to be exact