utils

package
v0.8.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	EventPrefix = "lava_"
)
View Source
const TIMEOUT = 10

Variables

View Source
var (
	TimeoutMutex           = "false"
	TimeoutMutexBoolean, _ = strconv.ParseBool(TimeoutMutex)
)
View Source
var VRFValueAboveReliabilityThresholdError = sdkerrors.New("VRFValueAboveReliabilityThreshold Error", 1, "calculated vrf does not result in a smaller value than threshold") // client could'nt connect to any provider.

Functions

func CalculateQueryHash added in v0.4.3

func CalculateQueryHash(relayReq pairingtypes.RelayRequest) (queryHash []byte)

func CalculateVrfOnRelay added in v0.4.3

func CalculateVrfOnRelay(request *pairingtypes.RelayRequest, response *pairingtypes.RelayReply, vrf_sk vrf.PrivateKey, currentEpoch uint64) ([]byte, []byte)

func Deserialize

func Deserialize(raw []byte, data any)

func FormatDataForVrf added in v0.4.3

func FormatDataForVrf(request *pairingtypes.RelayRequest, response *pairingtypes.RelayReply, differentiator bool, currentEpoch uint64) (data []byte)

func GeneratePrivateVRFKey added in v0.4.3

func GeneratePrivateVRFKey() (vrf.PrivateKey, vrf.PublicKey, error)

func GetIndexForVrf added in v0.4.3

func GetIndexForVrf(vrf []byte, providersCount uint32, reliabilityThreshold uint32) (index int64, err error)

func LavaError added in v0.4.3

func LavaError(ctx sdk.Context, logger log.Logger, name string, attributes map[string]string, description string) error

func LavaFormatDebug

func LavaFormatDebug(description string, extraAttributes *map[string]string) error

func LavaFormatError

func LavaFormatError(description string, err error, extraAttributes *map[string]string) error

func LavaFormatFatal

func LavaFormatFatal(description string, err error, extraAttributes *map[string]string)

func LavaFormatInfo

func LavaFormatInfo(description string, extraAttributes *map[string]string) error

func LavaFormatLog

func LavaFormatLog(description string, err error, extraAttributes *map[string]string, severity uint) error

func LavaFormatWarning

func LavaFormatWarning(description string, err error, extraAttributes *map[string]string) error

func LogLavaEvent

func LogLavaEvent(ctx sdk.Context, logger log.Logger, name string, attributes map[string]string, description string)

func LoggingLevel added in v0.4.3

func LoggingLevel(logLevel string)

func OpenKeyring added in v0.4.3

func OpenKeyring(clientCtx client.Context) (keyring.Keyring, error)

func ProveVrfOnRelay added in v0.4.3

func ProveVrfOnRelay(request *pairingtypes.RelayRequest, response *pairingtypes.RelayReply, vrf_sk vrf.PrivateKey, differentiator bool, currentEpoch uint64) (vrf_res []byte, proof []byte)

func Serialize

func Serialize(data any) []byte

func VerifyVRF added in v0.4.3

func VerifyVRF(vrfpk string) error

func VerifyVrfProof added in v0.4.3

func VerifyVrfProof(request *pairingtypes.RelayRequest, vrf_pk VrfPubKey, relayEpochStart uint64) (valid bool)

func VerifyVrfProofFromVRFData added in v0.4.3

func VerifyVrfProofFromVRFData(reliabilityData *pairingtypes.VRFData, vrf_pk VrfPubKey, relayEpochStart uint64) (valid bool)

Types

type LavaMutex

type LavaMutex struct {
	SecondsLeft int
	// contains filtered or unexported fields
}

func (*LavaMutex) Lock

func (dm *LavaMutex) Lock()

func (*LavaMutex) TryLock

func (dm *LavaMutex) TryLock() (isLocked bool)

func (*LavaMutex) Unlock

func (dm *LavaMutex) Unlock()

type Lockable

type Lockable interface {
	Lock()
	TryLock() bool
	Unlock()
}

type VrfPubKey added in v0.4.3

type VrfPubKey struct {
	// contains filtered or unexported fields
}

func GenerateVRFKey added in v0.4.3

func GenerateVRFKey(clientCtx client.Context) (vrf.PrivateKey, *VrfPubKey, error)

func GetOrCreateVRFKey added in v0.4.3

func GetOrCreateVRFKey(clientCtx client.Context) (sk vrf.PrivateKey, pk *VrfPubKey, err error)

func LoadVRFKey added in v0.4.3

func LoadVRFKey(clientCtx client.Context) (vrf.PrivateKey, *VrfPubKey, error)

func (*VrfPubKey) Bytes added in v0.4.3

func (pk *VrfPubKey) Bytes() []byte

func (*VrfPubKey) DecodeFromBech32 added in v0.4.3

func (pk *VrfPubKey) DecodeFromBech32(bech32str string) (*VrfPubKey, error)

func (*VrfPubKey) EncodeBech32 added in v0.4.3

func (pk *VrfPubKey) EncodeBech32() (string, error)

func (*VrfPubKey) Equals added in v0.4.3

func (pk *VrfPubKey) Equals(pk2 VrfPubKey) bool

func (*VrfPubKey) MarshalTo added in v0.4.3

func (pk *VrfPubKey) MarshalTo(dAtA []byte) (int, error)

// MarshalTo implements proto.Marshaler interface.

func (*VrfPubKey) Reset added in v0.4.3

func (pk *VrfPubKey) Reset()

func (*VrfPubKey) String added in v0.4.3

func (pk *VrfPubKey) String() string

String returns a string representation of the public key

func (*VrfPubKey) Unmarshal added in v0.4.3

func (pk *VrfPubKey) Unmarshal(bz []byte) error

// Unmarshal implements proto.Marshaler interface.

func (*VrfPubKey) VerifySignature added in v0.4.3

func (pk *VrfPubKey) VerifySignature(m []byte, vrfBytes []byte, proof []byte) bool

Jump to

Keyboard shortcuts

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