shared

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClaimWindowCloseHeight

func GetClaimWindowCloseHeight(sharedParams *sharedtypes.Params, queryHeight int64) int64

GetClaimWindowCloseHeight returns the block height at which the claim window of the session that includes queryHeight closes, for the provided sharedParams.

func GetClaimWindowOpenHeight

func GetClaimWindowOpenHeight(sharedParams *sharedtypes.Params, queryHeight int64) int64

GetClaimWindowOpenHeight returns the block height at which the claim window of the session that includes queryHeight opens, for the provided sharedParams.

func GetEarliestSupplierClaimCommitHeight

func GetEarliestSupplierClaimCommitHeight(
	sharedParams *sharedtypes.Params,
	queryHeight int64,
	claimWindowOpenBlockHash []byte,
	supplierOperatorAddr string,
) int64

GetEarliestSupplierClaimCommitHeight returns the earliest block height at which a claim for the session that includes queryHeight can be committed for a given supplier and the passed sharedParams. TODO_CLEANUP_DELETE(@red-0ne, @olshansk): Having claim distribution windows was a requirement that was never determined to be necessary, but implemented regardless. We are keeping around the functions but TBD whether it is deemed necessary. The results of #711 are tengentially related to this requirement, after which the functions, helpers, comments and docs for claim distribution can either be repurposed or deleted.

func GetEarliestSupplierProofCommitHeight

func GetEarliestSupplierProofCommitHeight(
	sharedParams *sharedtypes.Params,
	queryHeight int64,
	proofWindowOpenBlockHash []byte,
	supplierOperatorAddr string,
) int64

GetEarliestSupplierProofCommitHeight returns the earliest block height at which a proof for the session that includes queryHeight can be committed for a given supplier and the passed sharedParams. TODO_CLEANUP_DELETE(@red-0ne, @olshansk): Having proof distribution windows was a requirement that was never determined to be necessary, but implemented regardless. We are keeping around the functions but TBD whether it is deemed necessary. The results of #711 are tengentially related to this requirement, after which the functions, helpers, comments and docs for claim distribution can either be repurposed or deleted.

func GetNextSessionStartHeight added in v0.0.6

func GetNextSessionStartHeight(sharedParams *sharedtypes.Params, queryHeight int64) int64

GetNextSessionStartHeight returns the start block height of the session following the session that includes queryHeight, given the passed sharedParams.

func GetProofWindowCloseHeight

func GetProofWindowCloseHeight(sharedParams *sharedtypes.Params, queryHeight int64) int64

GetProofWindowCloseHeight returns the block height at which the proof window of the session that includes queryHeight closes, given the passed sharedParams.

func GetProofWindowOpenHeight

func GetProofWindowOpenHeight(sharedParams *sharedtypes.Params, queryHeight int64) int64

GetProofWindowOpenHeight returns the block height at which the claim window of the session that includes queryHeight opens, given the passed sharedParams.

func GetSessionEndHeight

func GetSessionEndHeight(sharedParams *sharedtypes.Params, queryHeight int64) int64

GetSessionEndHeight returns the block height at which the session containing queryHeight ends, given the passed shared on-chain parameters. Returns 0 if the block height is not a consensus produced block. Example: If NumBlocksPerSession == 4, sessions end at blocks 4, 8, 11, etc.

func GetSessionGracePeriodEndHeight

func GetSessionGracePeriodEndHeight(sharedParams *sharedtypes.Params, queryHeight int64) int64

GetSessionGracePeriodEndHeight returns the block height at which the grace period for the session that includes queryHeight elapses, given the passed sharedParams. The grace period is the number of blocks after the session ends during which relays SHOULD be included in the session which most recently ended.

func GetSessionNumber

func GetSessionNumber(sharedParams *sharedtypes.Params, queryHeight int64) int64

GetSessionNumber returns the session number of the session containing queryHeight, given the passed on-chain shared parameters. shared on-chain parameters. Returns session number 0 if the block height is not a consensus produced block. Returns session number 1 for block 1 to block NumBlocksPerSession - 1 (inclusive). i.e. If NubBlocksPerSession == 4, session == 1 for [1, 4], session == 2 for [5, 8], etc.

func GetSessionStartHeight

func GetSessionStartHeight(sharedParams *sharedtypes.Params, queryHeight int64) int64

GetSessionStartHeight returns the block height at which the session containing queryHeight starts, given the passed shared on-chain parameters. Returns 0 if the block height is not a consensus produced block. Example: If NumBlocksPerSession == 4, sessions start at blocks 1, 5, 9, etc.

func GetSupplierUnbondingHeight added in v0.0.5

func GetSupplierUnbondingHeight(
	sharedParams *sharedtypes.Params,
	supplier *sharedtypes.Supplier,
) int64

GetSupplierUnbondingHeight returns the session end height at which the given supplier finishes unbonding.

func IsGracePeriodElapsed

func IsGracePeriodElapsed(sharedParams *sharedtypes.Params, queryHeight, currentHeight int64) bool

IsGracePeriodElapsed returns true if the grace period for the session ending with sessionEndHeight has elapsed, given currentHeight.

Types

This section is empty.

Directories

Path Synopsis
Package types is a reverse proxy.
Package types is a reverse proxy.

Jump to

Keyboard shortcuts

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