Documentation
¶
Index ¶
- Variables
- func GetSessionId(sharedParams *sharedtypes.Params, appAddr, serviceId string, ...) (sessionId string, sessionIdBz []byte)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewSessionHydrator(appAddress string, serviceId string, blockHeight int64) *sessionHydrator
- type Keeper
- func (k Keeper) GetAllParamsHistory(ctx context.Context) []types.ParamsUpdate
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetBlockHash(ctx context.Context, height int64) []byte
- func (k Keeper) GetParams(ctx context.Context) (params types.Params)
- func (k Keeper) GetParamsAtHeight(ctx context.Context, queryHeight int64) types.Params
- func (k Keeper) GetSession(ctx context.Context, req *types.QueryGetSessionRequest) (*types.QueryGetSessionResponse, error)
- func (k Keeper) GetSessionId(ctx context.Context, appAddr, serviceId string, blockHashBz []byte, ...) (sessionId string, sessionIdBz []byte)
- func (k Keeper) HasParamsHistory(ctx context.Context) bool
- func (k Keeper) HydrateSession(ctx context.Context, sh *sessionHydrator) (*types.Session, error)
- func (k Keeper) Logger() log.Logger
- func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) RecordParamsHistory(ctx context.Context, newParams types.Params) error
- func (k Keeper) SetParams(ctx context.Context, params types.Params) error
- func (k Keeper) SetParamsAtHeight(ctx context.Context, effectiveHeight int64, params types.Params) error
- func (k Keeper) StoreBlockHash(goCtx context.Context)
Constants ¶
This section is empty.
Variables ¶
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 onchain parameters, application address, service ID, and block hash.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func NewSessionHydrator ¶
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) GetAllParamsHistory ¶ added in v0.1.31
func (k Keeper) GetAllParamsHistory(ctx context.Context) []types.ParamsUpdate
GetAllParamsHistory returns all historical session params updates. This is primarily used for genesis export and debugging.
func (Keeper) GetAuthority ¶
GetAuthority returns the module's authority.
func (Keeper) GetBlockHash ¶
GetBlockHash returns the hash of the block at the given height.
func (Keeper) GetParamsAtHeight ¶ added in v0.1.31
GetParamsAtHeight returns the session params that were effective at the given height. It finds the most recent params entry where effective_height <= queryHeight. If no historical params exist, it returns the current params (backwards compatible).
func (Keeper) GetSession ¶
func (k Keeper) GetSession(ctx context.Context, req *types.QueryGetSessionRequest) (*types.QueryGetSessionResponse, error)
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) HasParamsHistory ¶ added in v0.1.33
HasParamsHistory returns true if any params history entries exist. This is used to efficiently check if history needs initialization without the O(n) cost of GetAllParamsHistory.
func (Keeper) HydrateSession ¶
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.
func (Keeper) Params ¶
func (k Keeper) Params( ctx context.Context, req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error)
func (Keeper) RecordParamsHistory ¶ added in v0.1.31
RecordParamsHistory ensures session params history is properly tracked. It initializes history with current params if needed, then records new params with their effective height (next session start).
func (Keeper) SetParamsAtHeight ¶ added in v0.1.31
func (k Keeper) SetParamsAtHeight(ctx context.Context, effectiveHeight int64, params types.Params) error
SetParamsAtHeight stores a snapshot of session params with their effective height. This enables historical lookups of params that were active at a given block height.
func (Keeper) StoreBlockHash ¶
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.