keeper

package
v0.35.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 33 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 THRESHOLD_FACTOR = 4

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 BadgeData

type BadgeData struct {
	Badge       types.Badge
	BadgeSigner sdk.AccAddress
}

type Keeper

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

func NewKeeper

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

	bankKeeper types.BankKeeper,
	accountKeeper types.AccountKeeper,
	specKeeper types.SpecKeeper,
	epochStorageKeeper types.EpochstorageKeeper,
	projectsKeeper types.ProjectsKeeper,
	subscriptionKeeper types.SubscriptionKeeper,
	planKeeper types.PlanKeeper,
	downtimeKeeper types.DowntimeKeeper,
	dualstakingKeeper types.DualstakingKeeper,
	stakingKeeper types.StakingKeeper,
	fixationStoreKeeper types.FixationStoreKeeper,
	timerStoreKeeper types.TimerStoreKeeper,
) *Keeper

func (Keeper) AddEpochPayment added in v0.4.3

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

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, projectID string, providerAddress sdk.AccAddress, usedCU uint64, uniqueIdentifier string) (userPayment *types.ProviderPaymentStorage, usedCUConsumerTotal uint64)

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, projectID string, providerAddress sdk.AccAddress, uniqueIdentifier string, usedCU uint64) *types.UniquePaymentStorageClientProvider

func (Keeper) BadgeUsedCuExpiry

func (k Keeper) BadgeUsedCuExpiry(ctx sdk.Context, badge types.Badge) uint64

func (Keeper) BailEntry

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

func (Keeper) BeginBlock

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

func (Keeper) CalculateEffectiveAllowedCuPerEpochFromPolicies

func (k Keeper) CalculateEffectiveAllowedCuPerEpochFromPolicies(policies []*planstypes.Policy, cuUsedInProject, cuLeftInSubscription uint64) (allowedCUThisEpoch, allowedCUTotal uint64)

func (Keeper) CalculateEffectiveGeolocationFromPolicies

func (k Keeper) CalculateEffectiveGeolocationFromPolicies(policies []*planstypes.Policy) (int32, error)

func (Keeper) CalculateEffectiveProvidersToPairFromPolicies

func (k Keeper) CalculateEffectiveProvidersToPairFromPolicies(policies []*planstypes.Policy) (uint64, error)

func (Keeper) CalculateEffectiveSelectedProviders

func (k Keeper) CalculateEffectiveSelectedProviders(policies []*planstypes.Policy) (planstypes.SELECTED_PROVIDERS_MODE, []string)

func (Keeper) CheckUnstakingForCommit

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

func (Keeper) CreditStakeEntry

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

func (Keeper) EncodeUniquePaymentKey

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

func (Keeper) EnforceClientCUsUsageInEpoch

func (k Keeper) EnforceClientCUsUsageInEpoch(ctx sdk.Context, relayCU, allowedCU, totalCUInEpochForUserProvider uint64, clientAddr sdk.AccAddress, chainID string, epoch uint64) (uint64, error)

func (Keeper) EpochBlocksOverlap

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

func (Keeper) ExportBadgesTimers

func (k Keeper) ExportBadgesTimers(ctx sdk.Context) timertypes.GenesisState

ExportBadgesTimers exports badges timers data (for genesis)

func (Keeper) ExportProviderQoS

func (k Keeper) ExportProviderQoS(ctx sdk.Context) fixationtypes.GenesisState

func (Keeper) FreezeProvider

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

func (Keeper) GetAllBadgeUsedCu

func (k Keeper) GetAllBadgeUsedCu(ctx sdk.Context) (list []types.BadgeUsedCu)

GetAllBadgeUsedCu returns all badgeUsedCu

func (Keeper) GetAllChainIDs

func (k Keeper) GetAllChainIDs(ctx sdk.Context) []string

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) GetBadgeUsedCu

