Documentation
¶
Overview ¶
Package keyper contains the keyper implementation
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsWebsocketURL ¶
IsWebsocketURL returns true iff the given URL is a websocket URL, i.e. if it starts with ws:// or wss://. This is needed for the watchMainChainHeadBlock method.
Types ¶
type Batch ¶
type Batch struct {
BatchIndex uint64
DecryptionSignatureHash []byte
DecryptedTransactions [][]byte
DecryptedBatchHash []byte
DecryptionSignatureIndex int
VerifiedSignatures map[common.Address][]byte
IsEmpty bool
}
Batch is used to store local state about a single Batch.
func (*Batch) AddSignature ¶
type Config ¶
type Config struct {
ShuttermintURL string
EthereumURL string
DBDir string
SigningKey *ecdsa.PrivateKey
ValidatorKey ed25519.PrivateKey `mapstructure:"ValidatorSeed"`
EncryptionKey *ecies.PrivateKey
ConfigContractAddress common.Address `mapstructure:"ConfigContract"`
BatcherContractAddress common.Address `mapstructure:"BatcherContract"`
KeyBroadcastContractAddress common.Address `mapstructure:"KeyBroadcastContract"`
ExecutorContractAddress common.Address `mapstructure:"ExecutorContract"`
DepositContractAddress common.Address `mapstructure:"DepositContract"`
KeyperSlasherAddress common.Address `mapstructure:"KeyperSlasher"`
MainChainFollowDistance uint64 // in main chain blocks
ExecutionStaggering uint64 // in main chain blocks
DKGPhaseLength uint64 // in shuttermint blocks
GasPriceMultiplier float64
}
Config contains validated configuration parameters for the keyper client.
func (*Config) GenerateNewKeys ¶
GenerateNewKeys generates new keys and stores them inside the Config object.
type DKG ¶
type DKG struct {
Eon uint64
StartBatchIndex uint64
Keypers []common.Address
Pure *puredkg.PureDKG
OutgoingPolyEvalMsgs []puredkg.PolyEvalMsg
PhaseLength PhaseLength
}
DKG is used to store local state about active DKG processes. Each DKG has a corresponding observe.Eon struct stored in observe.Shutter, which we can find with Shutter's FindEon method.
func (*DKG) IsFinalized ¶
type Decider ¶
type Decider struct {
Config Config
State *State
Shutter *observe.Shutter
MainChain *observe.MainChain
Actions []fx.IAction
PhaseLength PhaseLength
}
Decider decides on the next actions to take based on our internal State and the current Shutter and MainChain state for a single step. For each step the keyper creates a new Decider. The actions to run are stored inside the Actions field.
func NewDecider ¶
type Keyper ¶
type Keyper struct {
Config Config // Configuration of the keyper client read from the config file
State *State // keyper's internal state
ContractCaller contract.Caller
MessageSender fx.MessageSender
// contains filtered or unexported fields
}
func (*Keyper) CurrentWorld ¶
type PhaseLength ¶
PhaseLength is used to store the accumulated lengths of the DKG phases.
func NewConstantPhaseLength ¶
func NewConstantPhaseLength(l int64) PhaseLength
NewConstantPhaseLength creates a new phase length definition where each phase has the same length.
type State ¶
type State struct {
CheckInMessageSent bool
LastSentBatchConfigIndex uint64
LastEonStarted uint64
DKGs []DKG
EKGs []*EKG
PendingHalfStep *uint64
PendingAppeals map[uint64]struct{}
Batches map[uint64]*Batch
HalfStepsChecked uint64
// We store the actions that should be executed together with a counter. When starting the
// program, we feed these actions into runenv, which can use the counter to identify the
// actions.
ActionCounter uint64
Actions []fx.IAction
SyncHeight int64
}
State is the keyper's internal state.
func (*State) GetShutterFilter ¶
func (st *State) GetShutterFilter(mainChain *observe.MainChain) observe.ShutterFilter
GetShutterFilter returns the shutter filter to be applied to the Shutter state.
Directories
¶
| Path | Synopsis |
|---|---|
|
epochkg implements the epoch key generation given the result of a successful DKG generation with puredkg
|
epochkg implements the epoch key generation given the result of a successful DKG generation with puredkg |
|
Package fx is used to effect changes on the outside world, i.e.
|
Package fx is used to effect changes on the outside world, i.e. |
|
Package gaspricer is used to multiply the gas price by a configurable factor.
|
Package gaspricer is used to multiply the gas price by a configurable factor. |
|
Package observe contains the MainChain and Shutter structs, which the keyper uses to fetch the necessary information from the ethereum node and the shuttermint node.
|
Package observe contains the MainChain and Shutter structs, which the keyper uses to fetch the necessary information from the ethereum node and the shuttermint node. |
|
Package puredkg implements the DKG protocol.
|
Package puredkg implements the DKG protocol. |
|
Package shutterevents contains types to represent deserialized shuttermint/tendermint events
|
Package shutterevents contains types to represent deserialized shuttermint/tendermint events |
|
evtype
evtype declares the the different event types sent by shuttermint
|
evtype declares the the different event types sent by shuttermint |