keeper

package
v0.26.5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QuerySignature                = "signature"
	QueryKey                      = "key"
	QueryRecovery                 = "recovery"
	QueryKeyID                    = "key-id"
	QueryKeySharesByKeyID         = "key-share-id"
	QueryKeySharesByValidator     = "key-share-validator"
	QueryActiveOldKeys            = "active-old-keys"
	QueryActiveOldKeysByValidator = "active-old-keys-validator"
	QueryDeactivated              = "deactivated"
	QExternalKeyID                = "external-key-id"
)

Query paths

Variables

This section is empty.

Functions

func GetMigrationHandler added in v0.18.0

func GetMigrationHandler(tss Keeper, multisig types.MultiSigKeeper, nexus types.Nexus, snapshotter types.Snapshotter) func(ctx sdk.Context) error

GetMigrationHandler returns the handler that performs in-place store migrations from v0.19 to v0.20. The migration includes: - migrating active old keys, the current active key and the next key in rotation for all chains to the multisig module

func NewMsgServerImpl

func NewMsgServerImpl(keeper types.TSSKeeper, s types.Snapshotter, staker types.StakingKeeper, multisig types.MultiSigKeeper) types.MsgServiceServer

NewMsgServerImpl returns an implementation of the broadcast MsgServiceServer interface for the provided Keeper.

func NewQuerier

NewQuerier returns a new querier for the TSS module

func QueryExternalKeyID

func QueryExternalKeyID(ctx sdk.Context, k types.TSSKeeper, n types.Nexus, chainStr string) ([]byte, error)

QueryExternalKeyID returns the keyIDs of the current set of external keys for the given chain

Types

type Keeper

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

Keeper allows access to the broadcast state

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec, storeKey sdk.StoreKey, paramSpace params.Subspace, slasher types.Slasher, rewarder types.Rewarder) Keeper

NewKeeper constructs a tss keeper

func (Keeper) AssertMatchesRequirements

func (k Keeper) AssertMatchesRequirements(ctx sdk.Context, snapshotter snapshot.Snapshotter, chain nexus.Chain, keyID exported.KeyID, keyRole exported.KeyRole) error

AssertMatchesRequirements checks if the properties of the given key match the requirements for the given role

func (Keeper) AssignNextKey

func (k Keeper) AssignNextKey(ctx sdk.Context, chain nexus.Chain, keyRole exported.KeyRole, keyID exported.KeyID) error

AssignNextKey stores a new key for a given chain which will become the default once RotateKey is called

func (Keeper) DeleteInfoForSig

func (k Keeper) DeleteInfoForSig(ctx sdk.Context, sigID string)

DeleteInfoForSig deletes the key ID associated with the given signature

func (Keeper) DeleteKeyRecoveryInfo added in v0.9.0

func (k Keeper) DeleteKeyRecoveryInfo(ctx sdk.Context, keyID exported.KeyID)

DeleteKeyRecoveryInfo deletes the key recovery info for the given key ID

func (Keeper) DeleteKeygenStart

func (k Keeper) DeleteKeygenStart(ctx sdk.Context, keyID exported.KeyID)

DeleteKeygenStart deletes the start height for the given key

func (Keeper) DeleteMultisigKeygen

func (k Keeper) DeleteMultisigKeygen(ctx sdk.Context, keyID exported.KeyID)

DeleteMultisigKeygen deletes the multisig keygen info for the given key ID

func (Keeper) DeleteMultisigSign

func (k Keeper) DeleteMultisigSign(ctx sdk.Context, signID string)

DeleteMultisigSign deletes the multisig sign info for the given sig ID

func (Keeper) DeleteSnapshotCounterForKeyID

func (k Keeper) DeleteSnapshotCounterForKeyID(ctx sdk.Context, keyID exported.KeyID)

DeleteSnapshotCounterForKeyID deletes the snapshot counter for the given key

func (Keeper) DoesValidatorParticipateInSign

func (k Keeper) DoesValidatorParticipateInSign(ctx sdk.Context, sigID string, validator sdk.ValAddress) bool

DoesValidatorParticipateInSign returns true if given validator participates in signing for the given sig ID; otherwise, false

func (Keeper) ExportGenesis added in v0.9.0

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the tss module's genesis state.

func (Keeper) GetAvailableOperators

func (k Keeper) GetAvailableOperators(ctx sdk.Context, keyIDs ...exported.KeyID) []sdk.ValAddress

GetAvailableOperators gets all operators that still have a non-stale heartbeat

func (Keeper) GetCurrentKey

func (k Keeper) GetCurrentKey(ctx sdk.Context, chain nexus.Chain, keyRole exported.KeyRole) (exported.Key, bool)

GetCurrentKey returns the current key for given chain and role

func (Keeper) GetCurrentKeyID

func (k Keeper) GetCurrentKeyID(ctx sdk.Context, chain nexus.Chain, keyRole exported.KeyRole) (exported.KeyID, bool)

GetCurrentKeyID returns the current key ID for given chain and role

func (Keeper) GetExternalKeyIDs

func (k Keeper) GetExternalKeyIDs(ctx sdk.Context, chain nexus.Chain) ([]exported.KeyID, bool)

GetExternalKeyIDs retrieves the current list of external key IDs

func (Keeper) GetExternalMultisigThreshold

func (k Keeper) GetExternalMultisigThreshold(ctx sdk.Context) utils.Threshold

GetExternalMultisigThreshold returns the external multisig threshold

func (Keeper) GetGroupRecoveryInfo

func (k Keeper) GetGroupRecoveryInfo(ctx sdk.Context, keyID exported.KeyID) []byte

GetGroupRecoveryInfo returns the group recovery info for the given key ID

func (Keeper) GetHeartbeatPeriodInBlocks

func (k Keeper) GetHeartbeatPeriodInBlocks(ctx sdk.Context) int64

GetHeartbeatPeriodInBlocks returns the heartbeat event period

func (Keeper) GetInfoForSig

func (k Keeper) GetInfoForSig(ctx sdk.Context, sigID string) (exported.SignInfo, bool)

GetInfoForSig stores key ID for the given sig ID

func (Keeper) GetKey

func (k Keeper) GetKey(ctx sdk.Context, keyID exported.KeyID) (key exported.Key, ok bool)

GetKey returns the key for a given ID, if it exists

func (Keeper) GetKeyByRotationCount

func (k Keeper) GetKeyByRotationCount(ctx sdk.Context, chain nexus.Chain, keyRole exported.KeyRole, rotationCount int64) (exported.Key, bool)

GetKeyByRotationCount returns the key for given chain and key role by rotation count

func (Keeper) GetKeyRequirement

func (k Keeper) GetKeyRequirement(ctx sdk.Context, keyRole exported.KeyRole, keyType exported.KeyType) (exported.KeyRequirement, bool)

GetKeyRequirement gets the key requirement for a given chain of a given role

func (Keeper) GetKeyRole

func (k Keeper) GetKeyRole(ctx sdk.Context, keyID exported.KeyID) exported.KeyRole

GetKeyRole returns the role of the given key

func (Keeper) GetKeyType

func (k Keeper) GetKeyType(ctx sdk.Context, keyID exported.KeyID) exported.KeyType

GetKeyType returns the key type of the given keyID

func (Keeper) GetKeyUnbondingLockingKeyRotationCount

func (k Keeper) GetKeyUnbondingLockingKeyRotationCount(ctx sdk.Context) int64

GetKeyUnbondingLockingKeyRotationCount returns the number of key iterations share holds must stay before they can unbond

func (Keeper) GetMaxMissedBlocksPerWindow

func (k Keeper) GetMaxMissedBlocksPerWindow(ctx sdk.Context) utils.Threshold

GetMaxMissedBlocksPerWindow returns the maximum percent of blocks a validator is allowed to miss per signing window

