pub struct HostCall { /* private fields */ }Expand description
Host call request from plugin
Corresponds to Lean: structure HostCall
Implementations§
Source§impl HostCall
impl HostCall
Sourcepub fn new(
caller: PluginId,
function: HostFunction,
args: Vec<u64>,
reads: Vec<(MemAddr, Size)>,
writes: Vec<(MemAddr, Size)>,
) -> Self
pub fn new( caller: PluginId, function: HostFunction, args: Vec<u64>, reads: Vec<(MemAddr, Size)>, writes: Vec<(MemAddr, Size)>, ) -> Self
Create a new host call
Sourcepub fn function(&self) -> HostFunction
pub fn function(&self) -> HostFunction
Get the host function to invoke
Sourcepub fn required_action(&self) -> Result<Action, StepError>
pub fn required_action(&self) -> Result<Action, StepError>
Derive the required authorization action from the host call semantics.
This binds authorization to the exact operation being performed,
preventing the vulnerability where a valid Authorized token for one
action could be reused to execute a different HostCall.
§Errors
Returns StepError::HostCallPreconditionFailed if required arguments are missing
or the operation is not yet implemented (thread operations).
Sourcepub fn check_preconditions(&self, state: &State) -> Result<(), StepError>
pub fn check_preconditions(&self, state: &State) -> Result<(), StepError>
Check preconditions for the host call
Corresponds to Lean: def host_call_pre
§Errors
Returns StepError::PluginNotFound if the caller plugin does not exist.
Returns StepError::HostCallPreconditionFailed if a read or write region is out of bounds.