Documentation
¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQueryServer(k Keeper) types.QueryServer
- type BitmapHelper
- func (bh *BitmapHelper) AND(dst, src []byte)
- func (bh *BitmapHelper) Clear(bitmap []byte)
- func (bh *BitmapHelper) Copy(bitmap []byte) []byte
- func (bh *BitmapHelper) CountInRange(bitmap []byte, start, end int) int
- func (bh *BitmapHelper) IsSet(bitmap []byte, index int) bool
- func (bh *BitmapHelper) NewBitmap(n int) []byte
- func (bh *BitmapHelper) OR(dst, src []byte)
- func (bh *BitmapHelper) PopCount(bitmap []byte) int
- func (bh *BitmapHelper) SetBit(bitmap []byte, index int)
- type Keeper
- func (k Keeper) BuildValidatorIndexMap(ctx sdk.Context) error
- func (k Keeper) CalculateVotedPower(ctx sdk.Context, bitmap []byte) (uint64, error)
- func (k Keeper) CheckQuorum(ctx sdk.Context, votedPower, totalPower uint64) (bool, error)
- func (k Keeper) EndBlocker(ctx sdk.Context) error
- func (k Keeper) GetAttestationBitmap(ctx sdk.Context, height int64) ([]byte, error)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetCurrentEpoch(ctx sdk.Context) uint64
- func (k Keeper) GetEpochBitmap(ctx sdk.Context, epoch uint64) []byte
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetSignature(ctx sdk.Context, height int64, validatorAddr string) ([]byte, error)
- func (k Keeper) GetTotalPower(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetValidatorIndex(ctx sdk.Context, addr string) (uint16, bool)
- func (k Keeper) GetValidatorPower(ctx sdk.Context, index uint16) (uint64, error)
- func (k Keeper) HasSignature(ctx sdk.Context, height int64, validatorAddr string) (bool, error)
- func (k Keeper) IsCheckpointHeight(ctx sdk.Context, height int64) bool
- func (k Keeper) IsInAttesterSet(ctx sdk.Context, addr string) (bool, error)
- func (k Keeper) IsSoftConfirmed(ctx sdk.Context, height int64) (bool, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) PruneOldBitmaps(ctx sdk.Context, currentEpoch uint64) error
- func (k Keeper) RemoveAttesterSetMember(ctx sdk.Context, addr string) error
- func (k Keeper) SetAttestationBitmap(ctx sdk.Context, height int64, bitmap []byte) error
- func (k Keeper) SetAttesterSetMember(ctx sdk.Context, addr string) error
- func (k Keeper) SetEpochBitmap(ctx sdk.Context, epoch uint64, bitmap []byte) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error
- func (k Keeper) SetSignature(ctx sdk.Context, height int64, validatorAddr string, signature []byte) error
- func (k Keeper) SetValidatorIndex(ctx sdk.Context, addr string, index uint16, power uint64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface
func NewQueryServer ¶
func NewQueryServer(k Keeper) types.QueryServer
NewQueryServer creates a new gRPC query server.
Types ¶
type BitmapHelper ¶
type BitmapHelper struct{}
BitmapHelper provides utility functions for bitmap operations
func NewBitmapHelper ¶
func NewBitmapHelper() *BitmapHelper
NewBitmapHelper creates a new bitmap helper
func (*BitmapHelper) AND ¶
func (bh *BitmapHelper) AND(dst, src []byte)
AND performs bitwise AND of two bitmaps
func (*BitmapHelper) Copy ¶
func (bh *BitmapHelper) Copy(bitmap []byte) []byte
Copy creates a copy of the bitmap
func (*BitmapHelper) CountInRange ¶
func (bh *BitmapHelper) CountInRange(bitmap []byte, start, end int) int
CountInRange counts set bits in a range [start, end)
func (*BitmapHelper) IsSet ¶
func (bh *BitmapHelper) IsSet(bitmap []byte, index int) bool
IsSet checks if the bit at index is set
func (*BitmapHelper) NewBitmap ¶
func (bh *BitmapHelper) NewBitmap(n int) []byte
NewBitmap creates a new bitmap for n validators
func (*BitmapHelper) OR ¶
func (bh *BitmapHelper) OR(dst, src []byte)
OR performs bitwise OR of two bitmaps
func (*BitmapHelper) PopCount ¶
func (bh *BitmapHelper) PopCount(bitmap []byte) int
PopCount returns the number of set bits
func (*BitmapHelper) SetBit ¶
func (bh *BitmapHelper) SetBit(bitmap []byte, index int)
SetBit sets the bit at index to 1
type Keeper ¶
type Keeper struct {
// Collections for state management
ValidatorIndex collections.Map[string, uint16]
ValidatorPower collections.Map[uint16, uint64]
AttestationBitmap collections.Map[int64, []byte]
EpochBitmap collections.Map[uint64, []byte]
AttesterSet collections.KeySet[string]
Signatures collections.Map[collections.Pair[int64, string], []byte]
StoredAttestationInfo collections.Map[int64, types.AttestationBitmap]
Params collections.Item[types.Params]
Schema collections.Schema
// contains filtered or unexported fields
}
Keeper of the network store
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, sk types.StakingKeeper, ak types.AccountKeeper, bk types.BankKeeper, authority string, ) Keeper
NewKeeper creates a new network Keeper instance
func (Keeper) BuildValidatorIndexMap ¶
BuildValidatorIndexMap rebuilds the validator index mapping
func (Keeper) CalculateVotedPower ¶
CalculateVotedPower calculates the total voted power from a bitmap
func (Keeper) CheckQuorum ¶
CheckQuorum checks if the voted power meets quorum
func (Keeper) EndBlocker ¶
EndBlocker handles end block logic for the network module
func (Keeper) GetAttestationBitmap ¶
GetAttestationBitmap retrieves the attestation bitmap for a height
func (Keeper) GetAuthority ¶
GetAuthority returns the module authority
func (Keeper) GetCurrentEpoch ¶
GetCurrentEpoch returns the current epoch number
func (Keeper) GetEpochBitmap ¶
GetEpochBitmap retrieves the epoch participation bitmap
func (Keeper) GetSignature ¶
GetSignature retrieves the vote signature for a given height and validator
func (Keeper) GetTotalPower ¶
GetTotalPower returns the total staking power
func (Keeper) GetValidatorIndex ¶
GetValidatorIndex retrieves the validator index
func (Keeper) GetValidatorPower ¶
GetValidatorPower retrieves the validator power by index
func (Keeper) HasSignature ¶
HasSignature checks if a signature exists for a given height and validator
func (Keeper) IsCheckpointHeight ¶
IsCheckpointHeight checks if a height is a checkpoint
func (Keeper) IsInAttesterSet ¶
IsInAttesterSet checks if a validator is in the attester set
func (Keeper) IsSoftConfirmed ¶
IsSoftConfirmed checks if a block at a given height is soft-confirmed based on the attestation bitmap and quorum rules.
func (Keeper) PruneOldBitmaps ¶
PruneOldBitmaps removes bitmaps older than PruneAfter epochs
func (Keeper) RemoveAttesterSetMember ¶
RemoveAttesterSetMember removes a validator from the attester set
func (Keeper) SetAttestationBitmap ¶
SetAttestationBitmap stores the attestation bitmap for a height
func (Keeper) SetAttesterSetMember ¶
SetAttesterSetMember adds a validator to the attester set
func (Keeper) SetEpochBitmap ¶
SetEpochBitmap stores the epoch participation bitmap