chain

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Applier

type Applier interface {
	ApplyMessage(context *ExecutionContext, state state.Wrapper, msg interface{}) (MessageReceipt, error)
}

Applier applies abstract messages to states.

type ExecutionContext

type ExecutionContext struct {
	Epoch      uint64          // The epoch number ("height") during which a message is executed.
	MinerOwner address.Address // The miner actor which earns gas fees from message execution.
}

ExecutionContext provides the context for execution of a message.

func NewExecutionContext

func NewExecutionContext(epoch uint64, miner address.Address) *ExecutionContext

NewExecutionContext builds a new execution context.

type MessageFactory

type MessageFactory interface {
	MakeMessage(from, to address.Address, method MethodID, nonce uint64, value, gasPrice types.BigInt, gasLimit types.GasUnit,
		params []byte) (interface{}, error)
	FromSingletonAddress(address actors.SingletonActorID) address.Address
	FromActorCodeCid(cod actors.ActorCodeID) cid.Cid
}

MessageFactory creates a concrete, but opaque, message object. Integrations should implement this to provide a message value that will be accepted by the validation engine.

type MessageProducer

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

MessageProducer presents a convenient API for scripting the creation of long and complex message sequences. The created messages are retained for subsequent export or evaluation in a VM. Actual message construction is delegated to a `MessageFactory`, and the message are opaque to the producer.

func NewMessageProducer

func NewMessageProducer(factory MessageFactory, defaultGasLimit types.GasUnit, defaultGasPrice types.BigInt) *MessageProducer

NewMessageProducer creates a new message producer, delegating message creation to `factory`.

func (*MessageProducer) ActorCid added in v0.0.4

func (mp *MessageProducer) ActorCid(c actors.ActorCodeID) cid.Cid

func (*MessageProducer) Build

func (mp *MessageProducer) Build(from, to address.Address, nonce uint64, method MethodID, params []byte,
	opts ...MsgOpt) (interface{}, error)

Build creates and returns a single message, using default gas parameters unless modified by `opts`.

func (*MessageProducer) BuildFull

func (mp *MessageProducer) BuildFull(from, to address.Address, method MethodID, nonce uint64, value types.BigInt,
	gasLimit types.GasUnit, gasPrice types.BigInt, params []byte) (interface{}, error)

BuildFull creates and returns a single message.

func (*MessageProducer) InitExec

func (mp *MessageProducer) InitExec(from address.Address, nonce uint64, code actors.ActorCodeID, params []byte, opts ...MsgOpt) (interface{}, error)

InitExec builds a message invoking InitActor.Exec and returns it.

func (*MessageProducer) Messages

func (mp *MessageProducer) Messages() []interface{}

Messages returns a slice containing all messages created by the producer.

func (*MessageProducer) MultiSigAddSigner added in v0.0.2

func (mp *MessageProducer) MultiSigAddSigner(to, from address.Address, nonce uint64, signer address.Address, increase bool, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) MultiSigApprove added in v0.0.2

func (mp *MessageProducer) MultiSigApprove(to, from address.Address, nonce uint64, txID uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) MultiSigCancel added in v0.0.2

func (mp *MessageProducer) MultiSigCancel(to, from address.Address, nonce uint64, txID uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) MultiSigChangeRequirement added in v0.0.2

func (mp *MessageProducer) MultiSigChangeRequirement(to, from address.Address, nonce uint64, req uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) MultiSigPropose added in v0.0.2

func (mp *MessageProducer) MultiSigPropose(to, from address.Address, nonce uint64, proposeTo address.Address, proposeValue types.BigInt, proposeMethod uint64, proposeParams []byte, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) MultiSigRemoveSigner added in v0.0.2

func (mp *MessageProducer) MultiSigRemoveSigner(to, from address.Address, nonce uint64, signer address.Address, decrease bool, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) MultiSigSwapSigner added in v0.0.2

func (mp *MessageProducer) MultiSigSwapSigner(to, from address.Address, nonce uint64, swapFrom, swapTo address.Address, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) PaychClose added in v0.0.3

func (mp *MessageProducer) PaychClose(to, from address.Address, nonce uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) PaychCollect added in v0.0.3

func (mp *MessageProducer) PaychCollect(to, from address.Address, nonce uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) PaychGetOwner added in v0.0.3

func (mp *MessageProducer) PaychGetOwner(to, from address.Address, nonce uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) PaychGetToSend added in v0.0.3

func (mp *MessageProducer) PaychGetToSend(to, from address.Address, nonce uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) PaychUpdateChannelState added in v0.0.3

func (mp *MessageProducer) PaychUpdateChannelState(to, from address.Address, nonce uint64, sv types.SignedVoucher, secret, proof []byte, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) SingletonAddress added in v0.0.4

func (mp *MessageProducer) SingletonAddress(id actors.SingletonActorID) address.Address

func (*MessageProducer) StorageMarketActivateStorageDeals added in v0.0.5

