keeper

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const RandaoMixLength = 64

RandaoMixLength is the length of randao mix in Tendermint header

Variables

This section is empty.

Functions

func CalculateSegments

func CalculateSegments(payloadSize, segmentSize uint64) uint64

CalculateSegments calculates the number of segments for the payload size.

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func RandomObjectId

func RandomObjectId(seed []byte, objectCount sdkmath.Uint) sdkmath.Uint

RandomObjectId generates a random object id for challenge. Be noted: id starts from 1.

func RandomRedundancyIndex

func RandomRedundancyIndex(seed []byte, sps uint64) int32

RandomRedundancyIndex generates a random redundancy index (storage provider) for challenge. Be noted: RedundancyIndex starts from -1 (the primary sp).

func RandomSegmentIndex

func RandomSegmentIndex(seed []byte, segments uint64) uint32

RandomSegmentIndex generates a random segment index for challenge.

func SeedFromRandaoMix

func SeedFromRandaoMix(randaoMix []byte, number uint64) []byte

SeedFromRandaoMix generates seed from randao mix.

Types

type BlsSignedMsg

type BlsSignedMsg interface {
	GetBlsSignBytes() [32]byte
	GetVoteValidatorSet() []uint64
	GetVoteAggSignature() []byte
}

type Keeper

type Keeper struct {
	StorageKeeper types.StorageKeeper
	SpKeeper      types.SpKeeper
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey, memKey, tKey storetypes.StoreKey,
	ps paramtypes.Subspace,
	bankKeeper types.BankKeeper,
	storageKeeper types.StorageKeeper,
	spKeeper types.SpKeeper,
	stakingKeeper types.StakingKeeper,
	paymentKeeper types.PaymentKeeper,
) *Keeper

func (Keeper) ChallengeCountPerBlock

func (k Keeper) ChallengeCountPerBlock(ctx sdk.Context) (res uint64)

ChallengeCountPerBlock returns the ChallengeCountPerBlock param

func (Keeper) ExistsSlash

func (k Keeper) ExistsSlash(ctx sdk.Context, spOperatorAddress sdk.AccAddress, objectId sdkmath.Uint) bool

ExistsSlash check whether there exists recent slash for a pair of sp and object info or not

func (Keeper) GetAttestChallengeId

func (k Keeper) GetAttestChallengeId(ctx sdk.Context) uint64

GetAttestChallengeId gets the challenge id of the latest attestation challenge

func (Keeper) GetChallengeCountCurrentBlock

func (k Keeper) GetChallengeCountCurrentBlock(ctx sdk.Context) uint64

GetChallengeCountCurrentBlock gets the count of challenges

func (Keeper) GetOngoingChallengeId

func (k Keeper) GetOngoingChallengeId(ctx sdk.Context) uint64

GetOngoingChallengeId gets the highest challenge id

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) HeartbeatInterval

func (k Keeper) HeartbeatInterval(ctx sdk.Context) (res uint64)

HeartbeatInterval returns the HeartbeatInterval param

func (Keeper) IncrChallengeCountCurrentBlock

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

IncrChallengeCountCurrentBlock increases the count of challenge by one

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) RemoveSlashUntil

func (k Keeper) RemoveSlashUntil(ctx sdk.Context, height uint64)

RemoveSlashUntil removes slashes which are created earlier

func (Keeper) RewardSubmitterRatio

func (k Keeper) RewardSubmitterRatio(ctx sdk.Context) (res sdk.Dec)

RewardSubmitterRatio returns the RewardSubmitterRatio param

func (Keeper) RewardSubmitterThreshold

func (k Keeper) RewardSubmitterThreshold(ctx sdk.Context) (res math.Int)

RewardSubmitterThreshold returns the RewardSubmitterThreshold param

func (Keeper) RewardValidatorRatio

func (k Keeper) RewardValidatorRatio(ctx sdk.Context) (res sdk.Dec)

RewardValidatorRatio returns the RewardValidatorRatio param

func (Keeper) SaveSlash

func (k Keeper) SaveSlash(ctx sdk.Context, slash types.Slash)

SaveSlash set a specific slash in the store

func (Keeper) SetAttestChallengeId

func (k Keeper) SetAttestChallengeId(ctx sdk.Context, challengeId uint64)

SetAttestChallengeId sets the new id of challenge to the store

func (Keeper) SetOngoingChallengeId

func (k Keeper) SetOngoingChallengeId(ctx sdk.Context, challengeId uint64)

SetOngoingChallengeId sets the new challenge id to the store

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SlashAmountMax

func (k Keeper) SlashAmountMax(ctx sdk.Context) (res math.Int)

SlashAmountMax returns the SlashAmountMax param

func (Keeper) SlashAmountMin

func (k Keeper) SlashAmountMin(ctx sdk.Context) (res math.Int)

SlashAmountMin returns the SlashAmountMin param

func (Keeper) SlashAmountSizeRate

func (k Keeper) SlashAmountSizeRate(ctx sdk.Context) (res sdk.Dec)

SlashAmountSizeRate returns the SlashAmountSizeRate param

func (Keeper) SlashCoolingOffPeriod

func (k Keeper) SlashCoolingOffPeriod(ctx sdk.Context) (res uint64)

SlashCoolingOffPeriod returns the SlashCoolingOffPeriod param

Jump to

Keyboard shortcuts

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