keeper

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 34 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 (
	MAX_CHANGE_RATE = 1
	CHANGE_WINDOW   = time.Hour * 24
)
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 EpochCuCache added in v1.1.0

type EpochCuCache struct {
	Keeper
	ProviderEpochCuCache           *cachekv.Store
	ProviderEpochComplainerCuCache *cachekv.Store
	ProviderConsumerEpochCuCache   *cachekv.Store
}

########## EpochCuCache ############

func (EpochCuCache) AddEpochPayment added in v1.1.0

func (k EpochCuCache) AddEpochPayment(ctx sdk.Context, chainID string, epoch uint64, project string, provider string, cu uint64, sessionID uint64) uint64

AddEpochPayment adds a new epoch payment and returns the updated CU used between provider and project

func (EpochCuCache) Flush added in v1.1.0

func (k EpochCuCache) Flush()

func (EpochCuCache) GetProviderConsumerEpochCuCached added in v1.1.0

func (k EpochCuCache) GetProviderConsumerEpochCuCached(ctx sdk.Context, epoch uint64, provider string, project string, chainID string) (val types.ProviderConsumerEpochCu, found bool)

func (EpochCuCache) GetProviderEpochComplainerCuCached added in v1.1.0

func (k EpochCuCache) GetProviderEpochComplainerCuCached(ctx sdk.Context, epoch uint64, provider string, chainID string) (val types.ProviderEpochComplainerCu, found bool)

func (EpochCuCache) GetProviderEpochCuCached added in v1.1.0

func (k EpochCuCache) GetProviderEpochCuCached(ctx sdk.Context, epoch uint64, provider string, chainID string) (val types.ProviderEpochCu, found bool)

func (EpochCuCache) SetProviderConsumerEpochCuCached added in v1.1.0

func (k EpochCuCache) SetProviderConsumerEpochCuCached(ctx sdk.Context, epoch uint64, provider string, project string, chainID string, providerConsumerEpochCu types.ProviderConsumerEpochCu)

func (EpochCuCache) SetProviderEpochComplainerCuCached added in v1.1.0

func (k EpochCuCache) SetProviderEpochComplainerCuCached(ctx sdk.Context, epoch uint64, provider string, chainID string, providerEpochCu types.ProviderEpochComplainerCu)

func (EpochCuCache) SetProviderEpochCuCached added in v1.1.0

func (k EpochCuCache) SetProviderEpochCuCached(ctx sdk.Context, epoch uint64, provider string, chainID string, providerEpochCu types.ProviderEpochCu)

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

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

func (Keeper) BailEntry

func (k Keeper) BailEntry(ctx sdk.Context, address string, 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) EnforceClientCUsUsageInEpoch

func (k Keeper) EnforceClientCUsUsageInEpoch(ctx sdk.Context, relayCU, epochAllowedCU, 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) GetAllProviderConsumerEpochCu added in v1.1.0

func (k Keeper) GetAllProviderConsumerEpochCu(ctx sdk.Context, epoch uint64) []types.ProviderConsumerEpochCuGenesis

GetAllProviderConsumerEpochCuStore returns all the ProviderConsumerEpochCu from the store (used for genesis)

func (Keeper) GetAllProviderConsumerEpochCuStore added in v1.1.0

func (k Keeper) GetAllProviderConsumerEpochCuStore(ctx sdk.Context) []types.ProviderConsumerEpochCuGenesis

GetAllProviderConsumerEpochCuStore returns all the ProviderConsumerEpochCu from the store (used for genesis)

func (Keeper) GetAllProviderEpochComplainerCuStore added in v1.1.0

func (k Keeper) GetAllProviderEpochComplainerCuStore(ctx sdk.Context) []types.ProviderEpochComplainerCuGenesis

GetAllProviderEpochComplainerCuStore returns all the ProviderEpochCu from the store (used for genesis)

func (Keeper) GetAllProviderEpochCuStore added in v1.1.0

func (k Keeper) GetAllProviderEpochCuStore(ctx sdk.Context) []types.ProviderEpochCuGenesis

GetAllProviderEpochCuStore returns all the ProviderEpochCu from the store (used for genesis)

func (Keeper) GetAllUniqueEpochSessionForEpoch added in v1.1.0

func (k Keeper) GetAllUniqueEpochSessionForEpoch(ctx sdk.Context, epoch uint64) []string

GetAllUniqueEpochSessionForEpoch gets all the UniqueEpochSession objects from the store for a specific epoch

func (Keeper) GetAllUniqueEpochSessionStore added in v1.1.0

func (k Keeper) GetAllUniqueEpochSessionStore(ctx sdk.Context) []types.UniqueEpochSessionGenesis

GetAllUniqueEpochSessionStore gets all the UniqueEpochSession objects from the store (used for genesis)

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) 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) GetProviderConsumerEpochCu added in v1.1.0

func (k Keeper) GetProviderConsumerEpochCu(ctx sdk.Context, epoch uint64, provider string, project string, chainID string) (val types.ProviderConsumerEpochCu, found bool)