func (Keeper) GetMaxSimultaneousSignShares

func (k Keeper) GetMaxSimultaneousSignShares(ctx sdk.Context) int64

GetMaxSimultaneousSignShares returns the max simultaneous number of sign shares

func (Keeper) GetMultisigKeygenInfo

func (k Keeper) GetMultisigKeygenInfo(ctx sdk.Context, keyID exported.KeyID) (types.MultisigKeygenInfo, bool)

GetMultisigKeygenInfo returns the MultisigKeygenInfo

func (Keeper) GetMultisigKeygenQueue

func (k Keeper) GetMultisigKeygenQueue(ctx sdk.Context) utils.SequenceKVQueue

GetMultisigKeygenQueue returns the multisig keygen timeout queue

func (Keeper) GetMultisigPubKeysByValidator

func (k Keeper) GetMultisigPubKeysByValidator(ctx sdk.Context, keyID exported.KeyID, val sdk.ValAddress) ([]ecdsa.PublicKey, bool)

GetMultisigPubKeysByValidator returns the pub keys a validator has for the given keyID

func (Keeper) GetMultisigSignInfo

func (k Keeper) GetMultisigSignInfo(ctx sdk.Context, sigID string) (types.MultisigSignInfo, bool)

GetMultisigSignInfo returns the MultisigSignInfo

func (Keeper) GetMultisigSignQueue

func (k Keeper) GetMultisigSignQueue(ctx sdk.Context) utils.SequenceKVQueue

GetMultisigSignQueue returns the multisig sign timeout queue

func (Keeper) GetNextKey

func (k Keeper) GetNextKey(ctx sdk.Context, chain nexus.Chain, keyRole exported.KeyRole) (exported.Key, bool)

GetNextKey returns the next key for given chain and role

func (Keeper) GetNextKeyID

func (k Keeper) GetNextKeyID(ctx sdk.Context, chain nexus.Chain, keyRole exported.KeyRole) (exported.KeyID, bool)

GetNextKeyID returns the next key ID for given chain and role

func (Keeper) GetOldActiveKeyIDs

func (k Keeper) GetOldActiveKeyIDs(ctx sdk.Context, chain nexus.Chain, keyRole exported.KeyRole) ([]exported.KeyID, error)

GetOldActiveKeyIDs gets all the old key IDs of given key role that are still active for chain

func (Keeper) GetOldActiveKeys

func (k Keeper) GetOldActiveKeys(ctx sdk.Context, chain nexus.Chain, keyRole exported.KeyRole) ([]exported.Key, error)

GetOldActiveKeys gets all the old keys of given key role that are still active for chain

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams gets the tss module's parameters

func (Keeper) GetPrivateRecoveryInfo

func (k Keeper) GetPrivateRecoveryInfo(ctx sdk.Context, validator sdk.ValAddress, keyID exported.KeyID) []byte

GetPrivateRecoveryInfo returns the private recovery info for the given validator of the given key ID

func (Keeper) GetRotationCount

func (k Keeper) GetRotationCount(ctx sdk.Context, chain nexus.Chain, keyRole exported.KeyRole) int64

GetRotationCount returns the current rotation count for the given chain and key role

func (Keeper) GetRotationCountOfKeyID

func (k Keeper) GetRotationCountOfKeyID(ctx sdk.Context, keyID exported.KeyID) (int64, bool)

GetRotationCountOfKeyID returns the rotation count of the given key ID

func (Keeper) GetRouter

func (k Keeper) GetRouter() types.Router

GetRouter returns the tss router. If no router was set, it returns a (sealed) router with no handlers

func (Keeper) GetSig

func (k Keeper) GetSig(ctx sdk.Context, sigID string) (exported.Signature, exported.SigStatus)

GetSig returns the signature associated with sigID or nil, nil if no such signature exists

func (Keeper) GetSignParticipants

func (k Keeper) GetSignParticipants(ctx sdk.Context, sigID string) []string

GetSignParticipants returns the list of participants for specified sig ID

