Kernel

Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§