runtime

package
v1.16.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abort

func Abort(code exitcode.ExitCode)

Abort aborts the LegacyVM execution and sets the executing message return to the given `code`.

func Abortf

func Abortf(code exitcode.ExitCode, msg string, args ...interface{})

Abortf will stop the LegacyVM execution and return an error to the caller.

Types

type CallerPattern

type CallerPattern interface {
	// IsMatch returns "True" if the patterns matches
	IsMatch(ctx PatternContext) bool
}

CallerPattern checks if the caller matches the pattern.

type ExecutionPanic

type ExecutionPanic struct {
	// contains filtered or unexported fields
}

ExecutionPanic is used to abort vm execution with an exit code.

func (ExecutionPanic) Code

func (p ExecutionPanic) Code() exitcode.ExitCode

Code is the code used to abort the execution (see: `Abort()`).

func (ExecutionPanic) String

func (p ExecutionPanic) String() string

type ExtendedInvocationContext

type ExtendedInvocationContext interface {
	InvocationContext

	NewActorAddress() address.Address
	// Create an actor in the state tree.
	//
	// This will allocate an ID address for the actor and call its `Constructor()` method.
	//
	// WARNING: May only be called by InitActor.
	CreateActor(codeID cid.Cid, addr address.Address)

	DeleteActor(beneficiary address.Address)
}

ExtendedInvocationContext is a set of convenience functions built on top external ABI calls.

Actor code should not be using this interface directly.

Note: This interface is intended to document the full set of available operations and ensure the context implementation exposes them.

type InvocationContext

type InvocationContext interface {
	// Runtime exposes some methods on the runtime to the actor.
	Runtime() Runtime
	// Store is the raw store for IPLD objects.
	//
	// Note: this is required for custom data structures.
	Store() rt5.Store
	// Message contains information available to the actor about the executing message.
	Message() rt5.Message
	// ValidateCaller validates the caller against a pattern.
	//
	// All actor methods MUST call this method before returning.
	ValidateCaller(CallerPattern)
	// StateHandle handles access to the actor state.
	State() rt5.StateHandle
	// Send allows actors to invoke methods on other actors
	Send(toAddr address.Address, methodNum abi.MethodNum, params cbor.Marshaler, value abi.TokenAmount, out cbor.Er) exitcode.ExitCode
	// Balance is the current balance on the current actors account.
	//
	// Note: the value received for this invocation is already reflected on the balance.
	Balance() abi.TokenAmount
}

InvocationContext is passed to the actors on each method call.

type PatternContext

type PatternContext interface {
	CallerCode() cid.Cid
	CallerAddr() address.Address
}

PatternContext is the context a pattern gets access to in order to determine if the caller matches.

type Runtime

type Runtime interface {
	// CurrentEpoch is the current chain epoch.
	CurrentEpoch() abi.ChainEpoch

	NetworkVersion() network.Version
}

Runtime has operations in the LegacyVM that are exposed to all actors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL