Expand description
This module defines the low-level syscall API.
§Wasm Syscall ABI
Here we specify how the syscalls specified in this module map to Wasm. For more information on the FVM syscall ABI, read the syscall ABI spec.
By return type, there are three “kinds” of syscalls:
- Syscalls that do not return (return
!
). - Syscalls that do not return a value (return
Result<()>
). - Syscalls that return a value (return
Result<T>
).
Syscalls may also “return” values by writing them to out-pointers passed into the syscall by the caller, but this is documented on a syscall-by-syscall basis.
§Kind 1: Divergent
Syscalls that return !
(e.g. [vm::abort
]) have the signature:
(func $name (param ...) ... (result i32))
result
is unused because the syscall never returns.
§Kind 2: Empty Return
Syscalls that return Result<()>
(nothing) have the signature:
(func $name (param ...) ... (result i32))
Here, result
is an ErrorNumber
or 0
on success.
§Kind 3: Non-Empty Return
Syscalls that return Result<T>
where T
is a non-empty sized value have the signature:
(func $name (param $ret_ptr) (param ...) ... (result i32))
Here:
result
is anErrorNumber
or0
on success.ret_ptr
is the offset (specified by the caller) where the FVM will write the return value if, and only if the result is0
(success).
Modules§
- Syscalls for creating and resolving actors.
- Syscalls for cryptographic operations.
- Syscalls for debugging.
- Syscalls related to eventing.
- Syscalls for working with gas.
- Syscalls for manipulating IPLD state.
- Syscalls for network metadata.
- Syscalls for getting randomness.
- Syscalls for sending messages to other actors.
- Syscalls for querying and modifying the current actor.
- Syscalls for interacting with the VM.
Macros§
- Generate a set of FVM syscall shims.
Structs§
- The token amount type used in syscalls. It can represent any token amount (in atto-FIL) from 0 to
2^128-1
attoFIL. Or 0 to about 340 exaFIL.
Enums§
- When a syscall fails, it returns an
ErrorNumber
to indicate why. The syscalls themselves include documentation on which syscall errors they can be expected to return, and what they mean in the context of the syscall.