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
U256to representvalue, whereas ewasm usesu128, - pwasm's
gasexpects i32 arguments, whereas ewasm'suseGasuses i64, - pwasm's
blockhashmight return error (according to signature), ewasm's not. - at the moment, there is no way to limit amount of gas transfered into a
callin pwasm, but it is planned to fix this, - pwasm's
callreturns-1to denote error state, - pwasm's
logacceptstopic_countand pointer to array of the topic values, whereas ewasm'slogtakes pointers to eachtopic's value separately. - pwasm's
gaslimitreturnsU256, whereas ewasm uses i64,
few notes
it's not intentionally, will be fixed
U256 to be exact