func (Keeper) GetSignParticipantsAsJSON

func (k Keeper) GetSignParticipantsAsJSON(ctx sdk.Context, sigID string) []byte

GetSignParticipantsAsJSON returns the list of participants for specified sig ID in JSON format

func (Keeper) GetSignParticipantsShares

func (k Keeper) GetSignParticipantsShares(ctx sdk.Context, sigID string) []int64

GetSignParticipantsShares returns the list of participants share counts for specified sig ID

func (Keeper) GetSignParticipantsSharesAsJSON

func (k Keeper) GetSignParticipantsSharesAsJSON(ctx sdk.Context, sigID string) []byte

GetSignParticipantsSharesAsJSON returns the list of participant share counts for specified sig ID in JSON format

func (Keeper) GetSignQueue

func (k Keeper) GetSignQueue(ctx sdk.Context) utils.SequenceKVQueue

GetSignQueue returns the sign queue

func (Keeper) GetSnapshotCounterForKeyID

func (k Keeper) GetSnapshotCounterForKeyID(ctx sdk.Context, keyID exported.KeyID) (int64, bool)

GetSnapshotCounterForKeyID returns the snapshot round in which the key with the given ID was created, if the key exists

func (Keeper) GetSuspendedUntil added in v0.9.0

func (k Keeper) GetSuspendedUntil(ctx sdk.Context, validator sdk.ValAddress) int64

GetSuspendedUntil returns the block number at which a validator is released from TSS suspension

func (Keeper) HasKeygenStarted added in v0.8.1

func (k Keeper) HasKeygenStarted(ctx sdk.Context, keyID exported.KeyID) bool

HasKeygenStarted returns true if a key session for the given key ID exists; false otherwise

func (Keeper) HasMissedTooManyBlocks added in v0.13.0

func (k Keeper) HasMissedTooManyBlocks(ctx sdk.Context, address sdk.ConsAddress) (bool, error)

HasMissedTooManyBlocks returns true if the given validator address missed too many blocks within the block window specified by this module. The block window used by this function is either the cosmos slashing module window or this own module's window, depending on which one is shorter.

func (Keeper) HasPrivateRecoveryInfo added in v0.9.0

func (k Keeper) HasPrivateRecoveryInfo(ctx sdk.Context, validator sdk.ValAddress, keyID exported.KeyID) bool

HasPrivateRecoveryInfo returns true if the private recovery info for the given validator of the given key ID exists

func (Keeper) InitGenesis added in v0.9.0

func (k Keeper) InitGenesis(ctx sdk.Context, snapshotter types.Snapshotter, genState *types.GenesisState)

InitGenesis initializes the tss module's state from a given genesis state.

func (Keeper) IsMultisigKeygenCompleted

func (k Keeper) IsMultisigKeygenCompleted(ctx sdk.Context, keyID exported.KeyID) bool

IsMultisigKeygenCompleted returns true if multisig keygen completed for the given key ID

func (Keeper) IsOperatorAvailable

func (k Keeper) IsOperatorAvailable(ctx sdk.Context, validator sdk.ValAddress, keyIDs ...exported.KeyID) bool

IsOperatorAvailable returns true if the validator has a non-stale ack and holds the specified keys

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger

func (Keeper) PenalizeCriminal

func (k Keeper) PenalizeCriminal(ctx sdk.Context, criminal sdk.ValAddress, crimeType tofnd.MessageOut_CriminalList_Criminal_CrimeType)

PenalizeCriminal penalizes the criminal caught during tss protocol according to the given crime type

func (Keeper) RotateKey

func (k Keeper) RotateKey(ctx sdk.Context, chain nexus.Chain, keyRole exported.KeyRole) error

RotateKey rotates to the next stored key. Returns an error if no new key has been prepared

func (Keeper) SetAvailableOperator

func (k Keeper) SetAvailableOperator(ctx sdk.Context, validator sdk.ValAddress, presentKeys ...exported.KeyID)

