keeper

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EPOCH_BLOCK_DIVIDER uint64 = 5 // determines how many blocks from the previous epoch will be included in the average block time calculation
	MIN_SAMPLE_STEP     uint64 = 1 // the minimal sample step when calculating the average block time
)
View Source
const INVALID_INDEX = -2

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 Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey sdk.StoreKey,
	ps paramtypes.Subspace,

	bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, specKeeper types.SpecKeeper, epochStorageKeeper types.EpochstorageKeeper, projectsKeeper types.ProjectsKeeper,
) *Keeper

func (Keeper) AddEpochPayment added in v0.4.3

func (k Keeper) AddEpochPayment(ctx sdk.Context, chainID string, epoch uint64, userAddress sdk.AccAddress, providerAddress sdk.AccAddress, usedCU uint64, uniqueIdentifier string) (uint64, error)

Function to add an epoch payment to the epochPayments object

func (Keeper) AddProviderPaymentInEpoch added in v0.4.3

func (k Keeper) AddProviderPaymentInEpoch(ctx sdk.Context, chainID string, epoch uint64, userAddress sdk.AccAddress, providerAddress sdk.AccAddress, usedCU uint64, uniqueIdentifier string) (userPayment *types.ProviderPaymentStorage, usedCUConsumerTotal uint64, err error)

Function to add a payment (which is represented by a uniquePaymentStorageClientProvider object) to a providerPaymentStorage object

func (Keeper) AddUniquePaymentStorageClientProvider added in v0.4.3

func (k Keeper) AddUniquePaymentStorageClientProvider(ctx sdk.Context, chainID string, block uint64, userAddress sdk.AccAddress, providerAddress sdk.AccAddress, uniqueIdentifier string, usedCU uint64) (isUnique bool, entryAddr *types.UniquePaymentStorageClientProvider)

func (Keeper) BailEntry

func (k Keeper) BailEntry(ctx sdk.Context, account sdk.AccAddress, isProvider bool, chainID string, bail sdk.Coin) error

func (Keeper) BurnClientStake added in v0.4.3

func (k Keeper) BurnClientStake(ctx sdk.Context, chainID string, clientAddressToBurn sdk.AccAddress, burnAmount sdk.Coin, failBurnOnLeftover bool) (bool, error)

func (Keeper) BurnCoinsPerCU added in v0.4.3

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

BurnCoinsPerCU returns the BurnCoinsPerCU param

func (Keeper) CheckUnstakingForCommit

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

func (Keeper) ClientMaxCUProviderForBlock added in v0.4.3

func (k Keeper) ClientMaxCUProviderForBlock(ctx sdk.Context, blockHeight uint64, clientEntry *epochstoragetypes.StakeEntry) (uint64, error)

func (Keeper) Clients added in v0.4.3

func (Keeper) CreditStakeEntry

func (k Keeper) CreditStakeEntry(ctx sdk.Context, chainID string, lookUpAddress sdk.AccAddress, creditAmount sdk.Coin, isProvider bool) (bool, error)

func (Keeper) DataReliabilityReward added in v0.4.3

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

func (Keeper) EncodeUniquePaymentKey

func (k Keeper) EncodeUniquePaymentKey(ctx sdk.Context, userAddress sdk.AccAddress, providerAddress sdk.AccAddress, uniqueIdentifier string, chainID string) string

func (Keeper) EnforceClientCUsUsageInEpoch

func (k Keeper) EnforceClientCUsUsageInEpoch(ctx sdk.Context, cuSum uint64, allowedCU uint64, totalCUInEpochForUserProvider uint64, epochStart uint64) error

func (Keeper) EpochBlocksOverlap

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

func (Keeper) EpochStart added in v0.5.2

func (k Keeper) EpochStart(ctx sdk.Context, epochsNumToCheckCuForUnresponsiveProvider uint64, epochsNumToCheckForComplainers uint64)

Function that calls all the functions that are supposed to run in epoch start

func (Keeper) FraudSlashingAmount added in v0.4.3

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

FraudSlashingAmount returns the FraudSlashingAmount param

func (Keeper) FraudStakeSlashingFactor added in v0.4.3

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

FraudStakeSlashingFactor returns the FraudStakeSlashingFactor param

func (Keeper) FreezeProvider

func (k Keeper) FreezeProvider(ctx sdk.Context, provider string, chainIDs []string, reason string) error

func (Keeper) GetAllEpochPayments

func (k Keeper) GetAllEpochPayments(ctx sdk.Context) (list []types.EpochPayments)

GetAllEpochPayments returns all epochPayments

func (Keeper) GetAllProviderPaymentStorage

