Struct forest_filecoin::shim::fvm_latest::DefaultKernel

source ·
pub struct DefaultKernel<C> {
    pub caller: u64,
    pub actor_id: u64,
    pub method: u64,
    pub value_received: TokenAmount,
    pub read_only: bool,
    pub call_manager: C,
    pub blocks: BlockRegistry,
}
Expand description

The “default” Kernel implementation.

Fields§

§caller: u64§actor_id: u64§method: u64§value_received: TokenAmount§read_only: bool§call_manager: C

The call manager for this call stack. If this kernel calls another actor, it will temporarily “give” the call manager to the other kernel before re-attaching it.

§blocks: BlockRegistry

Tracks block data and organizes it through index handles so it can be referred to.

This does not yet reason about reachability.

Trait Implementations§

source§

impl<C> ActorOps for DefaultKernel<C>
where C: CallManager,

source§

fn resolve_address(&self, address: &Address) -> Result<u64, ExecutionError>

Resolves an address of any protocol to an ID address (via the Init actor’s table). This allows resolution of externally-provided SECP, BLS, or actor addresses to the canonical form. If the argument is an ID address it is returned directly.
source§

fn get_actor_code_cid(&self, id: u64) -> Result<Cid<64>, ExecutionError>

Look up the code CID of an actor.
source§

fn next_actor_address(&self) -> Result<Address, ExecutionError>

Computes an address for a new actor. The returned address is intended to uniquely refer to the actor even in the event of a chain re-org (whereas an ID-address might refer to a different actor after messages are re-ordered). Always an ActorExec address.
source§

fn create_actor( &mut self, code_id: Cid<64>, actor_id: u64, delegated_address: Option<Address>, ) -> Result<(), ExecutionError>

Creates an actor with given code_cid, actor_id, delegated_address (if specified), and an empty state.
source§

fn install_actor(&mut self, code_id: Cid<64>) -> Result<(), ExecutionError>

source§

fn get_builtin_actor_type( &self, code_cid: &Cid<64>, ) -> Result<u32, ExecutionError>

Returns the actor’s “type” (if builitin) or 0 (if not).
source§

fn get_code_cid_for_type(&self, typ: u32) -> Result<Cid<64>, ExecutionError>

Returns the CodeCID for the supplied built-in actor type.
source§

fn balance_of(&self, actor_id: u64) -> Result<TokenAmount, ExecutionError>

Returns the balance associated with an actor id
source§

fn lookup_delegated_address( &self, actor_id: u64, ) -> Result<Option<Address>, ExecutionError>

Looks up the “delegated” (f4) address of the specified actor, if any.
source§

impl<C> CryptoOps for DefaultKernel<C>
where C: CallManager,

source§

fn verify_signature( &self, sig_type: SignatureType, signature: &[u8], signer: &Address, plaintext: &[u8], ) -> Result<bool, ExecutionError>

Verifies that a signature is valid for an address and plaintext.
source§

fn verify_bls_aggregate( &self, aggregate_sig: &[u8; 96], pub_keys: &[[u8; 48]], plaintexts_concat: &[u8], plaintext_lens: &[u32], ) -> Result<bool, ExecutionError>

Verifies a BLS aggregate signature. In the case where there is one signer/signed plaintext, this is equivalent to verifying a non-aggregated BLS signature. Read more
source§

fn recover_secp_public_key( &self, hash: &[u8; 32], signature: &[u8; 65], ) -> Result<[u8; 65], ExecutionError>

Given a message hash and its signature, recovers the public key of the signer.
source§

fn hash(&self, code: u64, data: &[u8]) -> Result<Multihash<64>, ExecutionError>

Hashes input data_in using with the specified hash function, writing the output to digest_out, returning the size of the digest written to digest_out. If digest_out is to small to fit the entire digest, it will be truncated. If too large, the leftover space will not be overwritten.
source§

impl<C> DebugOps for DefaultKernel<C>
where C: CallManager,

source§

fn log(&self, msg: String)

Log a message.
source§

fn debug_enabled(&self) -> bool

Returns whether debug mode is enabled.
source§

fn store_artifact(&self, name: &str, data: &[u8]) -> Result<(), ExecutionError>

Store an artifact. Returns error on malformed name, returns Ok and logs the error on system/os errors.
source§

impl<C> EventOps for DefaultKernel<C>
where C: CallManager,

source§

fn emit_event( &mut self, event_headers: &[EventEntry], event_keys: &[u8], event_values: &[u8], ) -> Result<(), ExecutionError>

Records an event emitted throughout execution.
source§

impl<C> IpldBlockOps for DefaultKernel<C>
where C: CallManager,

source§

fn block_open( &mut self, cid: &Cid<64>, ) -> Result<(u32, BlockStat), ExecutionError>

Open a block. Read more
source§

fn block_create( &mut self, codec: u64, data: &[u8], ) -> Result<u32, ExecutionError>

Create a new block. Read more
Computes a CID for a block. Read more
source§

