Documentation ¶
Overview ¶
Code generated by MockGen. DO NOT EDIT. Source: protocol/chainlib/chain_fetcher.go
Generated by this command:
mockgen -source=protocol/chainlib/chain_fetcher.go -destination protocol/chainlib/chain_fetcher_mock.go -package chainlib
Package chainlib is a generated GoMock package.
Index ¶
- Constants
- Variables
- func CompareRequestedBlockInBatch(firstRequestedBlock int64, second int64) (latestCombinedBlock int64, earliestCombinedBlock int64)
- func CreateChainLibMocks(ctx context.Context, specIndex string, apiInterface string, ...) (cpar ChainParser, crout ChainRouter, cfetc chaintracker.ChainFetcher, ...)
- func FormatResponseForParsing(reply *pairingtypes.RelayReply, chainMessage ChainMessageForSend) (parsable parser.RPCInput, err error)
- func GetAddon(chainMessage ChainMessage) string
- func GetComputeUnits(chainMessage ChainMessage) uint64
- func GetListenerWithRetryGrpc(protocol, addr string) net.Listener
- func GetRelayTimeout(chainMessage ChainMessage, chainParser ChainParser, timeouts int) time.Duration
- func GetStateful(chainMessage ChainMessage) uint32
- func HashCacheRequest(relayData *pairingtypes.RelayPrivateData, chainId string) ([]byte, func([]byte) []byte, error)
- func IsHangingApi(chainMessage ChainMessage) bool
- func IsSubscription(chainMessage ChainMessage) bool
- func ListenWithRetry(app *fiber.App, address string)
- func ShouldSendToAllProviders(chainMessage ChainMessage) bool
- func ValidateNilResponse(responseString string) error
- type ApiContainer
- type ApiKey
- type BaseChainParser
- func (bcp *BaseChainParser) Activate()
- func (bcp *BaseChainParser) Active() bool
- func (bcp *BaseChainParser) BuildMapFromPolicyQuery(policy PolicyInf, chainId string, apiInterface string) (map[string]struct{}, error)
- func (bcp *BaseChainParser) Construct(spec spectypes.Spec, taggedApis map[spectypes.FUNCTION_TAG]TaggedContainer, ...)
- func (bcp *BaseChainParser) ExtensionParsing(addon string, parsedMessageArg *baseChainMessageContainer, ...)
- func (bcp *BaseChainParser) ExtensionsParser() *extensionslib.ExtensionParser
- func (bcp *BaseChainParser) GetParsingByTag(tag spectypes.FUNCTION_TAG) (parsing *spectypes.ParseDirective, collectionData *spectypes.CollectionData, ...)
- func (bcp *BaseChainParser) GetVerifications(supported []string) (retVerifications []VerificationContainer, err error)
- func (bcp *BaseChainParser) HandleHeaders(metadata []pairingtypes.Metadata, apiCollection *spectypes.ApiCollection, ...) (filteredHeaders []pairingtypes.Metadata, overwriteRequestedBlock string, ...)
- func (bcp *BaseChainParser) SeparateAddonsExtensions(supported []string) (addons, extensions []string, err error)
- func (bcp *BaseChainParser) SetPolicy(policy PolicyInf, chainId string, apiInterface string) error
- func (bcp *BaseChainParser) SetPolicyFromAddonAndExtensionMap(policyInformation map[string]struct{})
- func (bcp *BaseChainParser) UpdateBlockTime(newBlockTime time.Duration)
- func (bcp *BaseChainParser) Validate(nodeMessage *baseChainMessageContainer) error
- type BaseChainProxy
- type ChainFetcher
- func (cf *ChainFetcher) ChainFetcherMetadata() []pairingtypes.Metadata
- func (cf *ChainFetcher) FetchBlockHashByNum(ctx context.Context, blockNum int64) (string, error)
- func (cf *ChainFetcher) FetchEndpoint() lavasession.RPCProviderEndpoint
- func (cf *ChainFetcher) FetchLatestBlockNum(ctx context.Context) (int64, error)
- func (cf *ChainFetcher) Validate(ctx context.Context) error
- func (cf *ChainFetcher) Verify(ctx context.Context, verification VerificationContainer, latestBlock uint64) error
- type ChainFetcherIf
- type ChainFetcherOptions
- type ChainListener
- type ChainMessage
- type ChainMessageForSend
- type ChainParser
- type ChainProxy
- func NewGrpcChainProxy(ctx context.Context, nConns uint, ...) (ChainProxy, error)
- func NewJrpcChainProxy(ctx context.Context, nConns uint, ...) (ChainProxy, error)
- func NewRestChainProxy(ctx context.Context, nConns uint, ...) (ChainProxy, error)
- func NewtendermintRpcChainProxy(ctx context.Context, nConns uint, ...) (ChainProxy, error)
- type ChainRouter
- type CollectionKey
- type CraftData
- type DummyChainFetcher
- type ErrorHandler
- type GRPCErrorHandler
- func (geh *GRPCErrorHandler) HandleJSONFormatError(replyData []byte) error
- func (geh *GRPCErrorHandler) HandleNodeError(ctx context.Context, nodeError error) error
- func (geh *GRPCErrorHandler) HandleStatusError(statusCode int, strict bool) error
- func (geh *GRPCErrorHandler) ValidateRequestAndResponseIds(nodeMessageID json.RawMessage, replyMsgID json.RawMessage) error
- type GrpcChainListener
- type GrpcChainParser
- func (apip *GrpcChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, ...)
- func (apip *GrpcChainParser) CraftMessage(parsing *spectypes.ParseDirective, connectionType string, craftData *CraftData, ...) (ChainMessageForSend, error)
- func (apip *GrpcChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
- func (bcp *GrpcChainParser) GetUniqueName() string
- func (apip *GrpcChainParser) ParseMsg(url string, data []byte, connectionType string, ...) (ChainMessage, error)
- func (apip *GrpcChainParser) SetSpec(spec spectypes.Spec)
- type GrpcChainProxy
- type GrpcNodeErrorResponse
- type HealthReporter
- type JrpcChainProxy
- type JsonRPCChainListener
- type JsonRPCChainParser
- func (apip *JsonRPCChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, ...)
- func (apip *JsonRPCChainParser) CraftMessage(parsing *spectypes.ParseDirective, connectionType string, craftData *CraftData, ...) (ChainMessageForSend, error)
- func (apip *JsonRPCChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
- func (apip *JsonRPCChainParser) GetInternalPaths() map[string]struct{}
- func (bcp *JsonRPCChainParser) GetUniqueName() string
- func (apip *JsonRPCChainParser) ParseMsg(url string, data []byte, connectionType string, ...) (ChainMessage, error)
- func (apip *JsonRPCChainParser) SetSpec(spec spectypes.Spec)
- type JsonRPCErrorHandler
- func (geh *JsonRPCErrorHandler) HandleJSONFormatError(replyData []byte) error
- func (jeh *JsonRPCErrorHandler) HandleNodeError(ctx context.Context, nodeError error) error
- func (geh *JsonRPCErrorHandler) HandleStatusError(statusCode int, strict bool) error
- func (geh *JsonRPCErrorHandler) ValidateRequestAndResponseIds(nodeMessageID json.RawMessage, replyMsgID json.RawMessage) error
- type LavaChainFetcher
- func (lcf *LavaChainFetcher) FetchBlockHashByNum(ctx context.Context, blockNum int64) (string, error)
- func (lcf *LavaChainFetcher) FetchChainID(ctx context.Context) (string, string, error)
- func (lcf *LavaChainFetcher) FetchEndpoint() lavasession.RPCProviderEndpoint
- func (lcf *LavaChainFetcher) FetchLatestBlockNum(ctx context.Context) (int64, error)
- type MockChainFetcherIf
- func (m *MockChainFetcherIf) EXPECT() *MockChainFetcherIfMockRecorder
- func (m *MockChainFetcherIf) FetchBlockHashByNum(ctx context.Context, blockNum int64) (string, error)
- func (m *MockChainFetcherIf) FetchEndpoint() lavasession.RPCProviderEndpoint
- func (m *MockChainFetcherIf) FetchLatestBlockNum(ctx context.Context) (int64, error)
- func (m *MockChainFetcherIf) Validate(ctx context.Context) error
- type MockChainFetcherIfMockRecorder
- func (mr *MockChainFetcherIfMockRecorder) FetchBlockHashByNum(ctx, blockNum any) *gomock.Call
- func (mr *MockChainFetcherIfMockRecorder) FetchEndpoint() *gomock.Call
- func (mr *MockChainFetcherIfMockRecorder) FetchLatestBlockNum(ctx any) *gomock.Call
- func (mr *MockChainFetcherIfMockRecorder) Validate(ctx any) *gomock.Call
- type PolicyInf
- type RefererData
- type RelaySender
- type RestChainListener
- type RestChainParser
- func (apip *RestChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, ...)
- func (apip *RestChainParser) CraftMessage(parsing *spectypes.ParseDirective, connectionType string, craftData *CraftData, ...) (ChainMessageForSend, error)
- func (apip *RestChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
- func (bcp *RestChainParser) GetUniqueName() string
- func (apip *RestChainParser) ParseMsg(urlPath string, data []byte, connectionType string, ...) (ChainMessage, error)
- func (apip *RestChainParser) SetSpec(spec spectypes.Spec)
- type RestChainProxy
- type RestErrorHandler
- func (geh *RestErrorHandler) HandleJSONFormatError(replyData []byte) error
- func (rne *RestErrorHandler) HandleNodeError(ctx context.Context, nodeError error) error
- func (geh *RestErrorHandler) HandleStatusError(statusCode int, strict bool) error
- func (geh *RestErrorHandler) ValidateRequestAndResponseIds(nodeMessageID json.RawMessage, replyMsgID json.RawMessage) error
- type TaggedContainer
- type TendermintChainParser
- func (apip *TendermintChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, ...)
- func (apip *TendermintChainParser) CraftMessage(parsing *spectypes.ParseDirective, connectionType string, craftData *CraftData, ...) (ChainMessageForSend, error)
- func (apip *TendermintChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
- func (bcp *TendermintChainParser) GetUniqueName() string
- func (apip *TendermintChainParser) ParseMsg(urlPath string, data []byte, connectionType string, ...) (ChainMessage, error)
- func (apip *TendermintChainParser) SetSpec(spec spectypes.Spec)
- type TendermintRPCErrorHandler
- func (geh *TendermintRPCErrorHandler) HandleJSONFormatError(replyData []byte) error
- func (tendermintErrorHandler *TendermintRPCErrorHandler) HandleNodeError(ctx context.Context, nodeError error) error
- func (geh *TendermintRPCErrorHandler) HandleStatusError(statusCode int, strict bool) error
- func (geh *TendermintRPCErrorHandler) ValidateRequestAndResponseIds(nodeMessageID json.RawMessage, replyMsgID json.RawMessage) error
- type TendermintRpcChainListener
- type TestStruct
- type VerificationContainer
- type VerificationKey
Constants ¶
const ( TendermintStatusQuery = "status" ChainFetcherHeaderName = "X-LAVA-Provider" )
const ( ContextUserValueKeyDappID = "dappID" RetryListeningInterval = 10 // seconds )
const SEP = "&"
Variables ¶
var InvalidResponses = []string{"null", "", "nil", "undefined"}
Functions ¶
func CompareRequestedBlockInBatch ¶
func CompareRequestedBlockInBatch(firstRequestedBlock int64, second int64) (latestCombinedBlock int64, earliestCombinedBlock int64)
split two requested blocks to the most advanced and most behind the hierarchy is as follows: NOT_APPLICABLE LATEST_BLOCK PENDING_BLOCK SAFE FINALIZED numeric value (descending) EARLIEST
func CreateChainLibMocks ¶
func CreateChainLibMocks(ctx context.Context, specIndex string, apiInterface string, serverCallback http.HandlerFunc, getToTopMostPath string, services []string) (cpar ChainParser, crout ChainRouter, cfetc chaintracker.ChainFetcher, closeServer func(), errRet error)
generates a chain parser, a chain fetcher messages based on it apiInterface can either be an ApiInterface string as in spectypes.ApiInterfaceXXX or a number for an index in the apiCollections
func FormatResponseForParsing ¶
func FormatResponseForParsing(reply *pairingtypes.RelayReply, chainMessage ChainMessageForSend) (parsable parser.RPCInput, err error)
func GetAddon ¶
func GetAddon(chainMessage ChainMessage) string
func GetComputeUnits ¶
func GetComputeUnits(chainMessage ChainMessage) uint64
func GetRelayTimeout ¶
func GetRelayTimeout(chainMessage ChainMessage, chainParser ChainParser, timeouts int) time.Duration
func GetStateful ¶
func GetStateful(chainMessage ChainMessage) uint32
func HashCacheRequest ¶
func HashCacheRequest(relayData *pairingtypes.RelayPrivateData, chainId string) ([]byte, func([]byte) []byte, error)
this method will calculate the request hash by changing the original object, and returning the data back to it after calculating the hash couldn't be used in parallel
func IsHangingApi ¶
func IsHangingApi(chainMessage ChainMessage) bool
func IsSubscription ¶
func IsSubscription(chainMessage ChainMessage) bool
func ListenWithRetry ¶
func ListenWithRetry(app *fiber.App, address string)
func ShouldSendToAllProviders ¶
func ShouldSendToAllProviders(chainMessage ChainMessage) bool
func ValidateNilResponse ¶
return if response is valid or not - true
Types ¶
type ApiContainer ¶
type ApiContainer struct {
// contains filtered or unexported fields
}
type BaseChainParser ¶
type BaseChainParser struct {
// contains filtered or unexported fields
}
func (*BaseChainParser) Activate ¶
func (bcp *BaseChainParser) Activate()
func (*BaseChainParser) Active ¶
func (bcp *BaseChainParser) Active() bool
func (*BaseChainParser) BuildMapFromPolicyQuery ¶
func (*BaseChainParser) Construct ¶
func (bcp *BaseChainParser) Construct(spec spectypes.Spec, taggedApis map[spectypes.FUNCTION_TAG]TaggedContainer, serverApis map[ApiKey]ApiContainer, apiCollections map[CollectionKey]*spectypes.ApiCollection, headers map[ApiKey]*spectypes.Header, verifications map[VerificationKey][]VerificationContainer, extensionParser extensionslib.ExtensionParser, )
func (*BaseChainParser) ExtensionParsing ¶
func (bcp *BaseChainParser) ExtensionParsing(addon string, parsedMessageArg *baseChainMessageContainer, extensionInfo extensionslib.ExtensionInfo)
func (*BaseChainParser) ExtensionsParser ¶
func (bcp *BaseChainParser) ExtensionsParser() *extensionslib.ExtensionParser
func (*BaseChainParser) GetParsingByTag ¶
func (bcp *BaseChainParser) GetParsingByTag(tag spectypes.FUNCTION_TAG) (parsing *spectypes.ParseDirective, collectionData *spectypes.CollectionData, existed bool)
func (*BaseChainParser) GetVerifications ¶
func (bcp *BaseChainParser) GetVerifications(supported []string) (retVerifications []VerificationContainer, err error)
gets all verifications for an endpoint supporting multiple addons and extensions
func (*BaseChainParser) HandleHeaders ¶
func (bcp *BaseChainParser) HandleHeaders(metadata []pairingtypes.Metadata, apiCollection *spectypes.ApiCollection, headersDirection spectypes.Header_HeaderType) (filteredHeaders []pairingtypes.Metadata, overwriteRequestedBlock string, ignoredMetadata []pairingtypes.Metadata)
func (*BaseChainParser) SeparateAddonsExtensions ¶
func (bcp *BaseChainParser) SeparateAddonsExtensions(supported []string) (addons, extensions []string, err error)
this function errors if it meets a value that is neither a n addon or an extension
func (*BaseChainParser) SetPolicy ¶
func (bcp *BaseChainParser) SetPolicy(policy PolicyInf, chainId string, apiInterface string) error
policy information contains all configured services (extensions and addons) allowed to be used by the consumer
func (*BaseChainParser) SetPolicyFromAddonAndExtensionMap ¶
func (bcp *BaseChainParser) SetPolicyFromAddonAndExtensionMap(policyInformation map[string]struct{})
func (*BaseChainParser) UpdateBlockTime ¶
func (bcp *BaseChainParser) UpdateBlockTime(newBlockTime time.Duration)
func (*BaseChainParser) Validate ¶
func (bcp *BaseChainParser) Validate(nodeMessage *baseChainMessageContainer) error
type BaseChainProxy ¶
type BaseChainProxy struct { ErrorHandler NodeUrl common.NodeUrl ChainID string // contains filtered or unexported fields }
func (*BaseChainProxy) GetChainProxyInformation ¶
func (bcp *BaseChainProxy) GetChainProxyInformation() (common.NodeUrl, string)
returns the node url and chain id for that proxy.
type ChainFetcher ¶
type ChainFetcher struct {
// contains filtered or unexported fields
}
func NewChainFetcher ¶
func NewChainFetcher(ctx context.Context, options *ChainFetcherOptions) *ChainFetcher
func (*ChainFetcher) ChainFetcherMetadata ¶
func (cf *ChainFetcher) ChainFetcherMetadata() []pairingtypes.Metadata
func (*ChainFetcher) FetchBlockHashByNum ¶
func (*ChainFetcher) FetchEndpoint ¶
func (cf *ChainFetcher) FetchEndpoint() lavasession.RPCProviderEndpoint
func (*ChainFetcher) FetchLatestBlockNum ¶
func (cf *ChainFetcher) FetchLatestBlockNum(ctx context.Context) (int64, error)
func (*ChainFetcher) Verify ¶
func (cf *ChainFetcher) Verify(ctx context.Context, verification VerificationContainer, latestBlock uint64) error
type ChainFetcherIf ¶
type ChainFetcherOptions ¶
type ChainFetcherOptions struct { ChainRouter ChainRouter ChainParser ChainParser Endpoint *lavasession.RPCProviderEndpoint Cache *performance.Cache }
type ChainListener ¶
type ChainListener interface {
Serve(ctx context.Context, cmdFlags common.ConsumerCmdFlags)
}
func NewChainListener ¶
func NewChainListener( ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, healthReporter HealthReporter, rpcConsumerLogs *metrics.RPCConsumerLogs, chainParser ChainParser, refererData *RefererData, ) (ChainListener, error)
type ChainMessage ¶
type ChainMessage interface { RequestedBlock() (latest int64, earliest int64) UpdateLatestBlockInMessage(latestBlock int64, modifyContent bool) (modified bool) AppendHeader(metadata []pairingtypes.Metadata) GetExtensions() []*spectypes.Extension OverrideExtensions(extensionNames []string, extensionParser *extensionslib.ExtensionParser) DisableErrorHandling() TimeoutOverride(...time.Duration) time.Duration GetForceCacheRefresh() bool SetForceCacheRefresh(force bool) bool CheckResponseError(data []byte, httpStatusCode int) (hasError bool, errorMessage string) ChainMessageForSend }
type ChainMessageForSend ¶
type ChainMessageForSend interface { GetApi() *spectypes.Api GetRPCMessage() rpcInterfaceMessages.GenericMessage GetApiCollection() *spectypes.ApiCollection }
func CraftChainMessage ¶
func CraftChainMessage(parsing *spectypes.ParseDirective, connectionType string, chainParser ChainParser, craftData *CraftData, metadata []pairingtypes.Metadata) (ChainMessageForSend, error)
type ChainParser ¶
type ChainParser interface { ParseMsg(url string, data []byte, connectionType string, metadata []pairingtypes.Metadata, extensionInfo extensionslib.ExtensionInfo) (ChainMessage, error) SetSpec(spec spectypes.Spec) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData, blocksInFinalizationProof uint32) GetParsingByTag(tag spectypes.FUNCTION_TAG) (parsing *spectypes.ParseDirective, collectionData *spectypes.CollectionData, existed bool) CraftMessage(parser *spectypes.ParseDirective, connectionType string, craftData *CraftData, metadata []pairingtypes.Metadata) (ChainMessageForSend, error) HandleHeaders(metadata []pairingtypes.Metadata, apiCollection *spectypes.ApiCollection, headersDirection spectypes.Header_HeaderType) (filtered []pairingtypes.Metadata, overwriteReqBlock string, ignoredMetadata []pairingtypes.Metadata) GetVerifications(supported []string) ([]VerificationContainer, error) SeparateAddonsExtensions(supported []string) (addons, extensions []string, err error) SetPolicy(policy PolicyInf, chainId string, apiInterface string) error Active() bool Activate() UpdateBlockTime(newBlockTime time.Duration) GetUniqueName() string ExtensionsParser() *extensionslib.ExtensionParser }
func NewChainParser ¶
func NewChainParser(apiInterface string) (chainParser ChainParser, err error)
type ChainProxy ¶
type ChainProxy interface { GetChainProxyInformation() (common.NodeUrl, string) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error) // has to be thread safe, reuse code within ParseMsg as common functionality }
func NewGrpcChainProxy ¶
func NewGrpcChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint lavasession.RPCProviderEndpoint, parser ChainParser) (ChainProxy, error)
func NewJrpcChainProxy ¶
func NewJrpcChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint lavasession.RPCProviderEndpoint, chainParser ChainParser) (ChainProxy, error)
func NewRestChainProxy ¶
func NewRestChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint lavasession.RPCProviderEndpoint, chainParser ChainParser) (ChainProxy, error)
func NewtendermintRpcChainProxy ¶
func NewtendermintRpcChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint lavasession.RPCProviderEndpoint, chainParser ChainParser) (ChainProxy, error)
type ChainRouter ¶
type ChainRouter interface { SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend, extensions []string) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, proxyUrl common.NodeUrl, chainId string, err error) // has to be thread safe, reuse code within ParseMsg as common functionality ExtensionsSupported([]string) bool }
func GetChainRouter ¶
func GetChainRouter(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint, chainParser ChainParser) (ChainRouter, error)
type CollectionKey ¶
type DummyChainFetcher ¶
type DummyChainFetcher struct {
*ChainFetcher
}
func NewVerificationsOnlyChainFetcher ¶
func NewVerificationsOnlyChainFetcher(ctx context.Context, chainRouter ChainRouter, chainParser ChainParser, endpoint *lavasession.RPCProviderEndpoint) *DummyChainFetcher
func (*DummyChainFetcher) FetchBlockHashByNum ¶
func (cf *DummyChainFetcher) FetchBlockHashByNum(ctx context.Context, blockNum int64) (string, error)
overwrite this too
func (*DummyChainFetcher) FetchLatestBlockNum ¶
func (cf *DummyChainFetcher) FetchLatestBlockNum(ctx context.Context) (int64, error)
overwrite this
type ErrorHandler ¶
type GRPCErrorHandler ¶
type GRPCErrorHandler struct {
// contains filtered or unexported fields
}
func (*GRPCErrorHandler) HandleJSONFormatError ¶
func (*GRPCErrorHandler) HandleNodeError ¶
func (geh *GRPCErrorHandler) HandleNodeError(ctx context.Context, nodeError error) error
func (*GRPCErrorHandler) HandleStatusError ¶
func (*GRPCErrorHandler) ValidateRequestAndResponseIds ¶
func (geh *GRPCErrorHandler) ValidateRequestAndResponseIds(nodeMessageID json.RawMessage, replyMsgID json.RawMessage) error
type GrpcChainListener ¶
type GrpcChainListener struct {
// contains filtered or unexported fields
}
func NewGrpcChainListener ¶
func NewGrpcChainListener( ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, healthReporter HealthReporter, rpcConsumerLogs *metrics.RPCConsumerLogs, chainParser ChainParser, refererData *RefererData, ) (chainListener *GrpcChainListener)
func (*GrpcChainListener) Serve ¶
func (apil *GrpcChainListener) Serve(ctx context.Context, cmdFlags common.ConsumerCmdFlags)
Serve http server for GrpcChainListener
type GrpcChainParser ¶
type GrpcChainParser struct { BaseChainParser // contains filtered or unexported fields }
func NewGrpcChainParser ¶
func NewGrpcChainParser() (chainParser *GrpcChainParser, err error)
NewGrpcChainParser creates a new instance of GrpcChainParser
func (*GrpcChainParser) ChainBlockStats ¶
func (apip *GrpcChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData, blocksInFinalizationProof uint32)
ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData)
func (*GrpcChainParser) CraftMessage ¶
func (apip *GrpcChainParser) CraftMessage(parsing *spectypes.ParseDirective, connectionType string, craftData *CraftData, metadata []pairingtypes.Metadata) (ChainMessageForSend, error)
func (*GrpcChainParser) DataReliabilityParams ¶
func (apip *GrpcChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)
func (*GrpcChainParser) GetUniqueName ¶
func (bcp *GrpcChainParser) GetUniqueName() string
func (*GrpcChainParser) ParseMsg ¶
func (apip *GrpcChainParser) ParseMsg(url string, data []byte, connectionType string, metadata []pairingtypes.Metadata, extensionInfo extensionslib.ExtensionInfo) (ChainMessage, error)
ParseMsg parses message data into chain message object
func (*GrpcChainParser) SetSpec ¶
func (apip *GrpcChainParser) SetSpec(spec spectypes.Spec)
SetSpec sets the spec for the GrpcChainParser
type GrpcChainProxy ¶
type GrpcChainProxy struct { BaseChainProxy // contains filtered or unexported fields }
func (*GrpcChainProxy) SendNodeMsg ¶
func (cp *GrpcChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error)
type GrpcNodeErrorResponse ¶
type HealthReporter ¶
type HealthReporter interface {
IsHealthy() bool
}
type JrpcChainProxy ¶
type JrpcChainProxy struct { BaseChainProxy // contains filtered or unexported fields }
func (*JrpcChainProxy) SendNodeMsg ¶
func (cp *JrpcChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error)
type JsonRPCChainListener ¶
type JsonRPCChainListener struct {
// contains filtered or unexported fields
}
func NewJrpcChainListener ¶
func NewJrpcChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, healthReporter HealthReporter, rpcConsumerLogs *metrics.RPCConsumerLogs, refererData *RefererData, ) (chainListener *JsonRPCChainListener)
NewJrpcChainListener creates a new instance of JsonRPCChainListener
func (*JsonRPCChainListener) Serve ¶
func (apil *JsonRPCChainListener) Serve(ctx context.Context, cmdFlags common.ConsumerCmdFlags)
Serve http server for JsonRPCChainListener
type JsonRPCChainParser ¶
type JsonRPCChainParser struct {
BaseChainParser
}
func NewJrpcChainParser ¶
func NewJrpcChainParser() (chainParser *JsonRPCChainParser, err error)
NewJrpcChainParser creates a new instance of JsonRPCChainParser
func (*JsonRPCChainParser) ChainBlockStats ¶
func (apip *JsonRPCChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData, blocksInFinalizationProof uint32)
ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData)
func (*JsonRPCChainParser) CraftMessage ¶
func (apip *JsonRPCChainParser) CraftMessage(parsing *spectypes.ParseDirective, connectionType string, craftData *CraftData, metadata []pairingtypes.Metadata) (ChainMessageForSend, error)
func (*JsonRPCChainParser) DataReliabilityParams ¶
func (apip *JsonRPCChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)
func (*JsonRPCChainParser) GetInternalPaths ¶
func (apip *JsonRPCChainParser) GetInternalPaths() map[string]struct{}
func (*JsonRPCChainParser) GetUniqueName ¶
func (bcp *JsonRPCChainParser) GetUniqueName() string
func (*JsonRPCChainParser) ParseMsg ¶
func (apip *JsonRPCChainParser) ParseMsg(url string, data []byte, connectionType string, metadata []pairingtypes.Metadata, extensionInfo extensionslib.ExtensionInfo) (ChainMessage, error)
this func parses message data into chain message object
func (*JsonRPCChainParser) SetSpec ¶
func (apip *JsonRPCChainParser) SetSpec(spec spectypes.Spec)
SetSpec sets the spec for the JsonRPCChainParser
type JsonRPCErrorHandler ¶
type JsonRPCErrorHandler struct {
// contains filtered or unexported fields
}
func (*JsonRPCErrorHandler) HandleJSONFormatError ¶
func (*JsonRPCErrorHandler) HandleNodeError ¶
func (jeh *JsonRPCErrorHandler) HandleNodeError(ctx context.Context, nodeError error) error
func (*JsonRPCErrorHandler) HandleStatusError ¶
func (*JsonRPCErrorHandler) ValidateRequestAndResponseIds ¶
func (geh *JsonRPCErrorHandler) ValidateRequestAndResponseIds(nodeMessageID json.RawMessage, replyMsgID json.RawMessage) error
type LavaChainFetcher ¶
type LavaChainFetcher struct {
// contains filtered or unexported fields
}
func NewLavaChainFetcher ¶
func NewLavaChainFetcher(ctx context.Context, clientCtx client.Context) *LavaChainFetcher
func (*LavaChainFetcher) FetchBlockHashByNum ¶
func (*LavaChainFetcher) FetchChainID ¶
func (*LavaChainFetcher) FetchEndpoint ¶
func (lcf *LavaChainFetcher) FetchEndpoint() lavasession.RPCProviderEndpoint
func (*LavaChainFetcher) FetchLatestBlockNum ¶
func (lcf *LavaChainFetcher) FetchLatestBlockNum(ctx context.Context) (int64, error)
type MockChainFetcherIf ¶
type MockChainFetcherIf struct {
// contains filtered or unexported fields
}
MockChainFetcherIf is a mock of ChainFetcherIf interface.
func NewMockChainFetcherIf ¶
func NewMockChainFetcherIf(ctrl *gomock.Controller) *MockChainFetcherIf
NewMockChainFetcherIf creates a new mock instance.
func (*MockChainFetcherIf) EXPECT ¶
func (m *MockChainFetcherIf) EXPECT() *MockChainFetcherIfMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockChainFetcherIf) FetchBlockHashByNum ¶
func (m *MockChainFetcherIf) FetchBlockHashByNum(ctx context.Context, blockNum int64) (string, error)
FetchBlockHashByNum mocks base method.
func (*MockChainFetcherIf) FetchEndpoint ¶
func (m *MockChainFetcherIf) FetchEndpoint() lavasession.RPCProviderEndpoint
FetchEndpoint mocks base method.
func (*MockChainFetcherIf) FetchLatestBlockNum ¶
func (m *MockChainFetcherIf) FetchLatestBlockNum(ctx context.Context) (int64, error)
FetchLatestBlockNum mocks base method.
type MockChainFetcherIfMockRecorder ¶
type MockChainFetcherIfMockRecorder struct {
// contains filtered or unexported fields
}
MockChainFetcherIfMockRecorder is the mock recorder for MockChainFetcherIf.
func (*MockChainFetcherIfMockRecorder) FetchBlockHashByNum ¶
func (mr *MockChainFetcherIfMockRecorder) FetchBlockHashByNum(ctx, blockNum any) *gomock.Call
FetchBlockHashByNum indicates an expected call of FetchBlockHashByNum.
func (*MockChainFetcherIfMockRecorder) FetchEndpoint ¶
func (mr *MockChainFetcherIfMockRecorder) FetchEndpoint() *gomock.Call
FetchEndpoint indicates an expected call of FetchEndpoint.
func (*MockChainFetcherIfMockRecorder) FetchLatestBlockNum ¶
func (mr *MockChainFetcherIfMockRecorder) FetchLatestBlockNum(ctx any) *gomock.Call
FetchLatestBlockNum indicates an expected call of FetchLatestBlockNum.
type PolicyInf ¶
type PolicyInf interface { GetSupportedAddons(specID string) (addons []string, err error) GetSupportedExtensions(specID string) (extensions []epochstorage.EndpointService, err error) }
type RefererData ¶
type RefererData struct { Address string Marker string ReferrerClient *metrics.ConsumerReferrerClient }
func (*RefererData) SendReferer ¶
type RelaySender ¶
type RelaySender interface { SendRelay( ctx context.Context, url string, req string, connectionType string, dappID string, consumerIp string, analytics *metrics.RelayMetrics, metadataValues []pairingtypes.Metadata, ) (*common.RelayResult, error) }
type RestChainListener ¶
type RestChainListener struct {
// contains filtered or unexported fields
}
func NewRestChainListener ¶
func NewRestChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, healthReporter HealthReporter, rpcConsumerLogs *metrics.RPCConsumerLogs, refererData *RefererData, ) (chainListener *RestChainListener)
NewRestChainListener creates a new instance of RestChainListener
func (*RestChainListener) Serve ¶
func (apil *RestChainListener) Serve(ctx context.Context, cmdFlags common.ConsumerCmdFlags)
Serve http server for RestChainListener
type RestChainParser ¶
type RestChainParser struct {
BaseChainParser
}
func NewRestChainParser ¶
func NewRestChainParser() (chainParser *RestChainParser, err error)
NewRestChainParser creates a new instance of RestChainParser
func (*RestChainParser) ChainBlockStats ¶
func (apip *RestChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData, blocksInFinalizationProof uint32)
ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData)
func (*RestChainParser) CraftMessage ¶
func (apip *RestChainParser) CraftMessage(parsing *spectypes.ParseDirective, connectionType string, craftData *CraftData, metadata []pairingtypes.Metadata) (ChainMessageForSend, error)
func (*RestChainParser) DataReliabilityParams ¶
func (apip *RestChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)
func (*RestChainParser) GetUniqueName ¶
func (bcp *RestChainParser) GetUniqueName() string
func (*RestChainParser) ParseMsg ¶
func (apip *RestChainParser) ParseMsg(urlPath string, data []byte, connectionType string, metadata []pairingtypes.Metadata, extensionInfo extensionslib.ExtensionInfo) (ChainMessage, error)
ParseMsg parses message data into chain message object
func (*RestChainParser) SetSpec ¶
func (apip *RestChainParser) SetSpec(spec spectypes.Spec)
SetSpec sets the spec for the TendermintChainParser
type RestChainProxy ¶
type RestChainProxy struct { BaseChainProxy // contains filtered or unexported fields }
func (*RestChainProxy) SendNodeMsg ¶
func (rcp *RestChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error)
type RestErrorHandler ¶
type RestErrorHandler struct {
// contains filtered or unexported fields
}
func (*RestErrorHandler) HandleJSONFormatError ¶
func (*RestErrorHandler) HandleNodeError ¶
func (rne *RestErrorHandler) HandleNodeError(ctx context.Context, nodeError error) error
Validating if the error is related to the provider connection or not returning nil if its not one of the expected connectivity error types
func (*RestErrorHandler) HandleStatusError ¶
func (*RestErrorHandler) ValidateRequestAndResponseIds ¶
func (geh *RestErrorHandler) ValidateRequestAndResponseIds(nodeMessageID json.RawMessage, replyMsgID json.RawMessage) error
type TaggedContainer ¶
type TaggedContainer struct { Parsing *spectypes.ParseDirective ApiCollection *spectypes.ApiCollection }
type TendermintChainParser ¶
type TendermintChainParser struct {
BaseChainParser
}
func NewTendermintRpcChainParser ¶
func NewTendermintRpcChainParser() (chainParser *TendermintChainParser, err error)
NewTendermintRpcChainParser creates a new instance of TendermintChainParser
func (*TendermintChainParser) ChainBlockStats ¶
func (apip *TendermintChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData, blocksInFinalizationProof uint32)
ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData, spec.BlocksInFinalizationProof)
func (*TendermintChainParser) CraftMessage ¶
func (apip *TendermintChainParser) CraftMessage(parsing *spectypes.ParseDirective, connectionType string, craftData *CraftData, metadata []pairingtypes.Metadata) (ChainMessageForSend, error)
func (*TendermintChainParser) DataReliabilityParams ¶
func (apip *TendermintChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)
func (*TendermintChainParser) GetUniqueName ¶
func (bcp *TendermintChainParser) GetUniqueName() string
func (*TendermintChainParser) ParseMsg ¶
func (apip *TendermintChainParser) ParseMsg(urlPath string, data []byte, connectionType string, metadata []pairingtypes.Metadata, extensionInfo extensionslib.ExtensionInfo) (ChainMessage, error)
ParseMsg parses message data into chain message object
func (*TendermintChainParser) SetSpec ¶
func (apip *TendermintChainParser) SetSpec(spec spectypes.Spec)
SetSpec sets the spec for the TendermintChainParser
type TendermintRPCErrorHandler ¶
type TendermintRPCErrorHandler struct {
// contains filtered or unexported fields
}
func (*TendermintRPCErrorHandler) HandleJSONFormatError ¶
func (*TendermintRPCErrorHandler) HandleNodeError ¶
func (tendermintErrorHandler *TendermintRPCErrorHandler) HandleNodeError(ctx context.Context, nodeError error) error
func (*TendermintRPCErrorHandler) HandleStatusError ¶
func (*TendermintRPCErrorHandler) ValidateRequestAndResponseIds ¶
func (geh *TendermintRPCErrorHandler) ValidateRequestAndResponseIds(nodeMessageID json.RawMessage, replyMsgID json.RawMessage) error
type TendermintRpcChainListener ¶
type TendermintRpcChainListener struct {
// contains filtered or unexported fields
}
func NewTendermintRpcChainListener ¶
func NewTendermintRpcChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, healthReporter HealthReporter, rpcConsumerLogs *metrics.RPCConsumerLogs, refererData *RefererData, ) (chainListener *TendermintRpcChainListener)
NewTendermintRpcChainListener creates a new instance of TendermintRpcChainListener
func (*TendermintRpcChainListener) Serve ¶
func (apil *TendermintRpcChainListener) Serve(ctx context.Context, cmdFlags common.ConsumerCmdFlags)
Serve http server for TendermintRpcChainListener
type TestStruct ¶
type TestStruct struct { Ctx context.Context Keepers *keepertest.Keepers Servers *keepertest.Servers Providers []sigs.Account Spec spectypes.Spec Plan plantypes.Plan Consumer sigs.Account Validator sigs.Account }
func SetupForTests ¶
func (*TestStruct) BondDenom ¶
func (ts *TestStruct) BondDenom() string
type VerificationContainer ¶
type VerificationContainer struct { ConnectionType string Name string ParseDirective spectypes.ParseDirective Value string LatestDistance uint64 Severity spectypes.ParseValue_VerificationSeverity VerificationKey }
func (*VerificationContainer) IsActive ¶
func (vc *VerificationContainer) IsActive() bool