lavaprotocol

package
v3.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheMaxCost     = 10 * 1024 // each item cost would be 1
	CacheNumCounters = 20000     // expect 2000 items
	RetryEntryTTL    = 6 * time.Hour
)

entries ttl duration

Variables

This section is empty.

Functions

func ConstructRelayRequest

func ConstructRelayRequest(ctx context.Context, privKey *btcec.PrivateKey, lavaChainID, chainID string, relayRequestData *pairingtypes.RelayPrivateData, providerPublicAddress string, consumerSession *lavasession.SingleConsumerSession, epoch int64, reportedProviders []*pairingtypes.ReportedProvider) (*pairingtypes.RelayRequest, error)

func ConstructRelaySession

func ConstructRelaySession(lavaChainID string, relayRequestData *pairingtypes.RelayPrivateData, chainID, providerPublicAddress string, singleConsumerSession *lavasession.SingleConsumerSession, epoch int64, reportedProviders []*pairingtypes.ReportedProvider) *pairingtypes.RelaySession

func GetSalt

func GetSalt(requestData *pairingtypes.RelayPrivateData) uint64

func NewRelayData

func NewRelayData(ctx context.Context, connectionType, apiUrl string, data []byte, seenBlock int64, requestBlock int64, apiInterface string, metadata []pairingtypes.Metadata, addon string, extensions []string) *pairingtypes.RelayPrivateData

func ReplaceRequestedBlock

func ReplaceRequestedBlock(requestedBlock, latestBlock int64) int64

func SetRequestedBlockNotApplicable

func SetRequestedBlockNotApplicable(request *pairingtypes.RelayPrivateData)

currently used when cache hits. we don't want DR.

func SetSalt

func SetSalt(requestData *pairingtypes.RelayPrivateData, value uint64)

func SignRelayResponse

func SignRelayResponse(consumerAddress sdk.AccAddress, request pairingtypes.RelayRequest, pkey *btcSecp256k1.PrivateKey, reply *pairingtypes.RelayReply, signDataReliability bool) (*pairingtypes.RelayReply, error)

func UpdateRequestedBlock

func UpdateRequestedBlock(request *pairingtypes.RelayPrivateData, response *pairingtypes.RelayReply)

func VerifyRelayReply

func VerifyRelayReply(ctx context.Context, reply *pairingtypes.RelayReply, relayRequest *pairingtypes.RelayRequest, addr string) error

func VerifyReliabilityResults

func VerifyReliabilityResults(ctx context.Context, originalResult, dataReliabilityResult *common.RelayResult, apiCollection *spectypes.ApiCollection, headerFilterer HeaderFilterer) (conflicts *conflicttypes.ResponseConflict)

Types

type HeaderFilterer

type HeaderFilterer interface {
	HandleHeaders(metadata []pairingtypes.Metadata, apiCollection *spectypes.ApiCollection, headersDirection spectypes.Header_HeaderType) (filtered []pairingtypes.Metadata, overwriteReqBlock string, ignoredMetadata []pairingtypes.Metadata)
}

type RelayRequestCommonData

type RelayRequestCommonData struct {
	ChainID        string `protobuf:"bytes,1,opt,name=chainID,proto3" json:"chainID,omitempty"`
	ConnectionType string `protobuf:"bytes,2,opt,name=connection_type,json=connectionType,proto3" json:"connection_type,omitempty"`
	ApiUrl         string `protobuf:"bytes,3,opt,name=api_url,json=apiUrl,proto3" json:"api_url,omitempty"`
	Data           []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
	RequestBlock   int64  `protobuf:"varint,5,opt,name=request_block,json=requestBlock,proto3" json:"request_block,omitempty"`
	ApiInterface   string `protobuf:"bytes,6,opt,name=apiInterface,proto3" json:"apiInterface,omitempty"`
}

type RelayRetriesManager

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

On node errors we try to send a relay again. If this relay failed all retries we ban it from retries to avoid spam and save resources

func NewRelayRetriesManager

func NewRelayRetriesManager() *RelayRetriesManager

func (*RelayRetriesManager) AddHashToCache

func (rrm *RelayRetriesManager) AddHashToCache(hash string)

Add hash to the retry cache.

func (*RelayRetriesManager) CheckHashInCache

func (rrm *RelayRetriesManager) CheckHashInCache(hash string) bool

Check if we already have this hash so we don't retry.

func (*RelayRetriesManager) RemoveHashFromCache

func (rrm *RelayRetriesManager) RemoveHashFromCache(hash string)

Remove hash from cache if it exists

type RelayRetriesManagerInf

type RelayRetriesManagerInf interface {
	AddHashToCache(hash string)
	CheckHashInCache(hash string) bool
	RemoveHashFromCache(hash string)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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