Trait forest_filecoin::shim::fvm_latest::kernel::prelude::Kernel

source ·
pub trait Kernel: SyscallHandler<Self> + 'static {
    type CallManager: CallManager;
    type Limiter: MemoryLimiter;

    // Required methods
    fn into_inner(self) -> (Self::CallManager, BlockRegistry)
       where Self: Sized;
    fn new(
        mgr: Self::CallManager,
        blocks: BlockRegistry,
        caller: u64,
        actor_id: u64,
        method: u64,
        value_received: TokenAmount,
        read_only: bool,
    ) -> Self
       where Self: Sized;
    fn machine(&self) -> &<Self::CallManager as CallManager>::Machine;
    fn limiter_mut(&mut self) -> &mut Self::Limiter;
    fn gas_available(&self) -> Gas;
    fn charge_gas(
        &self,
        name: &str,
        compute: Gas,
    ) -> Result<GasTimer, ExecutionError>;
}
Expand description

The “kernel” implements the FVM interface as presented to the actors. It:

  • Manages the Actor’s state.
  • Tracks and charges for IPLD & syscall-specific gas.

Actors may call into the kernel via the syscalls defined in the syscalls module.

Required Associated Types§

source

type CallManager: CallManager

The Kernel’s CallManager is

source

type Limiter: MemoryLimiter

The Kernel’s memory allocation tracker.

Required Methods§

source

fn into_inner(self) -> (Self::CallManager, BlockRegistry)
where Self: Sized,

Consume the Kernel and return the underlying CallManager and BlockRegistry.

source

fn new( mgr: Self::CallManager, blocks: BlockRegistry, caller: u64, actor_id: u64, method: u64, value_received: TokenAmount, read_only: bool, ) -> Self
where Self: Sized,

Construct a new Kernel from the given CallManager.

  • caller is the ID of the immediate caller.
  • actor_id is the ID of this actor.
  • method is the method that has been invoked.
  • value_received is value received due to the current call.
  • blocks is the initial block registry (should already contain the parameters).
source

fn machine(&self) -> &<Self::CallManager as CallManager>::Machine

The kernel’s underlying “machine”.

source

fn limiter_mut(&mut self) -> &mut Self::Limiter

Give access to the limiter of the underlying call manager.

source

fn gas_available(&self) -> Gas

Returns the remaining gas for the transaction.

source

fn charge_gas( &self, name: &str, compute: Gas, ) -> Result<GasTimer, ExecutionError>

ChargeGas charges specified amount of gas for execution. name provides information about gas charging point.

Object Safety§

This trait is not object safe.

Implementors§