Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func RawBundleToQueryBundle(rawFinalizedBundle types.FinalizedBundle, versionMap map[int32]uint64) (queryBundle queryTypes.FinalizedBundle)
- func RawBundleToQueryBundleResponse(rawFinalizedBundle types.FinalizedBundle, versionMap map[int32]uint64) (queryBundle queryTypes.QueryFinalizedBundleResponse)
- type Keeper
- func (k Keeper) AssertCanPropose(ctx sdk.Context, poolId uint64, staker string, proposer string, ...) error
- func (k Keeper) AssertCanVote(ctx sdk.Context, poolId uint64, staker string, voter string, storageId string) error
- func (k Keeper) AssertPoolCanRun(ctx sdk.Context, poolId uint64) error
- func (k Keeper) GetAllBundleProposals(ctx sdk.Context) (list []types.BundleProposal)
- func (k Keeper) GetAllFinalizedBundles(ctx sdk.Context) (list []types.FinalizedBundle)
- func (k Keeper) GetAllRoundRobinProgress(ctx sdk.Context) (list []types.RoundRobinProgress)
- func (k Keeper) GetBundleProposal(ctx sdk.Context, poolId uint64) (val types.BundleProposal, found bool)
- func (k Keeper) GetBundleVersionMap(ctx sdk.Context) (val types.BundleVersionMap)
- func (k Keeper) GetFinalizedBundle(ctx sdk.Context, poolId, id uint64) (val types.FinalizedBundle, found bool)
- func (k Keeper) GetFinalizedBundleByIndex(ctx sdk.Context, poolId, index uint64) (val queryTypes.FinalizedBundle, found bool)
- func (k Keeper) GetFinalizedBundlesByPool(ctx sdk.Context, poolId uint64) (list []types.FinalizedBundle)
- func (k Keeper) GetMaxPoints(ctx sdk.Context) (res uint64)
- func (k Keeper) GetNetworkFee(ctx sdk.Context) (res math.LegacyDec)
- func (k Keeper) GetPaginatedFinalizedBundleQuery(ctx sdk.Context, pagination *query.PageRequest, poolId uint64) ([]queryTypes.FinalizedBundle, *query.PageResponse, error)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRoundRobinProgress(ctx sdk.Context, poolId uint64) (val types.RoundRobinProgress, found bool)
- func (k Keeper) GetStorageCost(ctx sdk.Context, storageProviderId uint32) (res math.LegacyDec)
- func (k Keeper) GetUploadTimeout(ctx sdk.Context) (res uint64)
- func (k Keeper) GetVoteDistribution(ctx sdk.Context, poolId uint64) (voteDistribution types.VoteDistribution)
- func (k Keeper) HandleUploadTimeout(goCtx context.Context)
- func (k Keeper) InitMemStore(gasCtx sdk.Context)
- func (k Keeper) LoadRoundRobinValidatorSet(ctx sdk.Context, poolId uint64) RoundRobinValidatorSet
- func (k Keeper) Logger() log.Logger
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) SaveRoundRobinValidatorSet(ctx sdk.Context, vs RoundRobinValidatorSet)
- func (k Keeper) SetBundleProposal(ctx sdk.Context, bundleProposal types.BundleProposal)
- func (k Keeper) SetBundleVersionMap(ctx sdk.Context, bundleVersionMap types.BundleVersionMap)
- func (k Keeper) SetFinalizedBundle(ctx sdk.Context, finalizedBundle types.FinalizedBundle)
- func (k Keeper) SetFinalizedBundleIndexes(ctx sdk.Context, finalizedBundle types.FinalizedBundle)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetRoundRobinProgress(ctx sdk.Context, roundRobinProgress types.RoundRobinProgress)
- type RoundRobinValidatorPower
- type RoundRobinValidatorSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func RawBundleToQueryBundle ¶ added in v1.2.3
func RawBundleToQueryBundle(rawFinalizedBundle types.FinalizedBundle, versionMap map[int32]uint64) (queryBundle queryTypes.FinalizedBundle)
func RawBundleToQueryBundleResponse ¶ added in v1.5.0
func RawBundleToQueryBundleResponse(rawFinalizedBundle types.FinalizedBundle, versionMap map[int32]uint64) (queryBundle queryTypes.QueryFinalizedBundleResponse)
Types ¶
type Keeper ¶
type Keeper struct { Schema collections.Schema BundlesParams collections.Item[types.Params] // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, memService store.MemoryStoreService, logger log.Logger, authority string, accountKeeper types.AccountKeeper, bankKeeper util.BankKeeper, distrkeeper util.DistributionKeeper, poolKeeper types.PoolKeeper, stakerKeeper types.StakerKeeper, delegationKeeper types.DelegationKeeper, fundersKeeper types.FundersKeeper, ) Keeper
func (Keeper) AssertCanPropose ¶
func (k Keeper) AssertCanPropose(ctx sdk.Context, poolId uint64, staker string, proposer string, fromIndex uint64) error
AssertCanPropose checks whether a participant can submit the next bundle proposal in a storage pool
func (Keeper) AssertCanVote ¶
func (k Keeper) AssertCanVote(ctx sdk.Context, poolId uint64, staker string, voter string, storageId string) error
AssertCanVote checks whether a participant in the network can vote on a bundle proposal in a storage pool
func (Keeper) AssertPoolCanRun ¶
AssertPoolCanRun checks whether the given pool fulfils all technical/formal requirements to produce bundles
func (Keeper) GetAllBundleProposals ¶
func (k Keeper) GetAllBundleProposals(ctx sdk.Context) (list []types.BundleProposal)
GetAllBundleProposals returns all bundle proposals of all pools
func (Keeper) GetAllFinalizedBundles ¶
func (k Keeper) GetAllFinalizedBundles(ctx sdk.Context) (list []types.FinalizedBundle)
func (Keeper) GetAllRoundRobinProgress ¶ added in v1.3.0
func (k Keeper) GetAllRoundRobinProgress(ctx sdk.Context) (list []types.RoundRobinProgress)
GetAllRoundRobinProgress returns the round-robin progress of all pools
func (Keeper) GetBundleProposal ¶
func (k Keeper) GetBundleProposal(ctx sdk.Context, poolId uint64) (val types.BundleProposal, found bool)
GetBundleProposal returns the bundle proposal for the given pool with id `poolId`
func (Keeper) GetBundleVersionMap ¶ added in v1.2.3
func (k Keeper) GetBundleVersionMap(ctx sdk.Context) (val types.BundleVersionMap)
GetBundleVersionMap returns the bundle version map
func (Keeper) GetFinalizedBundle ¶
func (k Keeper) GetFinalizedBundle(ctx sdk.Context, poolId, id uint64) (val types.FinalizedBundle, found bool)
GetFinalizedBundle returns a finalized bundle by its identifier
func (Keeper) GetFinalizedBundleByIndex ¶ added in v1.2.3
func (k Keeper) GetFinalizedBundleByIndex(ctx sdk.Context, poolId, index uint64) (val queryTypes.FinalizedBundle, found bool)
func (Keeper) GetFinalizedBundlesByPool ¶
func (Keeper) GetMaxPoints ¶
GetMaxPoints returns the MaxPoints param
func (Keeper) GetNetworkFee ¶
GetNetworkFee returns the NetworkFee param
func (Keeper) GetPaginatedFinalizedBundleQuery ¶
func (k Keeper) GetPaginatedFinalizedBundleQuery(ctx sdk.Context, pagination *query.PageRequest, poolId uint64) ([]queryTypes.FinalizedBundle, *query.PageResponse, error)
GetPaginatedFinalizedBundleQuery parses a paginated request and builds a valid response out of the raw finalized bundles. It uses the fact that the ID of a bundle increases incrementally (starting with 0) and allows therefore for efficient queries using `offset`.
func (Keeper) GetRoundRobinProgress ¶ added in v1.3.0
func (k Keeper) GetRoundRobinProgress(ctx sdk.Context, poolId uint64) (val types.RoundRobinProgress, found bool)
GetRoundRobinProgress returns the round-robin progress for a pool
func (Keeper) GetStorageCost ¶
GetStorageCost returns the StorageCost param
func (Keeper) GetUploadTimeout ¶
GetUploadTimeout returns the UploadTimeout param
func (Keeper) GetVoteDistribution ¶
func (k Keeper) GetVoteDistribution(ctx sdk.Context, poolId uint64) (voteDistribution types.VoteDistribution)
GetVoteDistribution is an internal function evaluates the quorum status based on the voting power of the current bundle proposal.
func (Keeper) HandleUploadTimeout ¶
HandleUploadTimeout is an end block hook that triggers an upload timeout for every pool (if applicable).
func (Keeper) InitMemStore ¶
func (Keeper) LoadRoundRobinValidatorSet ¶ added in v1.3.0
func (k Keeper) LoadRoundRobinValidatorSet(ctx sdk.Context, poolId uint64) RoundRobinValidatorSet
LoadRoundRobinValidatorSet initialises a validator set for the given pool id. If available it fetches the current round-robin state. Then it iterates all current pool validators and initialises the set accordingly. If a validator left the pool, the progress will be ignored. If new validators joined the pool, their progress will -1.125 * total_pool_delegation. The -1 is necessary to put them at the end of the queue (as the queue is centered around zero). The additional -0.125 are added as a penalty factor.
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) SaveRoundRobinValidatorSet ¶ added in v1.3.0
func (k Keeper) SaveRoundRobinValidatorSet(ctx sdk.Context, vs RoundRobinValidatorSet)
SaveRoundRobinValidatorSet saves the current round-robin progress for the given poolId to the KV-Store
func (Keeper) SetBundleProposal ¶
func (k Keeper) SetBundleProposal(ctx sdk.Context, bundleProposal types.BundleProposal)
SetBundleProposal stores a current bundle proposal in the KV-Store. There is only one bundle proposal per pool
func (Keeper) SetBundleVersionMap ¶ added in v1.2.3
func (k Keeper) SetBundleVersionMap(ctx sdk.Context, bundleVersionMap types.BundleVersionMap)
SetBundleVersionMap stores the bundle version map
func (Keeper) SetFinalizedBundle ¶
func (k Keeper) SetFinalizedBundle(ctx sdk.Context, finalizedBundle types.FinalizedBundle)
SetFinalizedBundle stores a finalized bundle identified by its `poolId` and `id`.
func (Keeper) SetFinalizedBundleIndexes ¶
func (k Keeper) SetFinalizedBundleIndexes(ctx sdk.Context, finalizedBundle types.FinalizedBundle)
SetFinalizedBundleIndexes sets an in-memory reference for every bundle sorted by pool/fromIndex to allow querying for specific bundle ranges.
func (Keeper) SetRoundRobinProgress ¶ added in v1.3.0
func (k Keeper) SetRoundRobinProgress(ctx sdk.Context, roundRobinProgress types.RoundRobinProgress)
SetRoundRobinProgress stores the round-robin progress for a pool
type RoundRobinValidatorPower ¶ added in v1.3.0
RoundRobinValidatorPower contains the total delegation of a protocol validator. It is used as a cache because the calculation of the total delegation needs to access the KV-Store and therefore consumes gas everytime it is called. This value is only stored for the current round and only lives inside the memory.
type RoundRobinValidatorSet ¶ added in v1.3.0
type RoundRobinValidatorSet struct { PoolId uint64 Validators []RoundRobinValidatorPower Progress map[string]int64 }
RoundRobinValidatorSet is the in memory-object for working with the round-robin state It can not be stored to the KV-Store as the Go map iterator is non-deterministic. To obtain a deterministic state of the current state call GetRoundRobinProgress().
func (*RoundRobinValidatorSet) GetRoundRobinProgress ¶ added in v1.3.0
func (vs *RoundRobinValidatorSet) GetRoundRobinProgress() []*types.RoundRobinSingleValidatorProgress
GetRoundRobinProgress returns a deterministic (sorted) list of the current round-robin progress. Due to the fact that maps have no order in Go, we must introduce one by ourselves. This is done by sorting all entries by their addresses alphabetically.
func (*RoundRobinValidatorSet) NextProposer ¶ added in v1.3.0
func (vs *RoundRobinValidatorSet) NextProposer(excludedAddresses ...string) string
NextProposer advances the current round-robin state by one round, i.e. adjusting the progress of all (non-excluded) validators of the set. It then picks the top validator (if not excluded) and puts it to the end of the queue. This validator is the then returned as the "nextProposer". If the entire set is excluded then the algorithm proceeds as if nobody were excluded.
Source Files ¶
- getters_bundles.go
- getters_params.go
- getters_round_robin.go
- grpc_query.go
- grpc_query_params.go
- keeper.go
- logic_bundles.go
- logic_end_block_handle_upload_timeout.go
- logic_round_robin.go
- msg_server.go
- msg_server_claim_uploader_role.go
- msg_server_skip_uploader_role.go
- msg_server_submit_bundle_proposal.go
- msg_server_update_params.go
- msg_server_vote_bundle_proposal.go