SetAvailableOperator signals that a validator sent an ack

func (Keeper) SetExternalKeyIDs

func (k Keeper) SetExternalKeyIDs(ctx sdk.Context, chain nexus.Chain, keyIDs []exported.KeyID)

SetExternalKeyIDs stores the given list of external key IDs

func (Keeper) SetGroupRecoveryInfo

func (k Keeper) SetGroupRecoveryInfo(ctx sdk.Context, keyID exported.KeyID, recoveryInfo []byte)

SetGroupRecoveryInfo sets the group recovery info for the given key ID

func (Keeper) SetInfoForSig

func (k Keeper) SetInfoForSig(ctx sdk.Context, sigID string, info exported.SignInfo)

SetInfoForSig stores key ID for the given sig ID

func (Keeper) SetKey

func (k Keeper) SetKey(ctx sdk.Context, key exported.Key)

SetKey stores the given public key under the given key ID

func (Keeper) SetMultisigKeygenInfo

func (k Keeper) SetMultisigKeygenInfo(ctx sdk.Context, info types.MultisigInfo)

SetMultisigKeygenInfo store the MultisigKeygenInfo

func (Keeper) SetMultisigSignInfo

func (k Keeper) SetMultisigSignInfo(ctx sdk.Context, info types.MultisigInfo)

SetMultisigSignInfo stores the MultisigInfo for a multisig sign info

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, p types.Params)

SetParams sets the tss module's parameters

func (Keeper) SetPrivateRecoveryInfo

func (k Keeper) SetPrivateRecoveryInfo(ctx sdk.Context, validator sdk.ValAddress, keyID exported.KeyID, recoveryInfo []byte)

SetPrivateRecoveryInfo sets the private recovery info for the given validator of the given key ID

func (*Keeper) SetRouter

func (k *Keeper) SetRouter(router types.Router)

SetRouter sets the tss router. It will panic if called more than once

func (Keeper) SetSig

func (k Keeper) SetSig(ctx sdk.Context, signature exported.Signature)

SetSig stores the given signature

func (Keeper) SetSigStatus

func (k Keeper) SetSigStatus(ctx sdk.Context, sigID string, status exported.SigStatus)

SetSigStatus defines the status of some sign sig ID

func (Keeper) StartKeygen

func (k Keeper) StartKeygen(ctx sdk.Context, voter types.Voter, keyInfo types.KeyInfo, snapshot snapshot.Snapshot) error

StartKeygen starts a keygen protocol with the specified parameters

func (Keeper) StartSign

func (k Keeper) StartSign(ctx sdk.Context, info exported.SignInfo, snapshotter types.Snapshotter, voter types.InitPoller) error

StartSign kickstarts signing

func (Keeper) SubmitPubKeys

func (k Keeper) SubmitPubKeys(ctx sdk.Context, keyID exported.KeyID, validator sdk.ValAddress, pubKeys ...[]byte) bool

SubmitPubKeys stores public keys a validator has under the given multisig key ID

func (Keeper) SubmitSignatures

func (k Keeper) SubmitSignatures(ctx sdk.Context, sigID string, validator sdk.ValAddress, sigs ...[]byte) bool

SubmitSignatures stores signatures a validator has under the given multisig sigID

type Querier added in v0.17.0

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

Querier implements the grpc queries for the tss module

func NewGRPCQuerier added in v0.17.0

func NewGRPCQuerier(k types.TSSKeeper, n types.Nexus, s types.StakingKeeper) Querier

NewGRPCQuerier creates a new tss Querier

func (Querier) AssignableKey added in v0.17.0

AssignableKey returns true if there is assign

func (Querier) NextKeyID added in v0.17.0

NextKeyID returns the key ID assigned for the next rotation on a given chain and for the given key role

func (Querier) ValidatorMultisigKeys added in v0.17.1

ValidatorMultisigKeys returns a map of active multisig role key ids to pub keys of a validator

Jump to

Keyboard shortcuts

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