GetProviderConsumerEpochCu returns a ProviderConsumerEpochCu for a specific epoch, provider and project

func (Keeper) GetProviderEpochComplainerCu added in v1.1.0

func (k Keeper) GetProviderEpochComplainerCu(ctx sdk.Context, epoch uint64, provider string, chainID string) (val types.ProviderEpochComplainerCu, found bool)

GetProviderEpochComplainerCu returns a ProviderEpochCu for a specific epoch and provider

func (Keeper) GetProviderEpochCu added in v1.1.0

func (k Keeper) GetProviderEpochCu(ctx sdk.Context, epoch uint64, provider string, chainID string) (val types.ProviderEpochCu, found bool)

GetProviderEpochCu returns a ProviderEpochCu for a specific epoch and provider

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) 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) IsUniqueEpochSessionExists added in v1.1.0

func (k Keeper) IsUniqueEpochSessionExists(ctx sdk.Context, epoch uint64, provider string, project string, chainID string, sessionID uint64) bool

IsUniqueEpochSessionExists checks if a UniqueEpochSession exists

func (Keeper) JailEntry

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

func (Keeper) Logger

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

func (Keeper) NewEpochCuCacheHandler added in v1.1.0

func (k Keeper) NewEpochCuCacheHandler(ctx sdk.Context) EpochCuCache

func (Keeper) Params

func (Keeper) Providers

func (Keeper) ProvidersEpochCu added in v1.1.0

func (Keeper) PunishUnresponsiveProviders added in v1.1.0

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

PunishUnresponsiveProviders punished unresponsive providers (current punishment: freeze)

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, epochToDelete uint64)

Function to remove all epoch payments objects from a specific epoch

func (Keeper) RemoveAllProviderEpochComplainerCu added in v1.1.0

func (k Keeper) RemoveAllProviderEpochComplainerCu(ctx sdk.Context, epoch uint64)

RemoveProviderEpochComplainerCu removes a ProviderEpochCu from the store

func (Keeper) RemoveAllProviderEpochCu added in v1.1.0

func (k Keeper) RemoveAllProviderEpochCu(ctx sdk.Context, epoch uint64)

RemoveProviderEpochCu removes a ProviderEpochCu from the store

func (Keeper) RemoveAllUniqueEpochSession added in v1.1.0

func (k Keeper) RemoveAllUniqueEpochSession(ctx sdk.Context, epoch uint64)

RemoveAllUniqueEpochSession removes all the UniqueEpochSession objects from the store for a specific epoch

func (Keeper) RemoveBadgeUsedCu

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

RemoveBadgeUsedCu removes a badgeUsedCu from the store

func (Keeper) RemoveOldEpochPayments added in v1.1.0

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

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

func (Keeper) RemoveProviderConsumerEpochCu added in v1.1.0

func (k Keeper) RemoveProviderConsumerEpochCu(ctx sdk.Context, epoch uint64, provider string, project string, chainID string)

RemoveProviderConsumerEpochCu removes a ProviderConsumerEpochCu 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) SetParams

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

SetParams set the params

func (Keeper) SetProviderConsumerEpochCu added in v1.1.0

func (k Keeper) SetProviderConsumerEpochCu(ctx sdk.Context, epoch uint64, provider string, project string, chainID string, providerConsumerEpochCu types.ProviderConsumerEpochCu)

SetProviderConsumerEpochCu sets a ProviderConsumerEpochCu in the store

func (Keeper) SetProviderEpochComplainerCu added in v1.1.0

func (k Keeper) SetProviderEpochComplainerCu(ctx sdk.Context, epoch uint64, provider string, chainID string, providerEpochCu types.ProviderEpochComplainerCu)

SetProviderEpochComplainerCu sets a ProviderEpochComplainerCu in the store

func (Keeper) SetProviderEpochCu added in v1.1.0

func (k Keeper) SetProviderEpochCu(ctx sdk.Context, epoch uint64, provider string, chainID string, providerEpochCu types.ProviderEpochCu)

SetProviderEpochCu sets a ProviderEpochCu in the store

func (Keeper) SetRecommendedEpochNumToCollectPayment

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

func (Keeper) SetUniqueEpochSession added in v1.1.0

func (k Keeper) SetUniqueEpochSession(ctx sdk.Context, epoch uint64, provider string, project string, chainID string, sessionID uint64)

SetUniqueEpochSession sets a UniqueEpochSession in the store

func (Keeper) SlashDelegator

func (k Keeper) SlashDelegator(ctx sdk.Context, slashingInfo types.DelegatorSlashing) error

func (Keeper) SlashEntry

func (k Keeper) SlashEntry(ctx sdk.Context, address string, 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) 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)

type Migrator added in v0.27.2

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

func NewMigrator added in v0.27.2

func NewMigrator(keeper Keeper) Migrator

func (Migrator) MigrateVersion2To3 added in v0.27.2

func (m Migrator) MigrateVersion2To3(ctx sdk.Context) error

MigrateVersion2To3 removes all the old payment objects (to get a fresh start for the new ones)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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