func (k Keeper) GetAllProviderPaymentStorage(ctx sdk.Context) (list []types.ProviderPaymentStorage)

GetAllProviderPaymentStorage returns all providerPaymentStorage

func (Keeper) GetAllUniquePaymentStorageClientProvider

func (k Keeper) GetAllUniquePaymentStorageClientProvider(ctx sdk.Context) (list []types.UniquePaymentStorageClientProvider)

GetAllUniquePaymentStorageClientProvider returns all uniquePaymentStorageClientProvider

func (Keeper) GetAllowedCUForBlock added in v0.4.3

func (k Keeper) GetAllowedCUForBlock(ctx sdk.Context, blockHeight uint64, entry *epochstoragetypes.StakeEntry) (uint64, error)

func (Keeper) GetConsumerFromUniquePayment

func (k Keeper) GetConsumerFromUniquePayment(uniquePaymentStorageClientProvider *types.UniquePaymentStorageClientProvider) string

func (Keeper) GetEpochPayments

func (k Keeper) GetEpochPayments(
	ctx sdk.Context,
	index string,
) (val types.EpochPayments, found bool)

GetEpochPayments returns a epochPayments from its index

func (Keeper) GetEpochPaymentsFromBlock

func (k Keeper) GetEpochPaymentsFromBlock(ctx sdk.Context, epoch uint64) (epochPayment types.EpochPayments, found bool, key string)

Function to get the epochPayments object from a specific epoch. Note that it also returns the epochPayments object's key which is the epoch in hex representation (base 16)

func (Keeper) GetPairing

Gets a client's provider list in a specific chain. Also returns the start block of the current epoch, time (in seconds) until there's a new pairing, the block that the chain in the request's spec was changed

func (Keeper) GetPairingForClient

func (k Keeper) GetPairingForClient(ctx sdk.Context, chainID string, clientAddress sdk.AccAddress) (providers []epochstoragetypes.StakeEntry, errorRet error)

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetProjectData

func (k Keeper) GetProjectData(ctx sdk.Context, developerKey sdk.AccAddress, chainID string, blockHeight uint64) (proj projectstypes.Project, vrfpk string, errRet error)

func (Keeper) GetProviderPaymentStorage

func (k Keeper) GetProviderPaymentStorage(
	ctx sdk.Context,
	index string,
) (val types.ProviderPaymentStorage, found bool)

GetProviderPaymentStorage returns a providerPaymentStorage from its index

func (Keeper) GetProviderPaymentStorageKey

func (k Keeper) GetProviderPaymentStorageKey(ctx sdk.Context, chainID string, epoch uint64, providerAddress sdk.AccAddress) string

Function to get a providerPaymentStorage object's key (key is chainID_epoch_providerAddress, epoch in hex representation)

func (Keeper) GetTotalUsedCUForConsumerPerEpoch added in v0.4.3

func (k Keeper) GetTotalUsedCUForConsumerPerEpoch(ctx sdk.Context, consumerAddress string, uniquePaymentStorageKeys []string, providerAddress string) (uint64, error)

Function to get the total serviced CU by a provider in this epoch for a specific consumer

func (Keeper) GetUniquePaymentStorageClientProvider

func (k Keeper) GetUniquePaymentStorageClientProvider(
	ctx sdk.Context,
	index string,
) (val types.UniquePaymentStorageClientProvider, found bool)

GetUniquePaymentStorageClientProvider returns a uniquePaymentStorageClientProvider from its index

func (Keeper) IsEpochStart added in v0.4.3

func (k Keeper) IsEpochStart(ctx sdk.Context) (res bool)

we dont want to do the calculation here too, epochStorage keeper did it

func (Keeper) JailEntry

func (k Keeper) JailEntry(ctx sdk.Context, account sdk.AccAddress, isProvider bool, chainID string, jailStartBlock uint64, jailBlocks uint64, bail sdk.Coin) error

func (Keeper) Logger

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

func (Keeper) MintCoinsPerCU added in v0.4.3

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

MintCoinsPerCU returns the MintCoinsPerCU param

func (Keeper) Params

func (Keeper) Providers

func (Keeper) QoSWeight

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

func (Keeper) RecommendedEpochNumToCollectPayment

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

RecommendedEpochNumToCollectPayment returns the RecommendedEpochNumToCollectPayment param

func (Keeper) RemoveAllEpochPaymentsForBlock added in v0.4.3

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

Function to remove all epochPayments objects from a specific epoch

func (Keeper) RemoveEpochPayments

func (k Keeper) RemoveEpochPayments(
	ctx sdk.Context,
	index string,
)

RemoveEpochPayments removes a epochPayments from the store

