Trait sc_executor::sandbox::SandboxCapabilities [−][src]
pub trait SandboxCapabilities: FunctionContext { type SupervisorFuncRef; fn invoke(
&mut self,
dispatch_thunk: &Self::SupervisorFuncRef,
invoke_args_ptr: Pointer<u8>,
invoke_args_len: u32,
state: u32,
func_idx: SupervisorFuncIndex
) -> Result<i64, Error>; }
Expand description
This trait encapsulates sandboxing capabilities.
Note that this functions are only called in the supervisor
context.
Associated Types
Represents a function reference into the supervisor environment.
Required methods
Invoke a function in the supervisor environment.
This first invokes the dispatch_thunk function, passing in the function index of the desired function to call and serialized arguments. The thunk calls the desired function with the deserialized arguments, then serializes the result into memory and returns reference. The pointer to and length of the result in linear memory is encoded into an i64, with the upper 32 bits representing the pointer and the lower 32 bits representing the length.
Errors
Returns Err
if the dispatch_thunk function has an incorrect signature or traps during
execution.