func (k Keeper) GetBadgeUsedCu(
	ctx sdk.Context,
	badgeUsedCuKey []byte,
) (val types.BadgeUsedCu, found bool)

GetBadgeUsedCu returns a badgeUsedCu from its index

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, errRet error)

func (Keeper) GetProjectStrictestPolicy

func (k Keeper) GetProjectStrictestPolicy(ctx sdk.Context, project projectstypes.Project, chainID string, block uint64) (*planstypes.Policy, string, error)

func (Keeper) GetProviderFromProviderPaymentStorage

func (k Keeper) GetProviderFromProviderPaymentStorage(providerPaymentStorage *types.ProviderPaymentStorage) (string, 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) GetQos

func (k Keeper) GetQos(ctx sdk.Context, chainID string, cluster string, provider string) (pairingtypes.QualityOfServiceReport, error)

GetQos gets a provider's QoS excellence report from the providerQosFS

func (Keeper) GetStakeEntry

func (k Keeper) GetStakeEntry(ctx sdk.Context, chainID string, provider string) (epochstoragetypes.StakeEntry, error)

func (Keeper) GetTotalUsedCUForConsumerPerEpoch added in v0.4.3

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

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) InitBadgeTimers

func (k Keeper) InitBadgeTimers(ctx sdk.Context, gs timertypes.GenesisState)

InitBadgeTimers imports badges timers data (from genesis)

func (Keeper) InitProviderQoS

func (k Keeper) InitProviderQoS(ctx sdk.Context, gs fixationtypes.GenesisState)

func (Keeper) IsDoubleSpend added in v0.32.0

func (k Keeper) IsDoubleSpend(ctx sdk.Context, chainID string, block uint64, projectID string, providerAddress sdk.AccAddress, uniqueIdentifier string) bool

func (Keeper) JailEntry

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

func (Keeper) Logger

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

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) RemoveAllEpochPaymentsForBlockAppendAdjustments

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

Function to remove all epochPayments objects from a specific epoch

func (Keeper) RemoveBadgeUsedCu

func (k Keeper) RemoveBadgeUsedCu(
	ctx sdk.Context,
	badgeUsedCuKey []byte,
)

RemoveBadgeUsedCu removes a badgeUsedCu from the store

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)

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) SdkPairing

func (Keeper) SetBadgeUsedCu

func (k Keeper) SetBadgeUsedCu(ctx sdk.Context, badgeUsedCu types.BadgeUsedCu)

SetBadgeUsedCu set a specific badgeUsedCu in the store from its index

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, chainID string, percentage sdk.Dec) (sdk.Coin, error)

func (Keeper) StakeNewEntry

func (k Keeper) StakeNewEntry(ctx sdk.Context, validator, creator, chainID string, amount sdk.Coin, endpoints []epochstoragetypes.Endpoint, geolocation int32, moniker string, delegationLimit sdk.Coin, delegationCommission uint64) error

func (Keeper) UnstakeEntry

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

func (Keeper) UnstakeEntryForce

func (k Keeper) UnstakeEntryForce(ctx sdk.Context, chainID, provider, unstakeDescription string) error

func (Keeper) UnstakeUnresponsiveProviders

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

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

func (Keeper) UpdateProviderQos

func (k Keeper) UpdateProviderQos(epochPayments pairingtypes.EpochPayments)

func (Keeper) UserEntry

func (Keeper) ValidatePairingForClient

func (k Keeper) ValidatePairingForClient(ctx sdk.Context, chainID string, providerAddress sdk.AccAddress, reqEpoch uint64, project projectstypes.Project) (isValidPairing bool, allowedCU uint64, pairedProviders []epochstoragetypes.StakeEntry, errorRet error)

func (Keeper) VerifyPairingData

func (k Keeper) VerifyPairingData(ctx sdk.Context, chainID string, block uint64) (epoch uint64, providersType spectypes.Spec_ProvidersTypes, errorRet error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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