Documentation ¶
Index ¶
- Constants
- Variables
- type AbortWithArgs
- type Actor
- func (a Actor) AbortWith(rt runtime2.Runtime, args *AbortWithArgs) *abi.EmptyValue
- func (a Actor) CallerValidation(rt runtime2.Runtime, args *CallerValidationArgs) *abi.EmptyValue
- func (a Actor) Code() cid.Cid
- func (a Actor) Constructor(_ runtime2.Runtime, _ *abi.EmptyValue) *abi.EmptyValue
- func (a Actor) CreateActor(rt runtime2.Runtime, args *CreateActorArgs) *abi.EmptyValue
- func (a Actor) DeleteActor(rt runtime2.Runtime, beneficiary *address.Address) *abi.EmptyValue
- func (a Actor) Exports() []interface{}
- func (a Actor) InspectRuntime(rt runtime2.Runtime, _ *abi.EmptyValue) *InspectRuntimeReturn
- func (a Actor) IsSingleton() bool
- func (a Actor) MutateState(rt runtime2.Runtime, args *MutateStateArgs) *abi.EmptyValue
- func (a Actor) ResolveAddress(rt runtime2.Runtime, args *address.Address) *ResolveAddressResponse
- func (a Actor) Send(rt runtime2.Runtime, args *SendArgs) *SendReturn
- func (a Actor) State() cbor.Er
- type CallerValidationArgs
- type CallerValidationBranch
- type CreateActorArgs
- type InspectRuntimeReturn
- type MutateStateArgs
- type MutateStateBranch
- type ResolveAddressResponse
- type SendArgs
- type SendReturn
- type State
- type UnmarshallableCBOR
Constants ¶
const ( MethodCallerValidation = builtin.MethodConstructor + iota MethodCreateActor MethodResolveAddress // MethodDeleteActor is the identifier for the method that deletes this actor. MethodDeleteActor // MethodSend is the identifier for the method that sends a message to another actor. MethodSend // MethodMutateState is the identifier for the method that attempts to mutate // a state value in the actor. MethodMutateState // MethodAbortWith is the identifier for the method that panics optionally with // a passed exit code. MethodAbortWith // MethodInspectRuntime is the identifier for the method that returns the // current runtime values. MethodInspectRuntime )
Variables ¶
var Address = func() address.Address { addr, err := address.NewIDAddress(98) if err != nil { panic(err) } return addr }()
Address is the singleton address of this actor. Its value is 98 (builtin.FirstNonSingletonActorId - 2), as 99 is reserved for the burnt funds singleton.
var ChaosActorCodeCID = func() cid.Cid { builder := cid.V1Builder{Codec: cid.Raw, MhType: multihash.IDENTITY} c, err := builder.Sum([]byte("fil/1/chaos")) if err != nil { panic(err) } return c }()
ChaosActorCodeCID is the CID by which this kind of actor will be identified.
Functions ¶
This section is empty.
Types ¶
type AbortWithArgs ¶ added in v0.7.0
AbortWithArgs are the arguments to the Actor.AbortWith method, specifying the exit code to (optionally) abort with and the message.
func (*AbortWithArgs) MarshalCBOR ¶ added in v0.7.0
func (t *AbortWithArgs) MarshalCBOR(w io.Writer) error
func (*AbortWithArgs) UnmarshalCBOR ¶ added in v0.7.0
func (t *AbortWithArgs) UnmarshalCBOR(r io.Reader) error
type Actor ¶
type Actor struct{}
Actor is a chaos actor. It implements a variety of illegal behaviours that trigger violations of VM invariants. These behaviours are not found in production code, but are important to test that the VM constraints are properly enforced.
The chaos actor is being incubated and its behaviour and ABI be standardised shortly. Its CID is ChaosActorCodeCID, and its singleton address is 98 (Address). It cannot be instantiated via the init actor, and its constructor panics.
Test vectors relying on the chaos actor being deployed will carry selector "chaos_actor:true".
func (Actor) AbortWith ¶ added in v0.7.0
func (a Actor) AbortWith(rt runtime2.Runtime, args *AbortWithArgs) *abi.EmptyValue
AbortWith simply causes a panic with the passed exit code.
func (Actor) CallerValidation ¶
func (a Actor) CallerValidation(rt runtime2.Runtime, args *CallerValidationArgs) *abi.EmptyValue
CallerValidation violates VM call validation constraints.
CallerValidationBranchNone performs no validation. CallerValidationBranchTwice validates twice. CallerValidationBranchIsAddress validates caller against CallerValidationArgs.Addrs. CallerValidationBranchIsType validates caller against CallerValidationArgs.Types.
func (Actor) Constructor ¶
func (a Actor) Constructor(_ runtime2.Runtime, _ *abi.EmptyValue) *abi.EmptyValue
Constructor will panic because the Chaos actor is a singleton.
func (Actor) CreateActor ¶
func (a Actor) CreateActor(rt runtime2.Runtime, args *CreateActorArgs) *abi.EmptyValue
CreateActor creates an actor with the supplied CID and Address.
func (Actor) DeleteActor ¶
func (a Actor) DeleteActor(rt runtime2.Runtime, beneficiary *address.Address) *abi.EmptyValue
DeleteActor deletes the executing actor from the state tree, transferring any balance to beneficiary.
func (Actor) Exports ¶
func (a Actor) Exports() []interface{}
Exports defines the methods this actor exposes publicly.
func (Actor) InspectRuntime ¶ added in v0.7.1
func (a Actor) InspectRuntime(rt runtime2.Runtime, _ *abi.EmptyValue) *InspectRuntimeReturn
InspectRuntime returns a copy of the serializable values available in the Runtime.
func (Actor) IsSingleton ¶ added in v0.9.0
func (Actor) MutateState ¶
func (a Actor) MutateState(rt runtime2.Runtime, args *MutateStateArgs) *abi.EmptyValue
MutateState attempts to mutate a state value in the actor.
func (Actor) ResolveAddress ¶
func (a Actor) ResolveAddress(rt runtime2.Runtime, args *address.Address) *ResolveAddressResponse
type CallerValidationArgs ¶ added in v0.7.2
type CallerValidationArgs struct { Branch CallerValidationBranch Addrs []address.Address Types []cid.Cid }
CallerValidationArgs are the arguments to Actor.CallerValidation.
func (*CallerValidationArgs) MarshalCBOR ¶ added in v0.7.2
func (t *CallerValidationArgs) MarshalCBOR(w io.Writer) error
func (*CallerValidationArgs) UnmarshalCBOR ¶ added in v0.7.2
func (t *CallerValidationArgs) UnmarshalCBOR(r io.Reader) error
type CallerValidationBranch ¶
type CallerValidationBranch int64
CallerValidationBranch is an enum used to select a branch in the CallerValidation method.
const ( // CallerValidationBranchNone causes no caller validation to take place. CallerValidationBranchNone CallerValidationBranch = iota // CallerValidationBranchTwice causes Runtime.ValidateImmediateCallerAcceptAny to be called twice. CallerValidationBranchTwice // CallerValidationBranchIsAddress causes caller validation against CallerValidationArgs.Addrs. CallerValidationBranchIsAddress // CallerValidationBranchIsType causes caller validation against CallerValidationArgs.Types. CallerValidationBranchIsType )
type CreateActorArgs ¶
type CreateActorArgs struct { // UndefActorCID instructs us to use cid.Undef; we can't pass cid.Undef // in ActorCID because it doesn't serialize. UndefActorCID bool ActorCID cid.Cid // UndefAddress is the same as UndefActorCID but for Address. UndefAddress bool Address address.Address }
CreateActorArgs are the arguments to CreateActor.
func (*CreateActorArgs) MarshalCBOR ¶
func (t *CreateActorArgs) MarshalCBOR(w io.Writer) error
func (*CreateActorArgs) UnmarshalCBOR ¶
func (t *CreateActorArgs) UnmarshalCBOR(r io.Reader) error
type InspectRuntimeReturn ¶ added in v0.7.1
type InspectRuntimeReturn struct { Caller address.Address Receiver address.Address ValueReceived abi.TokenAmount CurrEpoch abi.ChainEpoch CurrentBalance abi.TokenAmount State State }
InspectRuntimeReturn is the return value for the Actor.InspectRuntime method.
func (*InspectRuntimeReturn) MarshalCBOR ¶ added in v0.7.1
func (t *InspectRuntimeReturn) MarshalCBOR(w io.Writer) error
func (*InspectRuntimeReturn) UnmarshalCBOR ¶ added in v0.7.1
func (t *InspectRuntimeReturn) UnmarshalCBOR(r io.Reader) error
type MutateStateArgs ¶
type MutateStateArgs struct { Value string Branch MutateStateBranch }
MutateStateArgs specify the value to set on the state and the way in which it should be attempted to be set.
func (*MutateStateArgs) MarshalCBOR ¶
func (t *MutateStateArgs) MarshalCBOR(w io.Writer) error
func (*MutateStateArgs) UnmarshalCBOR ¶
func (t *MutateStateArgs) UnmarshalCBOR(r io.Reader) error
type MutateStateBranch ¶
type MutateStateBranch int64
MutateStateBranch is an enum used to select the type of state mutation to attempt.
const ( // MutateInTransaction legally mutates state within a transaction. MutateInTransaction MutateStateBranch = iota // MutateReadonly ILLEGALLY mutates readonly state. MutateReadonly // MutateAfterTransaction ILLEGALLY mutates state after a transaction. MutateAfterTransaction )
type ResolveAddressResponse ¶
type ResolveAddressResponse struct { Address address.Address Success bool }
ResolveAddressResponse holds the response of a call to runtime.ResolveAddress
func (*ResolveAddressResponse) MarshalCBOR ¶
func (t *ResolveAddressResponse) MarshalCBOR(w io.Writer) error
func (*ResolveAddressResponse) UnmarshalCBOR ¶
func (t *ResolveAddressResponse) UnmarshalCBOR(r io.Reader) error
type SendArgs ¶
type SendArgs struct { To address.Address Value abi.TokenAmount Method abi.MethodNum Params []byte }
SendArgs are the arguments for the Send method.
type SendReturn ¶
SendReturn is the return values for the Send method.
func (*SendReturn) MarshalCBOR ¶
func (t *SendReturn) MarshalCBOR(w io.Writer) error
func (*SendReturn) UnmarshalCBOR ¶
func (t *SendReturn) UnmarshalCBOR(r io.Reader) error
type State ¶
type State struct { // Value can be updated by chaos actor methods to test illegal state // mutations when the state is in readonly mode for example. Value string // Unmarshallable is a sentinel value. If the slice contains no values, the // State struct will encode as CBOR without issue. If the slice is non-nil, // CBOR encoding will fail. Unmarshallable []*UnmarshallableCBOR }
State is the state for the chaos actor used by some methods to invoke behaviours in the vm or runtime.
type UnmarshallableCBOR ¶
type UnmarshallableCBOR struct{}
UnmarshallableCBOR is a type that cannot be marshalled or unmarshalled to CBOR despite implementing the CBORMarshaler and CBORUnmarshaler interface.
func (*UnmarshallableCBOR) MarshalCBOR ¶
func (t *UnmarshallableCBOR) MarshalCBOR(io.Writer) error
MarshalCBOR will fail to marshal the value to CBOR.
func (*UnmarshallableCBOR) UnmarshalCBOR ¶
func (t *UnmarshallableCBOR) UnmarshalCBOR(io.Reader) error
UnmarshalCBOR will fail to unmarshal the value from CBOR.