keeper

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 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_MAINNET(#542): Make this a governance parameter and figure out the correct value.
	TargetNumRelays = uint64(10e4)
)

Functions

func NewDefaultRelayMiningDifficulty added in v0.0.10

func NewDefaultRelayMiningDifficulty(
	ctx context.Context,
	logger log.Logger,
	serviceId string,
	numRelays uint64,
) types.RelayMiningDifficulty

NewDefaultRelayMiningDifficulty is a helper that creates a new RelayMiningDifficulty structure if one is not available. It is often used to set the default when a service's difficulty is being initialized for the first time.

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,
) Keeper

func (Keeper) AllServices

AllServices queries all services.

func (Keeper) GetAllRelayMiningDifficulty added in v0.0.10

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

GetAllRelayMiningDifficulty returns all relayMiningDifficulty

func (Keeper) GetAllServices added in v0.0.4

func (k Keeper) GetAllServices(ctx context.Context) (services []sharedtypes.Service)

GetAllServices returns all services

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the 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.10

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

GetRelayMiningDifficulty returns a relayMiningDifficulty from its index

func (Keeper) GetService

func (k Keeper) GetService(
	ctx context.Context,
	serviceId string,
) (service sharedtypes.Service, found bool)

GetService returns a service from its index

func (Keeper) Logger

func (k Keeper) Logger() log.Logger

Logger returns a module-specific logger.

func (Keeper) Params

func (Keeper) RelayMiningDifficulty added in v0.0.10

func (Keeper) RelayMiningDifficultyAll added in v0.0.10

func (Keeper) RemoveRelayMiningDifficulty added in v0.0.10

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

RemoveRelayMiningDifficulty removes a relayMiningDifficulty from the store

func (Keeper) RemoveService

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

RemoveService removes a service from the store

func (Keeper) Service

Service returns the requested service if it exists.

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.10

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

SetRelayMiningDifficulty set a specific relayMiningDifficulty in the store from its index

func (Keeper) SetService

func (k Keeper) SetService(ctx context.Context, service sharedtypes.Service)

SetService set a specific service in the store from its index

func (Keeper) UpdateRelayMiningDifficulty added in v0.0.10

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