keeper

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

Types

type BlsSigner

type BlsSigner interface {
	GetAddress() sdk.ValAddress
	SignMsgWithBls(msg []byte) (bls12381.Signature, error)
	GetBlsPubkey() (bls12381.PublicKey, error)
}

type CheckpointsState

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

func (CheckpointsState) CreateRawCkptWithMeta

func (cs CheckpointsState) CreateRawCkptWithMeta(ckptWithMeta *types.RawCheckpointWithMeta) error

CreateRawCkptWithMeta inserts the raw checkpoint with meta into the storage by its epoch number a new checkpoint is created with the status of UNCEHCKPOINTED

func (CheckpointsState) GetRawCkptWithMeta

func (cs CheckpointsState) GetRawCkptWithMeta(epoch uint64) (*types.RawCheckpointWithMeta, error)

GetRawCkptWithMeta retrieves a raw checkpoint with meta by its epoch number

func (CheckpointsState) GetRawCkptsWithMetaByStatus

func (cs CheckpointsState) GetRawCkptsWithMetaByStatus(status types.CheckpointStatus, f func(*types.RawCheckpointWithMeta) bool) error

GetRawCkptsWithMetaByStatus retrieves raw checkpoints with meta by their status by the descending order of epoch

func (CheckpointsState) UpdateCheckpoint

func (cs CheckpointsState) UpdateCheckpoint(ckpt *types.RawCheckpointWithMeta) error

UpdateCheckpoint overwrites an existing checkpoint

func (CheckpointsState) UpdateCkptStatus

func (cs CheckpointsState) UpdateCkptStatus(ckpt *types.RawCheckpoint, status types.CheckpointStatus) error

UpdateCkptStatus updates the checkpoint's status

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	signer BlsSigner,
	ek types.EpochingKeeper,
	clientCtx client.Context,
) Keeper

func (Keeper) AddRawCheckpoint

func (k Keeper) AddRawCheckpoint(ctx sdk.Context, ckptWithMeta *types.RawCheckpointWithMeta) error

AddRawCheckpoint adds a raw checkpoint into the storage

func (Keeper) AfterBlsKeyRegistered

func (k Keeper) AfterBlsKeyRegistered(ctx sdk.Context, valAddr sdk.ValAddress) error

AfterBlsKeyRegistered - call hook if registered

func (Keeper) AfterRawCheckpointBlsSigVerified

func (k Keeper) AfterRawCheckpointBlsSigVerified(ctx sdk.Context, ckpt *types.RawCheckpoint) error

AfterRawCheckpointBlsSigVerified - call hook if the checkpoint's BLS sig is verified

func (Keeper) AfterRawCheckpointConfirmed

func (k Keeper) AfterRawCheckpointConfirmed(ctx sdk.Context, epoch uint64) error

AfterRawCheckpointConfirmed - call hook if the checkpoint is confirmed

func (Keeper) AfterRawCheckpointFinalized

func (k Keeper) AfterRawCheckpointFinalized(ctx sdk.Context, epoch uint64) error

AfterRawCheckpointFinalized - call hook if the checkpoint is finalized

func (Keeper) AfterRawCheckpointForgotten

func (k Keeper) AfterRawCheckpointForgotten(ctx sdk.Context, ckpt *types.RawCheckpoint) error

func (Keeper) BuildRawCheckpoint

func (k Keeper) BuildRawCheckpoint(ctx sdk.Context, epochNum uint64, lch types.LastCommitHash) (*types.RawCheckpointWithMeta, error)

func (Keeper) CheckpointsState

func (k Keeper) CheckpointsState(ctx sdk.Context) CheckpointsState

func (Keeper) ClearValidatorSet

func (k Keeper) ClearValidatorSet(ctx sdk.Context, epochNumber uint64)

ClearValidatorSet removes the validator BLS set of a given epoch TODO: This is called upon the epoch is checkpointed

func (Keeper) CreateRegistration

func (k Keeper) CreateRegistration(ctx sdk.Context, blsPubKey bls12381.PublicKey, valAddr sdk.ValAddress) error

func (Keeper) EpochStatus

EpochStatus returns the status of the checkpoint at a given epoch

func (Keeper) GetBLSPubKeySet

func (k Keeper) GetBLSPubKeySet(ctx sdk.Context, epochNumber uint64) ([]*types.ValidatorWithBlsKey, error)

GetBLSPubKeySet returns the set of BLS public keys in the same order of the validator set for a given epoch

func (Keeper) GetBlsPubKey

func (k Keeper) GetBlsPubKey(ctx sdk.Context, address sdk.ValAddress) (bls12381.PublicKey, error)

func (Keeper) GetCurrentValidatorBlsKeySet

func (k Keeper) GetCurrentValidatorBlsKeySet(ctx sdk.Context) *types.ValidatorWithBlsKeySet

func (Keeper) GetEpoch

func (k Keeper) GetEpoch(ctx sdk.Context) *epochingtypes.Epoch

func (Keeper) GetLastCheckpointedEpoch

func (k Keeper) GetLastCheckpointedEpoch(ctx sdk.Context) (uint64, error)

GetLastCheckpointedEpoch returns the last epoch number that associates with a checkpoint

