Documentation ¶
Index ¶
- func Remarshal(src interface{}, dst interface{}) error
- func ShufflePage(keys []*protocol.KeySpec, seedHash []byte)
- type ActionMetadata
- func (v *ActionMetadata) Copy() *ActionMetadata
- func (v *ActionMetadata) CopyAsInterface() interface{}
- func (v *ActionMetadata) Equal(u *ActionMetadata) bool
- func (v *ActionMetadata) IsValid() error
- func (v *ActionMetadata) MarshalBinary() ([]byte, error)
- func (v *ActionMetadata) MarshalJSON() ([]byte, error)
- func (v *ActionMetadata) UnmarshalBinary(data []byte) error
- func (v *ActionMetadata) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *ActionMetadata) UnmarshalJSON(b []byte) error
- type App
- type AppAction
- type AppConfig
- type BadRequestTx
- type CoreAPI
- type L1BlockMetadata
- func (v *L1BlockMetadata) Copy() *L1BlockMetadata
- func (v *L1BlockMetadata) CopyAsInterface() interface{}
- func (v *L1BlockMetadata) Equal(u *L1BlockMetadata) bool
- func (v *L1BlockMetadata) IsValid() error
- func (v *L1BlockMetadata) MarshalBinary() ([]byte, error)
- func (v *L1BlockMetadata) MarshalJSON() ([]byte, error)
- func (v *L1BlockMetadata) UnmarshalBinary(data []byte) error
- func (v *L1BlockMetadata) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *L1BlockMetadata) UnmarshalJSON(b []byte) error
- type NetworkBlockMetadata
- func (v *NetworkBlockMetadata) Copy() *NetworkBlockMetadata
- func (v *NetworkBlockMetadata) CopyAsInterface() interface{}
- func (v *NetworkBlockMetadata) Equal(u *NetworkBlockMetadata) bool
- func (v *NetworkBlockMetadata) IsValid() error
- func (v *NetworkBlockMetadata) MarshalBinary() ([]byte, error)
- func (v *NetworkBlockMetadata) MarshalJSON() ([]byte, error)
- func (v *NetworkBlockMetadata) UnmarshalBinary(data []byte) error
- func (v *NetworkBlockMetadata) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *NetworkBlockMetadata) UnmarshalJSON(b []byte) error
- type Options
- type PayoutApp
- func (a *PayoutApp) DidExecute(ctx *StateContext, actions []*AppAction) error
- func (a *PayoutApp) Execute(ctx *StateContext) ([]*AppAction, error)
- func (a *PayoutApp) Init() (*AppConfig, error)
- func (a *PayoutApp) ShouldExecute(ctx *StateContext, block *NetworkBlockMetadata) (bool, error)
- func (a *PayoutApp) WillRetry(*StateContext)
- type RequestTx
- type RequestsApp
- func (a *RequestsApp) DidExecute(*StateContext, []*AppAction) error
- func (a *RequestsApp) Execute(ctx *StateContext) ([]*AppAction, error)
- func (a *RequestsApp) Init() (*AppConfig, error)
- func (a *RequestsApp) ShouldExecute(ctx *StateContext, block *NetworkBlockMetadata) (bool, error)
- func (a *RequestsApp) WillRetry(*StateContext)
- type StateContext
- type StateDelegate
- type StateExecutor
- type WalletAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Remarshal ¶
func Remarshal(src interface{}, dst interface{}) error
Remarshal uses mapstructure to convert a generic JSON-decoded map into a struct.
func ShufflePage ¶
ShufflePage will take a key page and shuffle the keys within it to randomize the order based upon a seed
Types ¶
type ActionMetadata ¶
type ActionMetadata struct { Block [32]byte `json:"block,omitempty" form:"block" query:"block" validate:"required"` AppID string `json:"appID,omitempty" form:"appID" query:"appID" validate:"required"` Attempt uint64 `json:"attempt,omitempty" form:"attempt" query:"attempt" validate:"required"` // contains filtered or unexported fields }
ActionMetadata is the metadata for an action produced by an L2 application.
func (*ActionMetadata) Copy ¶
func (v *ActionMetadata) Copy() *ActionMetadata
func (*ActionMetadata) CopyAsInterface ¶
func (v *ActionMetadata) CopyAsInterface() interface{}
func (*ActionMetadata) Equal ¶
func (v *ActionMetadata) Equal(u *ActionMetadata) bool
func (*ActionMetadata) IsValid ¶
func (v *ActionMetadata) IsValid() error
func (*ActionMetadata) MarshalBinary ¶
func (v *ActionMetadata) MarshalBinary() ([]byte, error)
func (*ActionMetadata) MarshalJSON ¶
func (v *ActionMetadata) MarshalJSON() ([]byte, error)
func (*ActionMetadata) UnmarshalBinary ¶
func (v *ActionMetadata) UnmarshalBinary(data []byte) error
func (*ActionMetadata) UnmarshalBinaryFrom ¶
func (v *ActionMetadata) UnmarshalBinaryFrom(rd io.Reader) error
func (*ActionMetadata) UnmarshalJSON ¶
func (v *ActionMetadata) UnmarshalJSON(b []byte) error
type App ¶
type App interface { // Init returns the app configuration. Init() (*AppConfig, error) // ShouldExecute determines if L1 should execute or should skip this block. // This is where the app should pull accounts with the light client. ShouldExecute(*StateContext, *NetworkBlockMetadata) (bool, error) // Execute returns a list of transactions that should be executed. Execute(*StateContext) ([]*AppAction, error) // DidExecute is called after L1 completes. DidExecute(*StateContext, []*AppAction) error // WillRetry is called during reset if L1 fails and is going to try again. WillRetry(*StateContext) }
type AppAction ¶
type AppAction struct { Transaction *protocol.Transaction // WillComplete indicates whether this action is expected to complete. If // WillComplete is nil or true, the FSM will consider it an error if the // action does not complete once signed. WillComplete *bool }
type BadRequestTx ¶
type BadRequestTx struct { internal.TxExecuted Data protocol.DataEntry Error error }
BadRequestTx represents an invalid request on the requests account. BadRequestTx is used for requests that are malformed, e.g. cannot be parsed, _not_ for actions that fail, such as attempting to register an account that does not exist.
type L1BlockMetadata ¶
type L1BlockMetadata struct { Network *NetworkBlockMetadata `json:"network,omitempty" form:"network" query:"network" validate:"required"` Leader *protocol.KeySpec `json:"leader,omitempty" form:"leader" query:"leader" validate:"required"` // Actions lists the actions completed in this block. Actions []*url.TxID `json:"actions,omitempty" form:"actions" query:"actions" validate:"required"` // contains filtered or unexported fields }
L1BlockMetadata is the finalized data store at the end of the epoch.
func (*L1BlockMetadata) Copy ¶
func (v *L1BlockMetadata) Copy() *L1BlockMetadata
func (*L1BlockMetadata) CopyAsInterface ¶
func (v *L1BlockMetadata) CopyAsInterface() interface{}
func (*L1BlockMetadata) Equal ¶
func (v *L1BlockMetadata) Equal(u *L1BlockMetadata) bool
func (*L1BlockMetadata) IsValid ¶
func (v *L1BlockMetadata) IsValid() error
func (*L1BlockMetadata) MarshalBinary ¶
func (v *L1BlockMetadata) MarshalBinary() ([]byte, error)
func (*L1BlockMetadata) MarshalJSON ¶
func (v *L1BlockMetadata) MarshalJSON() ([]byte, error)
func (*L1BlockMetadata) UnmarshalBinary ¶
func (v *L1BlockMetadata) UnmarshalBinary(data []byte) error
func (*L1BlockMetadata) UnmarshalBinaryFrom ¶
func (v *L1BlockMetadata) UnmarshalBinaryFrom(rd io.Reader) error
func (*L1BlockMetadata) UnmarshalJSON ¶
func (v *L1BlockMetadata) UnmarshalJSON(b []byte) error
type NetworkBlockMetadata ¶
type NetworkBlockMetadata struct { Index uint64 `json:"index,omitempty" form:"index" query:"index" validate:"required"` Time time.Time `json:"time,omitempty" form:"time" query:"time" validate:"required"` Major uint64 `json:"major,omitempty" form:"major" query:"major" validate:"required"` Hash [32]byte `json:"hash,omitempty" form:"hash" query:"hash" validate:"required"` // contains filtered or unexported fields }
func (*NetworkBlockMetadata) Copy ¶
func (v *NetworkBlockMetadata) Copy() *NetworkBlockMetadata
func (*NetworkBlockMetadata) CopyAsInterface ¶
func (v *NetworkBlockMetadata) CopyAsInterface() interface{}
func (*NetworkBlockMetadata) Equal ¶
func (v *NetworkBlockMetadata) Equal(u *NetworkBlockMetadata) bool
func (*NetworkBlockMetadata) IsValid ¶
func (v *NetworkBlockMetadata) IsValid() error
func (*NetworkBlockMetadata) MarshalBinary ¶
func (v *NetworkBlockMetadata) MarshalBinary() ([]byte, error)
func (*NetworkBlockMetadata) MarshalJSON ¶
func (v *NetworkBlockMetadata) MarshalJSON() ([]byte, error)
func (*NetworkBlockMetadata) UnmarshalBinary ¶
func (v *NetworkBlockMetadata) UnmarshalBinary(data []byte) error
func (*NetworkBlockMetadata) UnmarshalBinaryFrom ¶
func (v *NetworkBlockMetadata) UnmarshalBinaryFrom(rd io.Reader) error
func (*NetworkBlockMetadata) UnmarshalJSON ¶
func (v *NetworkBlockMetadata) UnmarshalJSON(b []byte) error
type Options ¶
type Options struct { Logger *slog.Logger App App CoreAPI CoreAPI WalletAPI WalletAPI Light *light.Client // Address is the address that will be used to sign transactions. Address // may be nil if the node is not a validator. Address *address.PublicKey // SignExternalTransactions enables signing of transactions that were // initiated externally. SignExternalTransactions bool // DebugAttemptNumber allows retrying when debugging. DebugAttemptNumber uint64 }
type PayoutApp ¶
type PayoutApp struct { Params *types.Parameters // contains filtered or unexported fields }
func (*PayoutApp) DidExecute ¶
func (a *PayoutApp) DidExecute(ctx *StateContext, actions []*AppAction) error
func (*PayoutApp) ShouldExecute ¶
func (a *PayoutApp) ShouldExecute(ctx *StateContext, block *NetworkBlockMetadata) (bool, error)
func (*PayoutApp) WillRetry ¶
func (a *PayoutApp) WillRetry(*StateContext)
type RequestTx ¶
type RequestTx struct { internal.TxExecuted Action requests.Action }
RequestTx is an action and the transaction it came from.
type RequestsApp ¶
type RequestsApp struct {
Params *types.Parameters
}
func (*RequestsApp) DidExecute ¶
func (a *RequestsApp) DidExecute(*StateContext, []*AppAction) error
func (*RequestsApp) Execute ¶
func (a *RequestsApp) Execute(ctx *StateContext) ([]*AppAction, error)
func (*RequestsApp) Init ¶
func (a *RequestsApp) Init() (*AppConfig, error)
func (*RequestsApp) ShouldExecute ¶
func (a *RequestsApp) ShouldExecute(ctx *StateContext, block *NetworkBlockMetadata) (bool, error)
func (*RequestsApp) WillRetry ¶
func (a *RequestsApp) WillRetry(*StateContext)
type StateContext ¶
type StateContext struct { Executor *StateExecutor // Block state CurrentBlock *NetworkBlockMetadata //block of the current state being processed PreviousBlock *NetworkBlockMetadata //previous block checked ExecutorVersion protocol.ExecutorVersion // Execution state AppData any // contains filtered or unexported fields }
func NewStateContext ¶
func NewStateContext(exec *StateExecutor) *StateContext
func (*StateContext) Fatal ¶
func (s *StateContext) Fatal(code errors.Status) stateErrorBuilder
func (*StateContext) TryAgain ¶
func (s *StateContext) TryAgain(code errors.Status) stateErrorBuilder
type StateDelegate ¶
type StateDelegate interface { String() string // contains filtered or unexported methods }
type StateExecutor ¶
func NewStateExecutor ¶
func NewStateExecutor(opts Options) *StateExecutor
func (*StateExecutor) DidCommitBlock ¶
func (e *StateExecutor) DidCommitBlock(d node.DidCommitBlock) error
func (*StateExecutor) DidSaveSnapshot ¶
func (e *StateExecutor) DidSaveSnapshot(_ node.DidSaveSnapshot) error
func (*StateExecutor) Load ¶
func (e *StateExecutor) Load() error
func (*StateExecutor) StartWithEventBus ¶
func (e *StateExecutor) StartWithEventBus(ctx context.Context, bus *node.Bus, depth int, wg *sync.WaitGroup)
StartWithEventBus starts a goroutine to process block events concurrently. By using a channel and a goroutine, StartWithEventBus somewhat decouples event generation from event processing such that delays in block processing time will not block the core follower, as long as the delays do not exceed the buffer.
StartWithEventBus will not release the wait group until and will leak goroutines unless the context is canceled.
type WalletAPI ¶
type WalletAPI interface { wallet.SigningService wallet.KeyService wallet.AccountService }
Source Files ¶
- 01_can_begin.go
- 10_select_leader.go
- 30_execute_app.go
- 31_initiate_txn.go
- 32_did_initiate_txn.go
- 33_sign_txn.go
- 34_did_sign_txn.go
- 35_sign_external.go
- 90_finalize_block.go
- 91_initiate_finalization.go
- 92_did_initiate_finalization.go
- 93_sign_finalization.go
- 94_did_sign_finalization.go
- 99_reset.go
- app_basic.go
- app_payout.go
- app_requests.go
- context.go
- dispatcher.go
- error_fatal.go
- error_try_again.go
- errors.go
- loader.go
- state.go
- types_gen.go