func (mp *MessageProducer) StorageMarketActivateStorageDeals(from address.Address, nonce uint64, dealIDs []uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StorageMarketAddBalance added in v0.0.5

func (mp *MessageProducer) StorageMarketAddBalance(from address.Address, nonce uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StorageMarketComputeDataCommitment added in v0.0.5

func (mp *MessageProducer) StorageMarketComputeDataCommitment(from address.Address, nonce uint64, sectorSize uint64, dealIDs []uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StorageMarketPublishStorageDeals added in v0.0.5

func (mp *MessageProducer) StorageMarketPublishStorageDeals(from address.Address, nonce uint64, deals []strgmrkt.StorageDeal, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StorageMarketWithdrawBalance added in v0.0.5

func (mp *MessageProducer) StorageMarketWithdrawBalance(from address.Address, nonce uint64, balance types.BigInt, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StorageMinerGetOwner

func (mp *MessageProducer) StorageMinerGetOwner(to, from address.Address, nonce uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StorageMinerGetPeerID

func (mp *MessageProducer) StorageMinerGetPeerID(to, from address.Address, nonce uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StorageMinerGetPower

func (mp *MessageProducer) StorageMinerGetPower(to, from address.Address, nonce uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StorageMinerGetSectorSize

func (mp *MessageProducer) StorageMinerGetSectorSize(to, from address.Address, nonce uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StorageMinerGetWorkerAddr

func (mp *MessageProducer) StorageMinerGetWorkerAddr(to, from address.Address, nonce uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StorageMinerUpdatePeerID

func (mp *MessageProducer) StorageMinerUpdatePeerID(to, from address.Address, nonce uint64, peerID peer.ID, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StoragePowerCreateStorageMiner

func (mp *MessageProducer) StoragePowerCreateStorageMiner(from address.Address, nonce uint64,
	owner address.Address, worker address.Address, sectorSize uint64, peerID peer.ID,
	opts ...MsgOpt) (interface{}, error)

StoragePowerCreateStorageMiner builds a message invoking StoragePowerActor.CreateStorageMiner and returns it.

func (*MessageProducer) StoragePowerLookupPower added in v0.0.4

func (mp *MessageProducer) StoragePowerLookupPower(from address.Address, nonce uint64, miner address.Address, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StoragePowerPledgeCollateralForSize added in v0.0.4

func (mp *MessageProducer) StoragePowerPledgeCollateralForSize(from address.Address, nonce uint64, size types.BigInt, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) StoragePowerUpdateStorage

func (mp *MessageProducer) StoragePowerUpdateStorage(from address.Address, nonce uint64, delta types.BigInt, nextppEnd, previousppEnd uint64, opts ...MsgOpt) (interface{}, error)

func (*MessageProducer) Transfer

func (mp *MessageProducer) Transfer(from, to address.Address, nonce uint64, value uint64, opts ...MsgOpt) (interface{}, error)

Transfer builds a simple value transfer message and returns it.

type MessageReceipt

type MessageReceipt struct {
	ExitCode    uint8
	ReturnValue []byte
	GasUsed     types.GasUnit
}

MessageReceipt is the return value of message application.

type MethodID

type MethodID int

MethodID identifies a VM actor method. The values here are not intended to match the spec's method IDs, though once implementations converge on those we could make it so. Integrations should map these method ids to the internal method handle representation.

const (
	NoMethod MethodID = iota
	InitConstructor
	InitExec
	InitGetActorIDForAddress

	StoragePowerConstructor
	StoragePowerCreateStorageMiner
	StoragePowerUpdatePower
	StoragePowerTotalStorage
	StoragePowerPowerLookup
	StoragePowerIncrementPower
	StoragePowerSuspendMiner

	StorageMarketConstructor
	StorageMarketWithdrawBalance
	StorageMarketAddBalance
	StorageMarketPublishStorageDeals
	StorageMarketActivateStorageDeals
	StorageMarketComputeDataCommitment

	StorageMinerUpdatePeerID
	StorageMinerGetOwner
	StorageMinerGetWorkerAddr
	StorageMinerGetPower
	StorageMinerGetPeerID
	StorageMinerGetSectorSize

	MultiSigConstructor
	MultiSigPropose
	MultiSigApprove
	MultiSigCancel
	MultiSigClearCompleted
	MultiSigAddSigner
	MultiSigRemoveSigner
	MultiSigSwapSigner
	MultiSigChangeRequirement

	PaymentChannelConstructor
	PaymentChannelUpdate
	PaymentChannelClose
	PaymentChannelCollect
	PaymentChannelGetOwner
	PaymentChannelGetToSend

	GetSectorSize
	CronConstructor
	CronTick

	// Provides a value above which integrations can assign their own method identifiers without
	// collision with these "standard" ones.
	MethodCount
)

An enumeration of all actor methods which a message could invoke. Note that some methods are not intended for direct invocation by account actors, but they are still listed here so that the behaviour of attempting to invoke them can be exercised.

type MsgOpt

type MsgOpt func(*msgOpts)

MsgOpt is an option configuring message value or gas parameters.

func BigValue

func BigValue(value types.BigInt) MsgOpt

func GasLimit

func GasLimit(limit uint64) MsgOpt

func GasPrice

func GasPrice(price uint64) MsgOpt

func Value

func Value(value uint64) MsgOpt

type Validator

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

Validator arranges the execution of a sequence of messages, returning the resulting receipts and state.

func NewValidator

func NewValidator(executor Applier) *Validator

NewValidator builds a new validator.

func (*Validator) ApplyMessage

func (v *Validator) ApplyMessage(context *ExecutionContext, state state.Wrapper, message interface{}) (MessageReceipt, error)

ApplyMessages applies a message to a state

Jump to

Keyboard shortcuts

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