Documentation
¶
Overview ¶
Package fx is used to effect changes on the outside world, i.e. the shuttermint node and the main chain node
Index ¶
- func IsRetriable(err error) bool
- type Accuse
- type ActionID
- type ActionWithID
- type Appeal
- type EonKeyBroadcast
- type ExecuteCipherBatch
- type ExecutePlainBatch
- type IAction
- type IRetriable
- type MainChainTX
- type MessageSender
- type MockMessageSender
- type NonRetriableError
- type PendingActions
- func (pending *PendingActions) AddActions(id ActionID, actions []IAction) (ActionID, ActionID)
- func (pending *PendingActions) GetAction(id ActionID) IAction
- func (pending *PendingActions) GetMainChainTXHash(id ActionID) common.Hash
- func (pending *PendingActions) Load() error
- func (pending *PendingActions) RemoveAction(id ActionID)
- func (pending *PendingActions) SetMainChainTXHash(id ActionID, hash common.Hash)
- func (pending *PendingActions) ShortInfo() string
- func (pending *PendingActions) SortedIDs() []ActionID
- type RPCMessageSender
- type RemoteError
- type RunEnv
- func (runenv *RunEnv) CurrentWorld() observe.World
- func (runenv *RunEnv) Load(ctx context.Context) (bool, error)
- func (runenv *RunEnv) RunActions(ctx context.Context, actionCounter uint64, actions []IAction) error
- func (runenv *RunEnv) ShortInfo() string
- func (runenv *RunEnv) StartBackgroundTasks(ctx context.Context, g *errgroup.Group)
- type SendShuttermintMessage
- type SkipCipherBatch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRetriable ¶
IsRetriable checks if we should retry an action that resulted in the given error.
Types ¶
type Accuse ¶
Accuse is an action accusing the executor of a given half step at the keyper slasher.
func (Accuse) SendTX ¶
func (a Accuse) SendTX(caller *contract.Caller, auth *bind.TransactOpts) (*types.Transaction, error)
type ActionWithID ¶
type Appeal ¶
type Appeal struct {
Authorization contract.Authorization
}
Appeal is an action countering an earlier invalid accusation.
func (Appeal) SendTX ¶
func (a Appeal) SendTX(caller *contract.Caller, auth *bind.TransactOpts) (*types.Transaction, error)
type EonKeyBroadcast ¶
type EonKeyBroadcast struct { KeyperIndex uint64 StartBatchIndex uint64 EonPublicKey *shcrypto.EonPublicKey }
EonKeyBroadcast is an action sending a vote for an eon public key to the key broadcast contract.
func (EonKeyBroadcast) SendTX ¶
func (a EonKeyBroadcast) SendTX(caller *contract.Caller, auth *bind.TransactOpts) (*types.Transaction, error)
func (EonKeyBroadcast) String ¶
func (a EonKeyBroadcast) String() string
type ExecuteCipherBatch ¶
type ExecuteCipherBatch struct { BatchIndex uint64 CipherBatchHash [32]byte Transactions [][]byte KeyperIndex uint64 TransactionGasLimit uint64 }
ExecuteCipherBatch is an Action that instructs the executor contract to execute a cipher batch.
func (ExecuteCipherBatch) IsExpired ¶
func (a ExecuteCipherBatch) IsExpired(world observe.World) bool
func (ExecuteCipherBatch) SendTX ¶
func (a ExecuteCipherBatch) SendTX(caller *contract.Caller, auth *bind.TransactOpts) (*types.Transaction, error)
func (ExecuteCipherBatch) String ¶
func (a ExecuteCipherBatch) String() string
type ExecutePlainBatch ¶
type ExecutePlainBatch struct { BatchIndex uint64 Transactions [][]byte TransactionGasLimit uint64 }
ExecutePlainBatch is an Action that instructs the executor contract to execute a plain batch.
func (ExecutePlainBatch) SendTX ¶
func (a ExecutePlainBatch) SendTX(caller *contract.Caller, auth *bind.TransactOpts) (*types.Transaction, error)
func (ExecutePlainBatch) String ¶
func (a ExecutePlainBatch) String() string
type IAction ¶
type IAction interface { // IsExpired checks if the action expired because some time limit is reached or because the // result of the action has been achieved (we or someone else may have performed the same // action). We could think about having a dedicated IsDone method. IsExpired(world observe.World) bool }
IAction describes an action to run as determined by the Decider's Decide method.
type IRetriable ¶
IRetriable is an error that knows if it makes sense to retry an action.
type MainChainTX ¶
type MainChainTX interface { IAction SendTX(caller *contract.Caller, auth *bind.TransactOpts) (*types.Transaction, error) }
MainChainTX is an action that sends a transaction to the main chain.
type MessageSender ¶
MessageSender defines the interface of sending messages to shuttermint.
type MockMessageSender ¶
MockMessageSender sends all messages to a channel so that they can be checked for testing.
func NewMockMessageSender ¶
func NewMockMessageSender() MockMessageSender
NewMockMessageSender creates a new MockMessageSender. We use a buffered channel with a rather large size in order to simplify writing our tests.
func (*MockMessageSender) SendMessage ¶
type NonRetriableError ¶
type NonRetriableError struct {
Err error
}
func (*NonRetriableError) Error ¶
func (e *NonRetriableError) Error() string
func (*NonRetriableError) IsRetriable ¶
func (*NonRetriableError) IsRetriable() bool
func (*NonRetriableError) Unwrap ¶
func (e *NonRetriableError) Unwrap() error
type PendingActions ¶
type PendingActions struct { ActionMap map[ActionID]IAction MainChainTXHashes map[ActionID]common.Hash CurrentID ActionID // contains filtered or unexported fields }
PendingActions contains information about the actions, which are currently running or are scheduled to be run. This struct is stored on disk with gob. We enumerate the actions the decider gives us.
func NewPendingActions ¶
func NewPendingActions(path string) *PendingActions
NewPendingActions creates a empty PendingActions struct.
func (*PendingActions) AddActions ¶
func (pending *PendingActions) AddActions(id ActionID, actions []IAction) (ActionID, ActionID)
AddActions adds the given actions unless they have already been added. id is the ActionID of the first action. It returns a startID, endID tuple of actions to be scheduled.
func (*PendingActions) GetAction ¶
func (pending *PendingActions) GetAction(id ActionID) IAction
GetAction returns the action with the given id.
func (*PendingActions) GetMainChainTXHash ¶
func (pending *PendingActions) GetMainChainTXHash(id ActionID) common.Hash
GetMainChainTXHash returns the transaction hash for the given main chain action.
func (*PendingActions) Load ¶
func (pending *PendingActions) Load() error
Load loads pending actions from disk.
func (*PendingActions) RemoveAction ¶
func (pending *PendingActions) RemoveAction(id ActionID)
RemoveAction removes the action with the given id.
func (*PendingActions) SetMainChainTXHash ¶
func (pending *PendingActions) SetMainChainTXHash(id ActionID, hash common.Hash)
SetMainChainTXHash sets the transaction hash for the given main chain action.
func (*PendingActions) ShortInfo ¶
func (pending *PendingActions) ShortInfo() string
func (*PendingActions) SortedIDs ¶
func (pending *PendingActions) SortedIDs() []ActionID
SortedIDs returns the sorted pending action ids.
type RPCMessageSender ¶
type RPCMessageSender struct {
// contains filtered or unexported fields
}
RPCMessageSender signs messages and sends them via RPC to shuttermint.
func NewRPCMessageSender ¶
func NewRPCMessageSender(cl client.Client, signingKey *ecdsa.PrivateKey) RPCMessageSender
NewRPCMessageSender creates a new RPCMessageSender.
func (*RPCMessageSender) SendMessage ¶
SendMessage signs the given shmsg.Message and sends the message to shuttermint.
type RemoteError ¶
type RemoteError struct {
// contains filtered or unexported fields
}
RemoteError is raised for shuttermint messages that return with a result code != 0, i.e. where the shuttermint app generated an error.
func (*RemoteError) Error ¶
func (remoteError *RemoteError) Error() string
func (*RemoteError) IsRetriable ¶
func (remoteError *RemoteError) IsRetriable() bool
type RunEnv ¶
type RunEnv struct { PendingActions *PendingActions PendingActionsPath string MessageSender MessageSender ContractCaller *contract.Caller // contains filtered or unexported fields }
func (*RunEnv) CurrentWorld ¶
func (*RunEnv) RunActions ¶
type SendShuttermintMessage ¶
SendShuttermintMessage is an Action that sends a message to shuttermint.
func (SendShuttermintMessage) IsExpired ¶
func (a SendShuttermintMessage) IsExpired(world observe.World) bool
func (SendShuttermintMessage) String ¶
func (a SendShuttermintMessage) String() string
type SkipCipherBatch ¶
type SkipCipherBatch struct {
BatchIndex uint64
}
SkipCipherBatch is an Action that instructs the executor contract to skip a cipher batch.
func (SkipCipherBatch) SendTX ¶
func (a SkipCipherBatch) SendTX(caller *contract.Caller, auth *bind.TransactOpts) (*types.Transaction, error)
func (SkipCipherBatch) String ¶
func (a SkipCipherBatch) String() string