keeper

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const TargetNumRelays = uint64(10e4)

TargetNumRelays is the target number of relays we want the network to mine for a specific service across all applications & suppliers per session. This number determines the total number of leafs to be created across in the off-chain SMTs, across all suppliers, for each service. It indirectly drives the off-chain resource requirements of the network in additional to playing a critical role in Relay Mining. TODO_BLOCKER(@Olshansk, #542): Make this a governance parameter.

Variables

This section is empty.

Functions

func ComputeNewDifficultyTargetHash added in v0.0.3

func ComputeNewDifficultyTargetHash(prevTargetHash []byte, targetNumRelays, newRelaysEma uint64) []byte

ComputeNewDifficultyTargetHash computes the new difficulty target hash based on the target number of relays we want the network to mine and the new EMA of the number of relays. NB: Exported for testing purposes only.

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,
	storeService store.KVStoreService,
	logger log.Logger,
	authority string,

	bankKeeper types.BankKeeper,
	accountKeeper types.AccountKeeper,
	applicationKeeper types.ApplicationKeeper,
	proofKeeper types.ProofKeeper,
	sharedKeeper types.SharedKeeper,
	sessionKeeper types.SessionKeeper,
) Keeper

func (Keeper) ComputeUnitsToTokensMultiplier

func (k Keeper) ComputeUnitsToTokensMultiplier(ctx context.Context) uint64

ComputeUnitsToTokensMultiplier returns the ComputeUnitsToTokensMultiplier param

func (Keeper) GetAllRelayMiningDifficulty added in v0.0.3

func (k Keeper) GetAllRelayMiningDifficulty(ctx context.Context) (list []types.RelayMiningDifficulty)

GetAllRelayMiningDifficulty returns all relayMiningDifficulty

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the x/tokenomics module's authority.

func (Keeper) GetParams

func (k Keeper) GetParams(ctx context.Context) (params types.Params)

GetParams get all parameters as types.Params

func (Keeper) GetRelayMiningDifficulty added in v0.0.3

func (k Keeper) GetRelayMiningDifficulty(
	ctx context.Context,
	serviceId string,
) (difficulty types.RelayMiningDifficulty, found bool)

GetRelayMiningDifficulty returns a relayMiningDifficulty from its index

func (Keeper) Logger

func (k Keeper) Logger() log.Logger

Logger returns a module-specific logger.

func (Keeper) Params

func (Keeper) RelayMiningDifficultyAll added in v0.0.3

func (Keeper) RemoveRelayMiningDifficulty added in v0.0.3

func (k Keeper) RemoveRelayMiningDifficulty(
	ctx context.Context,
	serviceId string,
)

RemoveRelayMiningDifficulty removes a relayMiningDifficulty from the store

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetRelayMiningDifficulty added in v0.0.3

func (k Keeper) SetRelayMiningDifficulty(ctx context.Context, relayMiningDifficulty types.RelayMiningDifficulty)

SetRelayMiningDifficulty set a specific relayMiningDifficulty in the store from its index

func (Keeper) SettlePendingClaims

func (k Keeper) SettlePendingClaims(ctx sdk.Context) (
	settledResult types.PendingClaimsResult,
	expiredResult types.PendingClaimsResult,
	err error,
)

SettlePendingClaims settles all pending (i.e. expiring) claims. If a claim is expired and requires a proof and a proof IS available -> it's settled. If a claim is expired and requires a proof and a proof IS NOT available -> it's deleted. If a claim is expired and does NOT require a proof -> it's settled. Events are emitted for each claim that is settled or removed. On-chain Claims & Proofs are deleted after they're settled or expired to free up space.

TODO_TECHDEBT: Refactor this function to return a struct instead of multiple return values.

func (Keeper) SettleSessionAccounting

func (k Keeper) SettleSessionAccounting(
	ctx context.Context,
	claim *prooftypes.Claim,
) (err error)

SettleSessionAccounting is responsible for all of the post-session accounting necessary to burn, mint or transfer tokens depending on the amount of work done. The amount of "work done" complete is dictated by `sum` of `root`.

ASSUMPTION: It is assumed the caller of this function validated the claim against a proof BEFORE calling this function.

TODO_MAINNET(@Olshansk): Research if there's a way to limit who can call this function?

func (Keeper) UpdateRelayMiningDifficulty added in v0.0.3

func (k Keeper) UpdateRelayMiningDifficulty(
	ctx context.Context,
	relaysPerServiceMap map[string]uint64,
) (difficultyPerServiceMap map[string]types.RelayMiningDifficulty, err error)

UpdateRelayMiningDifficulty updates the on-chain relay mining difficulty based on the amount of on-chain relays for each service, given a map of serviceId->numRelays.

Jump to

Keyboard shortcuts

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