keeper

package
v0.0.9-3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NumSupplierPerSession = 15
)

TODO_BETA(@bryanchriswhite): Make this a governance parameter

Variables

View Source
var SHA3HashLen = crypto.SHA3_256.Size()

Functions

func GetSessionId

func GetSessionId(
	sharedParams *sharedtypes.Params,
	appAddr,
	serviceId string,
	blockHashBz []byte,
	blockHeight int64,
) (sessionId string, sessionIdBz []byte)

GetSessionId returns the string and bytes representation of the sessionId for the session containing blockHeight, given the shared on-chain parameters, application address, service ID, and block hash.

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

func NewSessionHydrator

func NewSessionHydrator(
	appAddress string,
	serviceId string,
	blockHeight int64,
) *sessionHydrator

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,

	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	applicationKeeper types.ApplicationKeeper,
	supplierKeeper types.SupplierKeeper,
	sharedKeeper types.SharedKeeper,
) Keeper

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the module's authority.

func (Keeper) GetBlockHash

func (k Keeper) GetBlockHash(ctx context.Context, height int64) []byte

GetBlockHash returns the hash of the block at the given height.

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetSession

GetSession should be deterministic and always return the same session for the same block height.

func (Keeper) GetSessionId added in v0.0.3

func (k Keeper) GetSessionId(
	ctx context.Context,
	appAddr,
	serviceId string,
	blockHashBz []byte,
	blockHeight int64,
) (sessionId string, sessionIdBz []byte)

GetSessionId returns the string and bytes representation of the sessionId given the application address, service ID, block hash, and block height that is used to get the session start block height.

func (Keeper) HydrateSession

func (k Keeper) HydrateSession(ctx context.Context, sh *sessionHydrator) (*types.Session, error)

GetSession implements of the exposed `UtilityModule.GetSession` function TECHDEBT(#519,#348): Add custom error types depending on the type of issue that occurred and assert on them in the unit tests. TODO_BETA: Consider returning an error if the application's stake has become very low.

func (Keeper) Logger

func (k Keeper) Logger() log.Logger

Logger returns a module-specific logger.

func (Keeper) Params

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) StoreBlockHash

func (k Keeper) StoreBlockHash(goCtx context.Context)

StoreBlockHash is called at the end of every block. It fetches the block hash from the committed block ans saves its hash in the store.

Jump to

Keyboard shortcuts

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