simulate_invoke_host_function_op

Function simulate_invoke_host_function_op 

Source
pub fn simulate_invoke_host_function_op(
    snapshot_source: Rc<dyn SnapshotSource>,
    network_config: &NetworkConfig,
    adjustment_config: &SimulationAdjustmentConfig,
    ledger_info: &LedgerInfo,
    host_fn: HostFunction,
    auth_mode: RecordingInvocationAuthMode,
    source_account: &AccountId,
    base_prng_seed: [u8; 32],
    enable_diagnostics: bool,
) -> Result<InvokeHostFunctionSimulationResult>
Expand description

Simulates InvokeHostFunctionOp operation specified via its relevant payload parts.

The operation is defined by the host function itself (host_fn) and auth_mode. In case if auth_mode is None, the simulation will use recording authorization mode and return non-signed recorded authorization entries. Otherwise, the signed entries will be used for authorization and authentication enforcement.

The rest of parameters define the ledger state (snapshot_source, network_config, ledger_info), simulation adjustment configuration (adjustment_config), and transaction execution parameters (source_account, base_prng_seed).

enable_diagnostics enables recording of diagnostic_events in the response.

This function makes the best effort at returning non-Err result even for failed invocations. It should only fail if ledger is mis-configured (e.g. when computed fees cause overflows).