utils

package
v1.4.4-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConcatBytes

func ConcatBytes(margin int, bzs ...[]byte) []byte

ConcatBytes creates a new slice by merging list of bytes and leaving empty amount of margin bytes at the end.

func DenomFromRequestKey added in v0.9.6

func DenomFromRequestKey(query []byte, accAddr sdk.AccAddress) (string, error)

func DeriveIbcDenom

func DeriveIbcDenom(port, channel, denom string) string

func DeriveIbcDenomTrace

func DeriveIbcDenomTrace(port, channel, denom string) ibctransfertypes.DenomTrace

func GatherAllKeysFromStore added in v0.9.0

func GatherAllKeysFromStore(storeObj store.KVStore) []string

func GatherValuesFromStore added in v0.9.0

func GatherValuesFromStore[T any](storeObj store.KVStore, keyStart, keyEnd []byte, parseValue func([]byte) (T, error)) ([]T, error)

func GatherValuesFromStorePrefix added in v0.9.0

func GatherValuesFromStorePrefix[T any](storeObj store.KVStore, prefix []byte, parseValue func([]byte) (T, error)) ([]T, error)

func GetFirstValueAfterPrefixInclusive added in v0.9.0

func GetFirstValueAfterPrefixInclusive[T any](storeObj store.KVStore, keyStart []byte, parseValue func([]byte) (T, error)) (T, error)

func GetFirstValueInRange added in v0.9.0

func GetFirstValueInRange[T any](storeObj store.KVStore, keyStart, keyEnd []byte, reverseIterate bool, parseValue func([]byte) (T, error)) (T, error)

func GetIterValuesWithStop added in v0.9.0

func GetIterValuesWithStop[T any](
	storeObj store.KVStore,
	keyStart []byte,
	keyEnd []byte,
	reverse bool,
	stopFn func([]byte) bool,
	parseValue func([]byte) (T, error),
) ([]T, error)

func GetValuesUntilDerivedStop added in v0.9.0

func GetValuesUntilDerivedStop[T any](storeObj store.KVStore, keyStart []byte, stopFn func([]byte) bool, parseValue func([]byte) (T, error)) ([]T, error)

func Keys added in v0.9.0

func Keys[V interface{}](in map[string]V) []string

func MockProofOps added in v0.10.0

func MockProofOps(_ sdk.Context, _ *ibckeeper.Keeper, _, _ string, _ int64, _ string, _, _ []byte, _ *crypto.ProofOps) error

func MockSelfProofOps

func MockSelfProofOps(_ sdk.Context, _ claimsmanagerkeeper.Keeper, _, _ string, _, _ []byte, _ *crypto.ProofOps) error

func MustGet added in v0.9.0

func MustGet(storeObj store.KVStore, key []byte, result proto.Message)

MustGet gets key from store by mutating result Panics on any error.

func MustGetDec added in v0.9.0

func MustGetDec(storeObj store.KVStore, key []byte) sdk.Dec

MustGetDec gets dec value from store at key. Panics on any error.

func MustSet added in v0.9.0

func MustSet(storeObj store.KVStore, key []byte, value proto.Message)

MustSet runs store.Set(key, proto.Marshal(value)) but panics on any error.

func MustSetDec added in v0.9.0

func MustSetDec(storeObj store.KVStore, key []byte, value sdk.Dec)

MustSetDec sets dec value to store at key. Panics on any error.

func SortSlice added in v0.9.0

func SortSlice[T constraints.Ordered](s []T)

SortSlice sorts a slice of type T elements that implement constraints.Ordered. Mutates input slice s.

func Unique added in v0.9.0

func Unique[V interface{}](in []V) []V

func ValidateProofOps added in v0.6.0

func ValidateProofOps(
	ctx sdk.Context,
	ibcKeeper *ibckeeper.Keeper,
	connectionID,
	chainID string,
	height int64,
	module string,
	key,
	data []byte,
	proofOps *crypto.ProofOps,
) error

func ValidateSelfProofOps

func ValidateSelfProofOps(ctx sdk.Context, claimsKeeper claimsmanagerkeeper.Keeper, consensusStateKey, module string, key, data []byte, proofOps *crypto.ProofOps) error

func Verify added in v1.2.4

func Verify(
	trustedHeader *types.SignedHeader,
	trustedVals *types.ValidatorSet,
	untrustedHeader *types.SignedHeader,
	untrustedVals *types.ValidatorSet,
	trustingPeriod time.Duration,
	now time.Time,
	maxClockDrift time.Duration,
	trustLevel tmmath.Fraction,
) error

Verify combines both VerifyAdjacent and VerifyNonAdjacent functions.

func VerifyAdjacent added in v1.2.4

func VerifyAdjacent(
	trustedHeader *types.SignedHeader,
	untrustedHeader *types.SignedHeader,
	untrustedVals *types.ValidatorSet,
	trustingPeriod time.Duration,
	now time.Time,
	maxClockDrift time.Duration,
) error

func VerifyNonAdjacent added in v0.9.0

func VerifyNonAdjacent(
	trustedHeader *types.SignedHeader,
	trustedVals *types.ValidatorSet,
	untrustedHeader *types.SignedHeader,
	untrustedVals *types.ValidatorSet,
	trustingPeriod time.Duration,
	now time.Time,
	_ time.Duration,
	trustLevel tmmath.Fraction,
) error

VerifyNonAdjacent is identical to VerifyNonAdjacent in tendermint/tendermint/light/verifier.go, with the exception that it does not attempt to validate that the block is _newer_ than the current consensus state.

Types

type ContextKey added in v0.6.0

type ContextKey string

func (ContextKey) String added in v0.6.0

func (c ContextKey) String() string

type ProofOpsFn added in v0.10.0

type ProofOpsFn func(ctx sdk.Context, ibcKeeper *ibckeeper.Keeper, connectionID, chainID string, height int64, module string, key []byte, data []byte, proofOps *crypto.ProofOps) error

type SelfProofOpsFn

type SelfProofOpsFn func(ctx sdk.Context, claimsKeeper claimsmanagerkeeper.Keeper, consensusStateKey, module string, key []byte, data []byte, proofOps *crypto.ProofOps) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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