Documentation
¶
Index ¶
- Variables
- type Keeper
- func (k *Keeper) ActiveSetByHeight(ctx context.Context, height uint64) (*types.ValidatorSetResponse, error)
- func (k *Keeper) EndBlock(ctx context.Context) ([]abci.ValidatorUpdate, error)
- func (k *Keeper) InsertGenesisSet(ctx context.Context) error
- func (k *Keeper) ValidatorSet(ctx context.Context, req *types.ValidatorSetRequest) (*types.ValidatorSetResponse, error)
- type Validator
- func (v *Validator) Address() (common.Address, error)
- func (v *Validator) CometPubkey() crypto.PublicKey
- func (*Validator) Descriptor() ([]byte, []int)deprecated
- func (x *Validator) GetId() uint64
- func (x *Validator) GetPower() int64
- func (x *Validator) GetPubKey() []byte
- func (x *Validator) GetUpdated() bool
- func (x *Validator) GetValsetId() uint64
- func (*Validator) ProtoMessage()
- func (x *Validator) ProtoReflect() protoreflect.Message
- func (x *Validator) Reset()
- func (x *Validator) String() string
- func (v *Validator) ValidatorUpdate() abci.ValidatorUpdate
- type ValidatorIdIndexKey
- type ValidatorIndexKey
- type ValidatorIterator
- type ValidatorPrimaryKey
- type ValidatorSet
- func (*ValidatorSet) Descriptor() ([]byte, []int)deprecated
- func (x *ValidatorSet) GetActivatedHeight() uint64
- func (x *ValidatorSet) GetAttested() bool
- func (x *ValidatorSet) GetCreatedHeight() uint64
- func (x *ValidatorSet) GetId() uint64
- func (*ValidatorSet) ProtoMessage()
- func (x *ValidatorSet) ProtoReflect() protoreflect.Message
- func (x *ValidatorSet) Reset()
- func (x *ValidatorSet) String() string
- type ValidatorSetAttestedCreatedHeightIndexKey
- type ValidatorSetIdIndexKey
- type ValidatorSetIndexKey
- type ValidatorSetIterator
- type ValidatorSetPrimaryKey
- type ValidatorSetTable
- type ValidatorTable
- type ValidatorValsetIdIndexKey
- type ValsetStore
Constants ¶
This section is empty.
Variables ¶
var File_halo_valsync_keeper_valset_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, sKeeper types.StakingKeeper, aKeeper types.AttestKeeper, subscriber types.ValSetSubscriber, ) (*Keeper, error)
func (*Keeper) ActiveSetByHeight ¶
func (k *Keeper) ActiveSetByHeight(ctx context.Context, height uint64) (*types.ValidatorSetResponse, error)
ActiveSetByHeight returns the active cometBFT validator set at the given height.
func (*Keeper) EndBlock ¶
EndBlock has two responsibilities:
1. It wraps the staking module EndBlocker, intercepting the resulting validator updates and storing it as the next unattested validator set (to be attested to by current validator set before it can be sent to cometBFT).
2. It checks if any previously unattested validator set has been attested to, marks it as so, and returns its updates to pass along to cometBFT to activate that new set.
func (*Keeper) InsertGenesisSet ¶
InsertGenesisSet inserts the current genesis validator set into the database. This should only be called during InitGenesis AFTER the staking module's InitGenesis.
func (*Keeper) ValidatorSet ¶
func (k *Keeper) ValidatorSet(ctx context.Context, req *types.ValidatorSetRequest) (*types.ValidatorSetResponse, error)
type Validator ¶
type Validator struct { Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // Auto-incremented ID ValsetId uint64 `protobuf:"varint,2,opt,name=valset_id,json=valsetId,proto3" json:"valset_id,omitempty"` // ValidatorSet ID to which this validator belongs PubKey []byte `protobuf:"bytes,3,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` // Validator public key Power int64 `protobuf:"varint,4,opt,name=power,proto3" json:"power,omitempty"` // Voting power of the validator Updated bool `protobuf:"varint,5,opt,name=updated,proto3" json:"updated,omitempty"` // Whether this validator was updated in this set (wrt previous set) // contains filtered or unexported fields }
Validator represents a single validator in a validator set.
func (*Validator) CometPubkey ¶
CometPubkey returns the cometBFT public key of the validator.
func (*Validator) Descriptor
deprecated
func (*Validator) GetUpdated ¶
func (*Validator) GetValsetId ¶
func (*Validator) ProtoMessage ¶
func (*Validator) ProtoMessage()
func (*Validator) ProtoReflect ¶
func (x *Validator) ProtoReflect() protoreflect.Message
func (*Validator) ValidatorUpdate ¶
func (v *Validator) ValidatorUpdate() abci.ValidatorUpdate
ValidatorUpdate returns the validator as a cometBFT validator update.
type ValidatorIdIndexKey ¶
type ValidatorIdIndexKey struct {
// contains filtered or unexported fields
}
func (ValidatorIdIndexKey) WithId ¶
func (this ValidatorIdIndexKey) WithId(id uint64) ValidatorIdIndexKey
type ValidatorIndexKey ¶
type ValidatorIndexKey interface {
// contains filtered or unexported methods
}
type ValidatorIterator ¶
func (ValidatorIterator) Value ¶
func (i ValidatorIterator) Value() (*Validator, error)
type ValidatorPrimaryKey ¶
type ValidatorPrimaryKey = ValidatorIdIndexKey
primary key starting index..
type ValidatorSet ¶
type ValidatorSet struct { Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // Auto-incremented ID CreatedHeight uint64 `protobuf:"varint,2,opt,name=created_height,json=createdHeight,proto3" json:"created_height,omitempty"` // Height this validator set was created at. Attested bool `protobuf:"varint,3,opt,name=attested,proto3" json:"attested,omitempty"` // Whether this validator set has been attested to. ActivatedHeight uint64 `protobuf:"varint,4,opt,name=activated_height,json=activatedHeight,proto3" json:"activated_height,omitempty"` // Height this validator set is activated in cometBFT (0 while not attested). // contains filtered or unexported fields }
ValidatorSet defines a set of consensus chain validators. The genesis set is created and implicitly attested and activated at height 0.
func (*ValidatorSet) Descriptor
deprecated
func (*ValidatorSet) Descriptor() ([]byte, []int)
Deprecated: Use ValidatorSet.ProtoReflect.Descriptor instead.
func (*ValidatorSet) GetActivatedHeight ¶
func (x *ValidatorSet) GetActivatedHeight() uint64
func (*ValidatorSet) GetAttested ¶
func (x *ValidatorSet) GetAttested() bool
func (*ValidatorSet) GetCreatedHeight ¶
func (x *ValidatorSet) GetCreatedHeight() uint64
func (*ValidatorSet) GetId ¶
func (x *ValidatorSet) GetId() uint64
func (*ValidatorSet) ProtoMessage ¶
func (*ValidatorSet) ProtoMessage()
func (*ValidatorSet) ProtoReflect ¶
func (x *ValidatorSet) ProtoReflect() protoreflect.Message
func (*ValidatorSet) Reset ¶
func (x *ValidatorSet) Reset()
func (*ValidatorSet) String ¶
func (x *ValidatorSet) String() string
type ValidatorSetAttestedCreatedHeightIndexKey ¶
type ValidatorSetAttestedCreatedHeightIndexKey struct {
// contains filtered or unexported fields
}
func (ValidatorSetAttestedCreatedHeightIndexKey) WithAttested ¶
func (this ValidatorSetAttestedCreatedHeightIndexKey) WithAttested(attested bool) ValidatorSetAttestedCreatedHeightIndexKey
func (ValidatorSetAttestedCreatedHeightIndexKey) WithAttestedCreatedHeight ¶
func (this ValidatorSetAttestedCreatedHeightIndexKey) WithAttestedCreatedHeight(attested bool, created_height uint64) ValidatorSetAttestedCreatedHeightIndexKey
type ValidatorSetIdIndexKey ¶
type ValidatorSetIdIndexKey struct {
// contains filtered or unexported fields
}
func (ValidatorSetIdIndexKey) WithId ¶
func (this ValidatorSetIdIndexKey) WithId(id uint64) ValidatorSetIdIndexKey
type ValidatorSetIndexKey ¶
type ValidatorSetIndexKey interface {
// contains filtered or unexported methods
}
type ValidatorSetIterator ¶
func (ValidatorSetIterator) Value ¶
func (i ValidatorSetIterator) Value() (*ValidatorSet, error)
type ValidatorSetPrimaryKey ¶
type ValidatorSetPrimaryKey = ValidatorSetIdIndexKey
primary key starting index..
type ValidatorSetTable ¶
type ValidatorSetTable interface { Insert(ctx context.Context, validatorSet *ValidatorSet) error InsertReturningId(ctx context.Context, validatorSet *ValidatorSet) (uint64, error) LastInsertedSequence(ctx context.Context) (uint64, error) Update(ctx context.Context, validatorSet *ValidatorSet) error Save(ctx context.Context, validatorSet *ValidatorSet) error Delete(ctx context.Context, validatorSet *ValidatorSet) error Has(ctx context.Context, id uint64) (found bool, err error) // Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found. Get(ctx context.Context, id uint64) (*ValidatorSet, error) HasByAttestedCreatedHeight(ctx context.Context, attested bool, created_height uint64) (found bool, err error) // GetByAttestedCreatedHeight returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found. GetByAttestedCreatedHeight(ctx context.Context, attested bool, created_height uint64) (*ValidatorSet, error) List(ctx context.Context, prefixKey ValidatorSetIndexKey, opts ...ormlist.Option) (ValidatorSetIterator, error) ListRange(ctx context.Context, from, to ValidatorSetIndexKey, opts ...ormlist.Option) (ValidatorSetIterator, error) DeleteBy(ctx context.Context, prefixKey ValidatorSetIndexKey) error DeleteRange(ctx context.Context, from, to ValidatorSetIndexKey) error // contains filtered or unexported methods }
func NewValidatorSetTable ¶
func NewValidatorSetTable(db ormtable.Schema) (ValidatorSetTable, error)
type ValidatorTable ¶
type ValidatorTable interface { Insert(ctx context.Context, validator *Validator) error InsertReturningId(ctx context.Context, validator *Validator) (uint64, error) LastInsertedSequence(ctx context.Context) (uint64, error) Update(ctx context.Context, validator *Validator) error Save(ctx context.Context, validator *Validator) error Delete(ctx context.Context, validator *Validator) error Has(ctx context.Context, id uint64) (found bool, err error) // Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found. Get(ctx context.Context, id uint64) (*Validator, error) List(ctx context.Context, prefixKey ValidatorIndexKey, opts ...ormlist.Option) (ValidatorIterator, error) ListRange(ctx context.Context, from, to ValidatorIndexKey, opts ...ormlist.Option) (ValidatorIterator, error) DeleteBy(ctx context.Context, prefixKey ValidatorIndexKey) error DeleteRange(ctx context.Context, from, to ValidatorIndexKey) error // contains filtered or unexported methods }
func NewValidatorTable ¶
func NewValidatorTable(db ormtable.Schema) (ValidatorTable, error)
type ValidatorValsetIdIndexKey ¶
type ValidatorValsetIdIndexKey struct {
// contains filtered or unexported fields
}
func (ValidatorValsetIdIndexKey) WithValsetId ¶
func (this ValidatorValsetIdIndexKey) WithValsetId(valset_id uint64) ValidatorValsetIdIndexKey
type ValsetStore ¶ added in v0.1.2
type ValsetStore interface { ValidatorSetTable() ValidatorSetTable ValidatorTable() ValidatorTable // contains filtered or unexported methods }
func NewValsetStore ¶ added in v0.1.2
func NewValsetStore(db ormtable.Schema) (ValsetStore, error)