fn block_read( &self, id: u32, offset: u32, buf: &mut [u8], ) -> Result<i32, ExecutionError>

Read data from a block. Read more
source§

fn block_stat(&self, id: u32) -> Result<BlockStat, ExecutionError>

Returns the blocks codec & size. Read more
source§

impl<C> Kernel for DefaultKernel<C>
where C: CallManager,

§

type CallManager = C

The Kernel’s CallManager is
§

type Limiter = <<C as CallManager>::Machine as Machine>::Limiter

The Kernel’s memory allocation tracker.
source§

fn into_inner( self, ) -> (<DefaultKernel<C> as Kernel>::CallManager, BlockRegistry)
where DefaultKernel<C>: Sized,

Consume the Kernel and return the underlying CallManager and BlockRegistry.
source§

fn new( mgr: C, blocks: BlockRegistry, caller: u64, actor_id: u64, method: u64, value_received: TokenAmount, read_only: bool, ) -> DefaultKernel<C>

Construct a new Kernel from the given CallManager. Read more
source§

fn machine( &self, ) -> &<<DefaultKernel<C> as Kernel>::CallManager as CallManager>::Machine

The kernel’s underlying “machine”.
source§

fn limiter_mut(&mut self) -> &mut <DefaultKernel<C> as Kernel>::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.
source§

impl<C> MessageOps for DefaultKernel<C>
where C: CallManager,

source§

fn msg_context(&self) -> Result<MessageContext, ExecutionError>

Message information.
source§

impl<C> NetworkOps for DefaultKernel<C>
where C: CallManager,

source§

fn network_context(&self) -> Result<NetworkContext, ExecutionError>

Network information (epoch, version, etc.).
source§

fn tipset_cid(&self, epoch: i64) -> Result<Cid<64>, ExecutionError>

The CID of the tipset at the specified epoch.
source§

impl<C> RandomnessOps for DefaultKernel<C>
where C: CallManager,

source§

fn get_randomness_from_tickets( &self, rand_epoch: i64, ) -> Result<[u8; 32], ExecutionError>

Randomness returns a (pseudo)random byte array drawing from the latest ticket chain from a given epoch. This randomness is fork dependant but also biasable because of this.
source§

fn get_randomness_from_beacon( &self, rand_epoch: i64, ) -> Result<[u8; 32], ExecutionError>

Randomness returns a (pseudo)random byte array drawing from the latest beacon from a given epoch. This randomness is not tied to any fork of the chain, and is unbiasable.
source§

impl<C> SelfOps for DefaultKernel<C>
where C: CallManager,

source§

fn root(&mut self) -> Result<Cid<64>, ExecutionError>

Get the state root.
source§

fn set_root(&mut self, new: Cid<64>) -> Result<(), ExecutionError>

Update the state-root. Read more
source§

fn current_balance(&self) -> Result<TokenAmount, ExecutionError>

The balance of the receiver.
source§

fn self_destruct(&mut self, burn_unspent: bool) -> Result<(), ExecutionError>

Deletes the executing actor from the state tree, burning any remaining balance if requested.
source§

impl<K> SendOps<K> for DefaultKernel<<K as Kernel>::CallManager>
where K: Kernel,

source§

fn send( &mut self, recipient: &Address, method: u64, params_id: u32, value: &TokenAmount, gas_limit: Option<Gas>, flags: SendFlags, ) -> Result<CallResult, ExecutionError>

Sends a message to another actor. The method type parameter K is the type of the kernel to instantiate for the receiving actor. This is necessary to support wrapping a kernel, so the outer kernel can specify its Self as the receiver’s kernel type, rather than the wrapped kernel specifying its Self. This method is part of the Kernel trait so it can refer to the Self::CallManager associated type necessary to constrain K.
source§

impl<K> SyscallHandler<K> for DefaultKernel<<K as Kernel>::CallManager>

source§

impl<K> UpgradeOps<K> for DefaultKernel<<K as Kernel>::CallManager>
where K: Kernel,

source§

fn upgrade_actor( &mut self, new_code_cid: Cid<64>, params_id: u32, ) -> Result<CallResult, ExecutionError>

Upgrades the running actor to the specified code CID.

Auto Trait Implementations§

§

impl<C> Freeze for DefaultKernel<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for DefaultKernel<C>
where C: RefUnwindSafe,

§

impl<C> !Send for DefaultKernel<C>

§

impl<C> !Sync for DefaultKernel<C>

§

impl<C> Unpin for DefaultKernel<C>
where C: Unpin,

§

impl<C> UnwindSafe for DefaultKernel<C>
where C: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Conv for T

source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
source§

impl<T> FmtForward for T

source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Pipe for T
where T: ?Sized,

source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> References<RawCodec> for T

source§

fn references<R, E>(_c: RawCodec, _r: &mut R, _set: &mut E) -> Result<(), Error>
where R: Read, E: Extend<Cid<64>>,

Scrape the references from an impl Read. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> Tap for T

source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

impl<T> TryConv for T

source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more