func (Keeper) GetRawCheckpoint

func (k Keeper) GetRawCheckpoint(ctx sdk.Context, epochNum uint64) (*types.RawCheckpointWithMeta, error)

func (Keeper) GetStatus

func (k Keeper) GetStatus(ctx sdk.Context, epochNum uint64) (types.CheckpointStatus, error)

func (Keeper) GetTotalVotingPower

func (k Keeper) GetTotalVotingPower(ctx sdk.Context, epochNumber uint64) int64

func (Keeper) GetValidatorBlsKeySet

func (k Keeper) GetValidatorBlsKeySet(ctx sdk.Context, epochNumber uint64) *types.ValidatorWithBlsKeySet

GetValidatorBlsKeySet returns the set of validators of a given epoch with BLS public key the validators are ordered by their address in ascending order

func (Keeper) GetValidatorSet

func (k Keeper) GetValidatorSet(ctx sdk.Context, epochNumber uint64) epochingtypes.ValidatorSet

func (Keeper) InitValidatorBLSSet

func (k Keeper) InitValidatorBLSSet(ctx sdk.Context) error

InitValidatorBLSSet stores the validator set with BLS keys in the beginning of the current epoch This is called upon BeginBlock

func (Keeper) LastCheckpointWithStatus

LastCheckpointWithStatus returns the last checkpoint with the given status if the checkpoint with the given status does not exist, return the last checkpoint that is more mature than the given status

func (Keeper) Logger

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

func (Keeper) RawCheckpoint

RawCheckpoint returns a checkpoint by epoch number

func (Keeper) RawCheckpointList

RawCheckpointList returns a list of checkpoint by status in the ascending order of epoch

func (Keeper) RawCheckpoints added in v0.6.0

RawCheckpoints returns checkpoints for given epoch range specified in pagination params

func (Keeper) RecentEpochStatusCount

RecentEpochStatusCount returns the count of epochs with each status of the checkpoint

func (Keeper) RegistrationState

func (k Keeper) RegistrationState(ctx sdk.Context) RegistrationState

func (Keeper) SendBlsSig

func (k Keeper) SendBlsSig(ctx sdk.Context, epochNum uint64, lch types.LastCommitHash, valSet epochingtypes.ValidatorSet) error

SendBlsSig prepares a BLS signature message and sends it to Tendermint

func (Keeper) SetCheckpointConfirmed

func (k Keeper) SetCheckpointConfirmed(ctx sdk.Context, epoch uint64)

SetCheckpointConfirmed sets the status of a checkpoint to CONFIRMED, and records the associated state update in lifecycle

func (Keeper) SetCheckpointFinalized

func (k Keeper) SetCheckpointFinalized(ctx sdk.Context, epoch uint64)

SetCheckpointFinalized sets the status of a checkpoint to FINALIZED, and records the associated state update in lifecycle

func (Keeper) SetCheckpointForgotten

func (k Keeper) SetCheckpointForgotten(ctx sdk.Context, epoch uint64)

SetCheckpointForgotten rolls back the status of a checkpoint to Sealed, and records the associated state update in lifecycle

func (Keeper) SetCheckpointSubmitted

func (k Keeper) SetCheckpointSubmitted(ctx sdk.Context, epoch uint64)

SetCheckpointSubmitted sets the status of a checkpoint to SUBMITTED, and records the associated state update in lifecycle

func (*Keeper) SetEpochingKeeper

func (k *Keeper) SetEpochingKeeper(ek types.EpochingKeeper)

func (Keeper) SetGenBlsKeys

func (k Keeper) SetGenBlsKeys(ctx sdk.Context, genKeys []*types.GenesisKey)

SetGenBlsKeys registers BLS keys with each validator at genesis

func (*Keeper) SetHooks

func (k *Keeper) SetHooks(sh types.CheckpointingHooks) *Keeper

SetHooks sets the validator hooks

func (Keeper) UpdateCheckpoint

func (k Keeper) UpdateCheckpoint(ctx sdk.Context, ckptWithMeta *types.RawCheckpointWithMeta) error

func (Keeper) VerifyCheckpoint

func (k Keeper) VerifyCheckpoint(ctx sdk.Context, checkpoint txformat.RawBtcCheckpoint) error

VerifyCheckpoint verifies checkpoint from BTC. It verifies the raw checkpoint and decides whether it is an invalid checkpoint or a conflicting checkpoint. A conflicting checkpoint indicates the existence of a fork

type RegistrationState

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

func (RegistrationState) CreateRegistration

func (rs RegistrationState) CreateRegistration(key bls12381.PublicKey, valAddr sdk.ValAddress) error

CreateRegistration inserts the BLS key into the addr -> key and key -> addr storage

func (RegistrationState) Exists

func (rs RegistrationState) Exists(addr sdk.ValAddress) bool

Exists checks whether a BLS key exists

func (RegistrationState) GetBlsPubKey

func (rs RegistrationState) GetBlsPubKey(addr sdk.ValAddress) (bls12381.PublicKey, error)

GetBlsPubKey retrieves BLS public key by validator's address

Jump to

Keyboard shortcuts

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