Documentation ¶
Index ¶
- Constants
- func ConstructRelayRequest(ctx context.Context, privKey *btcec.PrivateKey, lavaChainID, chainID string, ...) (*pairingtypes.RelayRequest, error)
- func ConstructRelaySession(lavaChainID string, relayRequestData *pairingtypes.RelayPrivateData, ...) *pairingtypes.RelaySession
- func CraftEmptyRPCResponseFromGenericMessage(message rpcInterfaceMessages.GenericMessage) (*rpcInterfaceMessages.RPCResponse, error)
- func GetSalt(requestData *pairingtypes.RelayPrivateData) uint64
- func NewRelayData(ctx context.Context, connectionType, apiUrl string, data []byte, ...) *pairingtypes.RelayPrivateData
- func ReplaceRequestedBlock(requestedBlock, latestBlock int64) int64
- func SetRequestedBlockNotApplicable(request *pairingtypes.RelayPrivateData)
- func SetSalt(requestData *pairingtypes.RelayPrivateData, value uint64)
- func SignRelayResponse(consumerAddress sdk.AccAddress, request pairingtypes.RelayRequest, ...) (*pairingtypes.RelayReply, error)
- func UpdateRequestedBlock(request *pairingtypes.RelayPrivateData, response *pairingtypes.RelayReply)
- func VerifyRelayReply(ctx context.Context, reply *pairingtypes.RelayReply, ...) error
- func VerifyReliabilityResults(ctx context.Context, originalResult, dataReliabilityResult *common.RelayResult, ...) (conflicts *conflicttypes.ResponseConflict)
- type HeaderFilterer
- type RelayRequestCommonData
- type RelayRetriesManager
- type RelayRetriesManagerInf
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 CraftEmptyRPCResponseFromGenericMessage ¶
func CraftEmptyRPCResponseFromGenericMessage(message rpcInterfaceMessages.GenericMessage) (*rpcInterfaceMessages.RPCResponse, error)
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 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
Source Files ¶
Click to show internal directories.
Click to hide internal directories.