sigil-node · host_backend
Source declarations, signatures and documentation for host_backend.
Source: sigil/node/sigil-node/src/host_backend.rs. SHA-256: da16072dc665dcfde19acd7f02ff72bd9f999a00b52063082521b474e5ca38af.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
Module condition:
#[cfg(feature = "wasm")]host_backend::ChainHostBackend
Per-call backend. Borrows the chain state, snapshots the contract
record, and stages all mutations in an in-memory overlay until the
executor either commit()s the call or drops the backend (trap
rollback).
#[cfg(feature = "wasm")]
pub struct ChainHostBackend<'a> {
}Source line: 40.
host_backend::ChainHostBackend<'a>::new
#[cfg(feature = "wasm")]
pub fn new(
state: &'a dyn ExecutionState,
record: ContractRecord,
caller_did: impl Into<String>,
) -> Self;Source line: 72.
host_backend::ChainHostBackend<'a>::with_declared_access
Attach the transaction's declared read/write sets. Contract-local reads
must be present in reads or writes; contract-local writes and
external host effects must be present in writes.
#[cfg(feature = "wasm")]
pub fn with_declared_access(mut self, reads: &[StateAccess], writes: &[StateAccess]) -> Self;Source line: 100.
host_backend::ChainHostBackend<'a>::with_declared_writes
Attach the transaction's declared write set. Host functions with side effects outside the contract-local overlay reject undeclared writes before staging any mutation.
#[cfg(feature = "wasm")]
pub fn with_declared_writes(mut self, writes: &[StateAccess]) -> Self;Source line: 109.
host_backend::ChainHostBackend<'a>::dry_run
Construct a dry-run backend. commit() becomes a no-op so any
staged mutations are discarded by the caller's drop.
#[cfg(feature = "wasm")]
pub fn dry_run(
state: &'a dyn ExecutionState,
record: ContractRecord,
caller_did: impl Into<String>,
) -> Self;Source line: 116.
host_backend::ChainHostBackend<'a>::commit
Flush staged mutations to the underlying ExecutionState. The
executor calls this only on a successful WASM invocation.
#[cfg(feature = "wasm")]
pub fn commit(self) -> Result<(), HostError>;Source line: 128.
host_backend::ChainHostBackend<'a>::record
Used by the executor after a successful run to compute the post-call state-root from the merged base + overlay view.
#[cfg(feature = "wasm")]
pub fn record(&self) -> &ContractRecord;Source line: 215.