func (Keeper) RemoveOldEpochPayment

func (k Keeper) RemoveOldEpochPayment(ctx sdk.Context) (err error)

Function to remove epochPayments objects from deleted epochs (older than the chain's memory)

func (Keeper) RemoveProviderPaymentStorage

func (k Keeper) RemoveProviderPaymentStorage(
	ctx sdk.Context,
	index string,
)

RemoveProviderPaymentStorage removes a providerPaymentStorage from the store

func (Keeper) RemoveUniquePaymentStorageClientProvider

func (k Keeper) RemoveUniquePaymentStorageClientProvider(
	ctx sdk.Context,
	index string,
)

RemoveUniquePaymentStorageClientProvider removes a uniquePaymentStorageClientProvider from the store

func (Keeper) ServicersToPairCount added in v0.4.3

func (k Keeper) ServicersToPairCount(ctx sdk.Context, block uint64) (res uint64, err error)

func (Keeper) ServicersToPairCountRaw added in v0.4.3

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

ServicersToPairCount returns the ServicersToPairCount param

func (Keeper) SetEpochPayments

func (k Keeper) SetEpochPayments(ctx sdk.Context, epochPayments types.EpochPayments)

SetEpochPayments set a specific epochPayments in the store from its index

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetProviderPaymentStorage

func (k Keeper) SetProviderPaymentStorage(ctx sdk.Context, providerPaymentStorage types.ProviderPaymentStorage)

SetProviderPaymentStorage set a specific providerPaymentStorage in the store from its index

func (Keeper) SetRecommendedEpochNumToCollectPayment

func (k Keeper) SetRecommendedEpochNumToCollectPayment(ctx sdk.Context, val uint64)

func (Keeper) SetUniquePaymentStorageClientProvider

func (k Keeper) SetUniquePaymentStorageClientProvider(ctx sdk.Context, uniquePaymentStorageClientProvider types.UniquePaymentStorageClientProvider)

SetUniquePaymentStorageClientProvider set a specific uniquePaymentStorageClientProvider in the store from its index

func (Keeper) SlashEntry

func (k Keeper) SlashEntry(ctx sdk.Context, account sdk.AccAddress, isProvider bool, chainID string, percentage sdk.Dec) (sdk.Coin, error)

func (Keeper) SlashLimit added in v0.4.3

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

func (Keeper) StakeNewEntry

func (k Keeper) StakeNewEntry(ctx sdk.Context, provider bool, creator string, chainID string, amount sdk.Coin, endpoints []epochstoragetypes.Endpoint, geolocation uint64, vrfpk string, moniker string) error

func (Keeper) StakeToMaxCUList added in v0.4.3

func (k Keeper) StakeToMaxCUList(ctx sdk.Context, block uint64) (res types.StakeToMaxCUList, err error)

func (Keeper) StakeToMaxCUListRaw added in v0.4.3

func (k Keeper) StakeToMaxCUListRaw(ctx sdk.Context) (res types.StakeToMaxCUList)

func (Keeper) UnpayLimit added in v0.4.3

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

func (Keeper) UnstakeEntry

func (k Keeper) UnstakeEntry(ctx sdk.Context, provider bool, chainID string, creator string, unstakeDescription string) error

func (Keeper) UnstakeUnresponsiveProviders

func (k Keeper) UnstakeUnresponsiveProviders(ctx sdk.Context, epochsNumToCheckCUForUnresponsiveProvider uint64, epochsNumToCheckCUForComplainers uint64) error

Function that returns a map that links between a provider that should be punished and its providerCuCounterForUnreponsiveness

func (Keeper) UserEntry

func (Keeper) ValidatePairingForClient

func (k Keeper) ValidatePairingForClient(ctx sdk.Context, chainID string, clientAddress sdk.AccAddress, providerAddress sdk.AccAddress, epoch uint64) (isValidPairing bool, vrfk string, foundIndex int, allowedCU uint64, pairedProviders uint64, legacyStake bool, errorRet error)

func (Keeper) VerifyClientStake added in v0.8.1

func (k Keeper) VerifyClientStake(ctx sdk.Context, chainID string, clientAddress sdk.Address, block uint64, epoch uint64) (clientStakeEntryRet *epochstoragetypes.StakeEntry, errorRet error)

func (Keeper) VerifyPairingData

func (k Keeper) VerifyPairingData(ctx sdk.Context, chainID string, clientAddress sdk.AccAddress, block uint64) (epoch uint64, errorRet error)

type VRFKey added in v0.9.0

type VRFKey struct {
	Consumer string
	Epoch    uint64
	ChainID  string
}

Jump to

Keyboard shortcuts

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