keeper

package
v0.2.5-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: AGPL-3.0 Imports: 25 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 returns the bls signed message in bytes.
	GetBlsSignBytes(chainId string) [32]byte

	// GetVoteValidatorSet returns the validators who signed the message.
	GetVoteValidatorSet() []uint64

	// GetVoteAggSignature returns the aggregated bls signature.
	GetVoteAggSignature() []byte
}

BlsSignedMsg defined the interface of a bls signed message.

type Keeper

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

func NewKeeper

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

func (Keeper) AppendAttestedChallenge added in v0.2.2

func (k Keeper) AppendAttestedChallenge(ctx sdk.Context, challenge *types.AttestedChallenge)

AppendAttestedChallenge sets the new id of challenge to the store

func (Keeper) AttestedChallenge added in v0.2.3

func (Keeper) ClearSpSlashAmount added in v0.2.3

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

func (Keeper) ExistsChallenge added in v0.0.10

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

ExistsChallenge check whether there exists ongoing challenge for an id

func (Keeper) ExistsSlash

func (k Keeper) ExistsSlash(ctx sdk.Context, spId uint32, objectId sdkmath.Uint) bool

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

func (Keeper) GetAttestedChallenges added in v0.2.2

func (k Keeper) GetAttestedChallenges(ctx sdk.Context) []*types.AttestedChallenge

GetAttestedChallenges gets the latest attested challenges

func (Keeper) GetAuthority added in v0.2.0

func (k Keeper) GetAuthority() string

func (Keeper) GetChallengeCountCurrentBlock

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

GetChallengeCountCurrentBlock gets the count of challenges

func (Keeper) GetChallengeId added in v0.0.10

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

GetChallengeId gets the challenge id

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetSpSlashAmount added in v0.2.3

func (k Keeper) GetSpSlashAmount(ctx sdk.Context, spId uint32) sdkmath.Int

func (Keeper) IncrChallengeCountCurrentBlock

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

IncrChallengeCountCurrentBlock increases the count of challenge by one

func (Keeper) InturnAttestationSubmitter added in v0.1.2

func (Keeper) LatestAttestedChallenges added in v0.1.2

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) RemoveChallengeUntil added in v0.0.10

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

RemoveChallengeUntil removes challenges which are expired

func (Keeper) RemoveSlashUntil

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

RemoveSlashUntil removes slashes which are created earlier

func (Keeper) SaveChallenge added in v0.0.10

func (k Keeper) SaveChallenge(ctx sdk.Context, challenge types.Challenge)

SaveChallenge set a specific challenge in the store

func (Keeper) SaveSlash

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

SaveSlash set a specific slash in the store

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetSpSlashAmount added in v0.2.3

func (k Keeper) SetSpSlashAmount(ctx sdk.Context, spId uint32, amount sdkmath.Int)

Jump to

Keyboard shortcuts

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