Documentation ¶
Index ¶
- Constants
- func ComputeNewDifficultyTargetHash(prevTargetHash []byte, targetNumRelays, newRelaysEma uint64) []byte
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) ComputeUnitsToTokensMultiplier(ctx context.Context) uint64
- func (k Keeper) GetAllRelayMiningDifficulty(ctx context.Context) (list []types.RelayMiningDifficulty)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetParams(ctx context.Context) (params types.Params)
- func (k Keeper) GetRelayMiningDifficulty(ctx context.Context, serviceId string) (difficulty types.RelayMiningDifficulty, found bool)
- func (k Keeper) Logger() log.Logger
- func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) RelayMiningDifficulty(ctx context.Context, req *types.QueryGetRelayMiningDifficultyRequest) (*types.QueryGetRelayMiningDifficultyResponse, error)
- func (k Keeper) RelayMiningDifficultyAll(ctx context.Context, req *types.QueryAllRelayMiningDifficultyRequest) (*types.QueryAllRelayMiningDifficultyResponse, error)
- func (k Keeper) RemoveRelayMiningDifficulty(ctx context.Context, serviceId string)
- func (k Keeper) SetParams(ctx context.Context, params types.Params) error
- func (k Keeper) SetRelayMiningDifficulty(ctx context.Context, relayMiningDifficulty types.RelayMiningDifficulty)
- func (k Keeper) SettlePendingClaims(ctx sdk.Context) (settledResult types.PendingClaimsResult, ...)
- func (k Keeper) SettleSessionAccounting(ctx context.Context, claim *prooftypes.Claim) (err error)
- func (k Keeper) UpdateRelayMiningDifficulty(ctx context.Context, relaysPerServiceMap map[string]uint64) (difficultyPerServiceMap map[string]types.RelayMiningDifficulty, err error)
Constants ¶
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 ¶
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 ¶
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 ¶
GetAuthority returns the x/tokenomics module's authority.
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) Params ¶
func (k Keeper) Params( ctx context.Context, req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error)
func (Keeper) RelayMiningDifficulty ¶ added in v0.0.3
func (k Keeper) RelayMiningDifficulty(ctx context.Context, req *types.QueryGetRelayMiningDifficultyRequest) (*types.QueryGetRelayMiningDifficultyResponse, error)
func (Keeper) RelayMiningDifficultyAll ¶ added in v0.0.3
func (k Keeper) RelayMiningDifficultyAll(ctx context.Context, req *types.QueryAllRelayMiningDifficultyRequest) (*types.QueryAllRelayMiningDifficultyResponse, error)
func (Keeper) RemoveRelayMiningDifficulty ¶ added in v0.0.3
RemoveRelayMiningDifficulty removes a relayMiningDifficulty from the store
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.