chainlib

package
v4.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 75 Imported by: 0

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.

Package chainlib is a generated GoMock package.

Index

Constants

View Source
const (
	TendermintStatusQuery  = "status"
	ChainFetcherHeaderName = "X-LAVA-Provider"
)
View Source
const (
	ContextUserValueKeyDappID = "dappID"
	RetryListeningInterval    = 10 // seconds

	RPCProviderNodeAddressHash = "Lava-Provider-Node-Address-Hash"
	RPCProviderNodeExtension   = "Lava-Provider-Node-Extension"
	RpcProviderLoadRateHeader  = "Lava-Provider-Load-Rate"
	RpcProviderUniqueIdHeader  = "Lava-Provider-Unique-Id"
	WebSocketExtension         = "websocket"
)
View Source
const GRPCStatusCodeOnFailedMessages = 32
View Source
const SEP = "&"
View Source
const SubscriptionTimeoutDuration = 15 * time.Minute

Variables

View Source
var (
	IgnoreSubscriptionNotConfiguredError     = true
	IgnoreSubscriptionNotConfiguredErrorFlag = "ignore-subscription-not-configured-error"
)
View Source
var (
	TrailersToAddToHeaderResponse      = []string{RPCProviderNodeExtension, RpcProviderLoadRateHeader}
	InvalidResponses                   = []string{"null", "", "nil", "undefined"}
	FailedSendingSubscriptionToClients = sdkerrors.New("failed Sending Subscription To Clients", 1015, "Failed Sending Subscription To Clients connection might have been closed by the user")
	NoActiveSubscriptionFound          = sdkerrors.New("failed finding an active subscription on provider side", 1016, "no active subscriptions for hashed params.")
)
View Source
var (
	WebSocketRateLimit   = -1               // rate limit requests per second on websocket connection
	WebSocketBanDuration = time.Duration(0) // once rate limit is reached, will not allow new incoming message for a duration
)

Functions

func CompareRequestedBlockInBatch

func CompareRequestedBlockInBatch(currentLatestRequestedBlock, currentEarliestRequestedBlock, parsedBlock 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,
	httpServerCallback http.HandlerFunc,
	wsServerCallback http.HandlerFunc,
	getToTopMostPath string,
	services []string,
) (cpar ChainParser, crout ChainRouter, cfetc chaintracker.ChainFetcher, closeServer func(), endpointRet *lavasession.RPCProviderEndpoint, 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 ChainMessageForSend) string

func GetComputeUnits

func GetComputeUnits(chainMessage ChainMessageForSend) uint64

func GetListenerWithRetryGrpc

func GetListenerWithRetryGrpc(protocol, addr string) net.Listener

func GetParseDirective

func GetParseDirective(api *types.Api, apiCollection *types.ApiCollection) *types.ParseDirective

func GetRelayTimeout

func GetRelayTimeout(chainMessage ChainMessageForSend, averageBlockTime time.Duration) time.Duration

func GetStateful

func GetStateful(chainMessage ChainMessageForSend) uint32

func GetTimeoutInfo

func GetTimeoutInfo(chainMessage ChainMessageForSend) common.TimeoutInfo

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 IsFunctionTagOfType

func IsFunctionTagOfType(chainMessage ChainMessageForSend, functionTag types.FUNCTION_TAG) bool

func IsHangingApi

func IsHangingApi(chainMessage ChainMessageForSend) bool

func IsUrlWebSocket added in v4.1.1

func IsUrlWebSocket(urlToParse string) (bool, error)

func ListenWithRetry

func ListenWithRetry(app *fiber.App, address string, chosenAddrCh *common.SafeChannelSender[string])

func ShouldSendToAllProviders

func ShouldSendToAllProviders(chainMessage ChainMessage) bool

func TryRecoverNodeErrorFromClientError added in v4.1.1

func TryRecoverNodeErrorFromClientError(nodeErr error) *rpcclient.JsonrpcMessage

func ValidateNilResponse

func ValidateNilResponse(responseString string) error

return if response is valid or not - true

Types

type ApiContainer

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

type ApiKey

type ApiKey struct {
	Name           string
	ConnectionType string
	InternalPath   string
}

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 (bcp *BaseChainParser) BuildMapFromPolicyQuery(policy PolicyInf, chainId string, apiInterface string) (map[string]struct{}, error)

func (*BaseChainParser) Construct

func (bcp *BaseChainParser) Construct(spec spectypes.Spec, internalPaths map[string]struct{}, taggedApis map[spectypes.FUNCTION_TAG]TaggedContainer,
	serverApis map[ApiKey]ApiContainer, apiCollections map[CollectionKey]*spectypes.ApiCollection, headers map[ApiKey]*spectypes.Header,
	verifications map[VerificationKey]map[string][]VerificationContainer,
)

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) GetAllInternalPaths added in v4.1.1

func (bcp *BaseChainParser) GetAllInternalPaths() []string

func (*BaseChainParser) GetParsingByTag

func (bcp *BaseChainParser) GetParsingByTag(tag spectypes.FUNCTION_TAG) (parsing *spectypes.ParseDirective, apiCollection *spectypes.ApiCollection, existed bool)

func (*BaseChainParser) GetVerifications

func (bcp *BaseChainParser) GetVerifications(supported []string, internalPath string, apiInterface 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) IsTagInCollection added in v4.1.1

func (bcp *BaseChainParser) IsTagInCollection(tag spectypes.FUNCTION_TAG, collectionKey CollectionKey) bool

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
	HashedNodeUrl string
	// contains filtered or unexported fields
}

func (*BaseChainProxy) CapTimeoutForSend

func (bcp *BaseChainProxy) CapTimeoutForSend(ctx context.Context, chainMessage ChainMessageForSend) (context.Context, context.CancelFunc)

func (*BaseChainProxy) GetChainProxyInformation

func (bcp *BaseChainProxy) GetChainProxyInformation() (common.NodeUrl, string)

returns the node url and chain id for that proxy.

type BaseProtocolMessage

type BaseProtocolMessage struct {
	ChainMessage
	// contains filtered or unexported fields
}

func (*BaseProtocolMessage) GetBlockedProviders

func (bpm *BaseProtocolMessage) GetBlockedProviders() []string

func (*BaseProtocolMessage) GetDirectiveHeaders

func (bpm *BaseProtocolMessage) GetDirectiveHeaders() map[string]string

func (*BaseProtocolMessage) GetUserData

func (bpm *BaseProtocolMessage) GetUserData() common.UserData

func (*BaseProtocolMessage) HashCacheRequest

func (bpm *BaseProtocolMessage) HashCacheRequest(chainId string) ([]byte, func([]byte) []byte, error)

func (*BaseProtocolMessage) RelayPrivateData

func (bpm *BaseProtocolMessage) RelayPrivateData() *pairingtypes.RelayPrivateData

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 (cf *ChainFetcher) FetchBlockHashByNum(ctx context.Context, blockNum int64) (string, error)

func (*ChainFetcher) FetchEndpoint

func (cf *ChainFetcher) FetchEndpoint() lavasession.RPCProviderEndpoint

func (*ChainFetcher) FetchLatestBlockNum

func (cf *ChainFetcher) FetchLatestBlockNum(ctx context.Context) (int64, error)

func (*ChainFetcher) Validate

func (cf *ChainFetcher) Validate(ctx context.Context) error

func (*ChainFetcher) Verify

func (cf *ChainFetcher) Verify(ctx context.Context, verification VerificationContainer, latestBlock uint64) error

type ChainFetcherIf

type ChainFetcherIf interface {
	FetchLatestBlockNum(ctx context.Context) (int64, error)
	FetchBlockHashByNum(ctx context.Context, blockNum int64) (string, error)
	FetchEndpoint() lavasession.RPCProviderEndpoint
	Validate(ctx context.Context) error
}

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)
	GetListeningAddress() string
}

func NewChainListener

func NewChainListener(
	ctx context.Context,
	listenEndpoint *lavasession.RPCEndpoint,
	relaySender RelaySender,
	healthReporter HealthReporter,
	rpcConsumerLogs *metrics.RPCConsumerLogs,
	chainParser ChainParser,
	refererData *RefererData,
	consumerWsSubscriptionManager *ConsumerWSSubscriptionManager,
) (ChainListener, error)

type ChainMessage

type ChainMessage interface {
	SubscriptionIdExtractor(reply *rpcclient.JsonrpcMessage) string
	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)
	GetRawRequestHash() ([]byte, error)
	GetRequestedBlocksHashes() []string

	ChainMessageForSend
}

type ChainMessageForSend

type ChainMessageForSend interface {
	TimeoutOverride(...time.Duration) time.Duration
	GetApi() *spectypes.Api
	GetRPCMessage() rpcInterfaceMessages.GenericMessage
	GetApiCollection() *spectypes.ApiCollection
	GetParseDirective() *spectypes.ParseDirective
	CheckResponseError(data []byte, httpStatusCode int) (hasError bool, errorMessage string)
}

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, apiCollection *spectypes.ApiCollection, existed bool)
	IsTagInCollection(tag spectypes.FUNCTION_TAG, collectionKey CollectionKey) bool
	GetAllInternalPaths() []string
	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, internalPath string, apiInterface 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 *RelayReplyWrapper, 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 *RelayReplyWrapper, 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 CollectionKey struct {
	ConnectionType string
	InternalPath   string
	Addon          string
}

type ConsumerWSSubscriptionManager

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

func NewConsumerWSSubscriptionManager

func NewConsumerWSSubscriptionManager(
	consumerSessionManager *lavasession.ConsumerSessionManager,
	relaySender RelaySender,
	refererData *RefererData,
	connectionType string,
	chainParser ChainParser,
	activeSubscriptionProvidersStorage *lavasession.ActiveSubscriptionProvidersStorage,
	consumerMetricsManager *metrics.ConsumerMetricsManager,
) *ConsumerWSSubscriptionManager

func (*ConsumerWSSubscriptionManager) CreateWebSocketConnectionUniqueKey

func (cwsm *ConsumerWSSubscriptionManager) CreateWebSocketConnectionUniqueKey(dappID, consumerIp string, webSocketConnectionUniqueId string) string

func (*ConsumerWSSubscriptionManager) StartSubscription

func (cwsm *ConsumerWSSubscriptionManager) StartSubscription(
	webSocketCtx context.Context,
	protocolMessage ProtocolMessage,
	dappID string,
	consumerIp string,
	webSocketConnectionUniqueId string,
	metricsData *metrics.RelayMetrics,
) (firstReply *pairingtypes.RelayReply, repliesChan <-chan *pairingtypes.RelayReply, err error)

func (*ConsumerWSSubscriptionManager) Unsubscribe

func (cwsm *ConsumerWSSubscriptionManager) Unsubscribe(webSocketCtx context.Context, protocolMessage ProtocolMessage, dappID, consumerIp string, webSocketConnectionUniqueId string, metricsData *metrics.RelayMetrics) error

func (*ConsumerWSSubscriptionManager) UnsubscribeAll

func (cwsm *ConsumerWSSubscriptionManager) UnsubscribeAll(webSocketCtx context.Context, dappID, consumerIp string, webSocketConnectionUniqueId string, metricsData *metrics.RelayMetrics) error

type ConsumerWebsocketManager

type ConsumerWebsocketManager struct {
	WebsocketConnectionUID string
	// contains filtered or unexported fields
}

func (*ConsumerWebsocketManager) GetWebSocketConnectionUniqueId

func (cwm *ConsumerWebsocketManager) GetWebSocketConnectionUniqueId(dappId, userIp string) string

func (*ConsumerWebsocketManager) ListenToMessages

func (cwm *ConsumerWebsocketManager) ListenToMessages()

type ConsumerWebsocketManagerOptions

type ConsumerWebsocketManagerOptions struct {
	WebsocketConn                 *websocket.Conn
	RpcConsumerLogs               *metrics.RPCConsumerLogs
	RefererMatchString            string
	CmdFlags                      common.ConsumerCmdFlags
	RelayMsgLogMaxChars           int
	ChainID                       string
	ApiInterface                  string
	ConnectionType                string
	RefererData                   *RefererData
	RelaySender                   RelaySender
	ConsumerWsSubscriptionManager *ConsumerWSSubscriptionManager
	WebsocketConnectionUID        string
}

type CraftData

type CraftData struct {
	Path           string
	Data           []byte
	ConnectionType string
	InternalPath   string
}

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

func (*DummyChainFetcher) Validate

func (cf *DummyChainFetcher) Validate(ctx context.Context) error

type ErrorHandler

type ErrorHandler interface {
	HandleNodeError(context.Context, error) error
	HandleStatusError(int, bool) error
	HandleJSONFormatError([]byte) error
	ValidateRequestAndResponseIds(json.RawMessage, json.RawMessage) error
}

type GRPCErrorHandler

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

func (*GRPCErrorHandler) HandleJSONFormatError

func (geh *GRPCErrorHandler) HandleJSONFormatError(replyData []byte) error

func (*GRPCErrorHandler) HandleNodeError

func (geh *GRPCErrorHandler) HandleNodeError(ctx context.Context, nodeError error) error

func (*GRPCErrorHandler) HandleStatusError

func (geh *GRPCErrorHandler) HandleStatusError(statusCode int, strict bool) error

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) GetListeningAddress

func (apil *GrpcChainListener) GetListeningAddress() string

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 *RelayReplyWrapper, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error)

type GrpcNodeErrorResponse

type GrpcNodeErrorResponse struct {
	ErrorMessage string `json:"error_message"`
	ErrorCode    uint32 `json:"error_code"`
}

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 *RelayReplyWrapper, 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,
	consumerWsSubscriptionManager *ConsumerWSSubscriptionManager,
) (chainListener *JsonRPCChainListener)

NewJrpcChainListener creates a new instance of JsonRPCChainListener

func (*JsonRPCChainListener) GetListeningAddress

func (apil *JsonRPCChainListener) GetListeningAddress() string

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 (geh *JsonRPCErrorHandler) HandleJSONFormatError(replyData []byte) error

func (*JsonRPCErrorHandler) HandleNodeError

func (jeh *JsonRPCErrorHandler) HandleNodeError(ctx context.Context, nodeError error) error

func (*JsonRPCErrorHandler) HandleStatusError

func (geh *JsonRPCErrorHandler) HandleStatusError(statusCode int, strict bool) error

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 (lcf *LavaChainFetcher) FetchBlockHashByNum(ctx context.Context, blockNum int64) (string, error)

func (*LavaChainFetcher) FetchChainID

func (lcf *LavaChainFetcher) FetchChainID(ctx context.Context) (string, string, error)

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

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

FetchEndpoint mocks base method.

func (*MockChainFetcherIf) FetchLatestBlockNum

func (m *MockChainFetcherIf) FetchLatestBlockNum(ctx context.Context) (int64, error)

FetchLatestBlockNum mocks base method.

func (*MockChainFetcherIf) Validate

func (m *MockChainFetcherIf) Validate(ctx context.Context) error

Validate 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.

func (*MockChainFetcherIfMockRecorder) Validate

func (mr *MockChainFetcherIfMockRecorder) Validate(ctx any) *gomock.Call

Validate indicates an expected call of Validate.

type MockChainListener

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

MockChainListener is a mock of ChainListener interface.

func NewMockChainListener

func NewMockChainListener(ctrl *gomock.Controller) *MockChainListener

NewMockChainListener creates a new mock instance.

func (*MockChainListener) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockChainListener) GetListeningAddress

func (m *MockChainListener) GetListeningAddress() string

GetListeningAddress mocks base method.

func (*MockChainListener) Serve

func (m *MockChainListener) Serve(ctx context.Context, cmdFlags common.ConsumerCmdFlags)

Serve mocks base method.

type MockChainListenerMockRecorder

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

MockChainListenerMockRecorder is the mock recorder for MockChainListener.

func (*MockChainListenerMockRecorder) GetListeningAddress

func (mr *MockChainListenerMockRecorder) GetListeningAddress() *gomock.Call

GetListeningAddress indicates an expected call of GetListeningAddress.

func (*MockChainListenerMockRecorder) Serve

func (mr *MockChainListenerMockRecorder) Serve(ctx, cmdFlags interface{}) *gomock.Call

Serve indicates an expected call of Serve.

type MockChainMessage

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

MockChainMessage is a mock of ChainMessage interface.

func NewMockChainMessage

func NewMockChainMessage(ctrl *gomock.Controller) *MockChainMessage

NewMockChainMessage creates a new mock instance.

func (*MockChainMessage) AppendHeader

func (m *MockChainMessage) AppendHeader(metadata []types.Metadata)

AppendHeader mocks base method.

func (*MockChainMessage) CheckResponseError

func (m *MockChainMessage) CheckResponseError(data []byte, httpStatusCode int) (bool, string)

CheckResponseError mocks base method.

func (*MockChainMessage) DisableErrorHandling

func (m *MockChainMessage) DisableErrorHandling()

DisableErrorHandling mocks base method.

func (*MockChainMessage) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockChainMessage) GetApi

func (m *MockChainMessage) GetApi() *types0.Api

GetApi mocks base method.

func (*MockChainMessage) GetApiCollection

func (m *MockChainMessage) GetApiCollection() *types0.ApiCollection

GetApiCollection mocks base method.

func (*MockChainMessage) GetExtensions

func (m *MockChainMessage) GetExtensions() []*types0.Extension

GetExtensions mocks base method.

func (*MockChainMessage) GetForceCacheRefresh

func (m *MockChainMessage) GetForceCacheRefresh() bool

GetForceCacheRefresh mocks base method.

func (*MockChainMessage) GetParseDirective

func (m *MockChainMessage) GetParseDirective() *types0.ParseDirective

GetParseDirective mocks base method.

func (*MockChainMessage) GetRPCMessage

GetRPCMessage mocks base method.

func (*MockChainMessage) GetRawRequestHash

func (m *MockChainMessage) GetRawRequestHash() ([]byte, error)

GetRawRequestHash mocks base method.

func (*MockChainMessage) GetRequestedBlocksHashes added in v4.1.0

func (m *MockChainMessage) GetRequestedBlocksHashes() []string

AppendHeader mocks base method.

func (*MockChainMessage) OverrideExtensions

func (m *MockChainMessage) OverrideExtensions(extensionNames []string, extensionParser *extensionslib.ExtensionParser)

OverrideExtensions mocks base method.

func (*MockChainMessage) RequestedBlock

func (m *MockChainMessage) RequestedBlock() (int64, int64)

RequestedBlock mocks base method.

func (*MockChainMessage) SetForceCacheRefresh

func (m *MockChainMessage) SetForceCacheRefresh(force bool) bool

SetForceCacheRefresh mocks base method.

func (*MockChainMessage) SubscriptionIdExtractor

func (m *MockChainMessage) SubscriptionIdExtractor(reply *rpcclient.JsonrpcMessage) string

SubscriptionIdExtractor mocks base method.

func (*MockChainMessage) TimeoutOverride

func (m *MockChainMessage) TimeoutOverride(arg0 ...time.Duration) time.Duration

TimeoutOverride mocks base method.

func (*MockChainMessage) UpdateLatestBlockInMessage

func (m *MockChainMessage) UpdateLatestBlockInMessage(latestBlock int64, modifyContent bool) bool

UpdateLatestBlockInMessage mocks base method.

type MockChainMessageForSend

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

MockChainMessageForSend is a mock of ChainMessageForSend interface.

func NewMockChainMessageForSend

func NewMockChainMessageForSend(ctrl *gomock.Controller) *MockChainMessageForSend

NewMockChainMessageForSend creates a new mock instance.

func (*MockChainMessageForSend) CheckResponseError

func (m *MockChainMessageForSend) CheckResponseError(data []byte, httpStatusCode int) (bool, string)

CheckResponseError mocks base method.

func (*MockChainMessageForSend) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockChainMessageForSend) GetApi

func (m *MockChainMessageForSend) GetApi() *types0.Api

GetApi mocks base method.

func (*MockChainMessageForSend) GetApiCollection

func (m *MockChainMessageForSend) GetApiCollection() *types0.ApiCollection

GetApiCollection mocks base method.

func (*MockChainMessageForSend) GetParseDirective

func (m *MockChainMessageForSend) GetParseDirective() *types0.ParseDirective

GetParseDirective mocks base method.

func (*MockChainMessageForSend) GetRPCMessage

GetRPCMessage mocks base method.

func (*MockChainMessageForSend) TimeoutOverride

func (m *MockChainMessageForSend) TimeoutOverride(arg0 ...time.Duration) time.Duration

TimeoutOverride mocks base method.

type MockChainMessageForSendMockRecorder

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

MockChainMessageForSendMockRecorder is the mock recorder for MockChainMessageForSend.

func (*MockChainMessageForSendMockRecorder) CheckResponseError

func (mr *MockChainMessageForSendMockRecorder) CheckResponseError(data, httpStatusCode interface{}) *gomock.Call

CheckResponseError indicates an expected call of CheckResponseError.

func (*MockChainMessageForSendMockRecorder) GetApi

GetApi indicates an expected call of GetApi.

func (*MockChainMessageForSendMockRecorder) GetApiCollection

func (mr *MockChainMessageForSendMockRecorder) GetApiCollection() *gomock.Call

GetApiCollection indicates an expected call of GetApiCollection.

func (*MockChainMessageForSendMockRecorder) GetParseDirective

func (mr *MockChainMessageForSendMockRecorder) GetParseDirective() *gomock.Call

GetParseDirective indicates an expected call of GetParseDirective.

func (*MockChainMessageForSendMockRecorder) GetRPCMessage

func (mr *MockChainMessageForSendMockRecorder) GetRPCMessage() *gomock.Call

GetRPCMessage indicates an expected call of GetRPCMessage.

func (*MockChainMessageForSendMockRecorder) TimeoutOverride

func (mr *MockChainMessageForSendMockRecorder) TimeoutOverride(arg0 ...interface{}) *gomock.Call

TimeoutOverride indicates an expected call of TimeoutOverride.

type MockChainMessageMockRecorder

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

MockChainMessageMockRecorder is the mock recorder for MockChainMessage.

func (*MockChainMessageMockRecorder) AppendHeader

func (mr *MockChainMessageMockRecorder) AppendHeader(metadata interface{}) *gomock.Call

AppendHeader indicates an expected call of AppendHeader.

func (*MockChainMessageMockRecorder) CheckResponseError

func (mr *MockChainMessageMockRecorder) CheckResponseError(data, httpStatusCode interface{}) *gomock.Call

CheckResponseError indicates an expected call of CheckResponseError.

func (*MockChainMessageMockRecorder) DisableErrorHandling

func (mr *MockChainMessageMockRecorder) DisableErrorHandling() *gomock.Call

DisableErrorHandling indicates an expected call of DisableErrorHandling.

func (*MockChainMessageMockRecorder) GetApi

GetApi indicates an expected call of GetApi.

func (*MockChainMessageMockRecorder) GetApiCollection

func (mr *MockChainMessageMockRecorder) GetApiCollection() *gomock.Call

GetApiCollection indicates an expected call of GetApiCollection.

func (*MockChainMessageMockRecorder) GetExtensions

func (mr *MockChainMessageMockRecorder) GetExtensions() *gomock.Call

GetExtensions indicates an expected call of GetExtensions.

func (*MockChainMessageMockRecorder) GetForceCacheRefresh

func (mr *MockChainMessageMockRecorder) GetForceCacheRefresh() *gomock.Call

GetForceCacheRefresh indicates an expected call of GetForceCacheRefresh.

func (*MockChainMessageMockRecorder) GetParseDirective

func (mr *MockChainMessageMockRecorder) GetParseDirective() *gomock.Call

GetParseDirective indicates an expected call of GetParseDirective.

func (*MockChainMessageMockRecorder) GetRPCMessage

func (mr *MockChainMessageMockRecorder) GetRPCMessage() *gomock.Call

GetRPCMessage indicates an expected call of GetRPCMessage.

func (*MockChainMessageMockRecorder) GetRawRequestHash

func (mr *MockChainMessageMockRecorder) GetRawRequestHash() *gomock.Call

GetRawRequestHash indicates an expected call of GetRawRequestHash.

func (*MockChainMessageMockRecorder) OverrideExtensions

func (mr *MockChainMessageMockRecorder) OverrideExtensions(extensionNames, extensionParser interface{}) *gomock.Call

OverrideExtensions indicates an expected call of OverrideExtensions.

func (*MockChainMessageMockRecorder) RequestedBlock

func (mr *MockChainMessageMockRecorder) RequestedBlock() *gomock.Call

RequestedBlock indicates an expected call of RequestedBlock.

func (*MockChainMessageMockRecorder) SetForceCacheRefresh

func (mr *MockChainMessageMockRecorder) SetForceCacheRefresh(force interface{}) *gomock.Call

SetForceCacheRefresh indicates an expected call of SetForceCacheRefresh.

func (*MockChainMessageMockRecorder) SubscriptionIdExtractor

func (mr *MockChainMessageMockRecorder) SubscriptionIdExtractor(reply interface{}) *gomock.Call

SubscriptionIdExtractor indicates an expected call of SubscriptionIdExtractor.

func (*MockChainMessageMockRecorder) TimeoutOverride

func (mr *MockChainMessageMockRecorder) TimeoutOverride(arg0 ...interface{}) *gomock.Call

TimeoutOverride indicates an expected call of TimeoutOverride.

func (*MockChainMessageMockRecorder) UpdateLatestBlockInMessage

func (mr *MockChainMessageMockRecorder) UpdateLatestBlockInMessage(latestBlock, modifyContent interface{}) *gomock.Call

UpdateLatestBlockInMessage indicates an expected call of UpdateLatestBlockInMessage.

type MockChainParser

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

MockChainParser is a mock of ChainParser interface.

func NewMockChainParser

func NewMockChainParser(ctrl *gomock.Controller) *MockChainParser

NewMockChainParser creates a new mock instance.

func (*MockChainParser) Activate

func (m *MockChainParser) Activate()

Activate mocks base method.

func (*MockChainParser) Active

func (m *MockChainParser) Active() bool

Active mocks base method.

func (*MockChainParser) ChainBlockStats

func (m *MockChainParser) ChainBlockStats() (int64, time.Duration, uint32, uint32)

ChainBlockStats mocks base method.

func (*MockChainParser) CraftMessage

func (m *MockChainParser) CraftMessage(parser *types0.ParseDirective, connectionType string, craftData *CraftData, metadata []types.Metadata) (ChainMessageForSend, error)

CraftMessage mocks base method.

func (*MockChainParser) DataReliabilityParams

func (m *MockChainParser) DataReliabilityParams() (bool, uint32)

DataReliabilityParams mocks base method.

func (*MockChainParser) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockChainParser) ExtensionsParser

func (m *MockChainParser) ExtensionsParser() *extensionslib.ExtensionParser

ExtensionsParser mocks base method.

func (*MockChainParser) GetParsingByTag

GetParsingByTag mocks base method.

func (*MockChainParser) GetUniqueName

func (m *MockChainParser) GetUniqueName() string

GetUniqueName mocks base method.

func (*MockChainParser) GetVerifications

func (m *MockChainParser) GetVerifications(supported []string) ([]VerificationContainer, error)

GetVerifications mocks base method.

func (*MockChainParser) HandleHeaders

func (m *MockChainParser) HandleHeaders(metadata []types.Metadata, apiCollection *types0.ApiCollection, headersDirection types0.Header_HeaderType) ([]types.Metadata, string, []types.Metadata)

HandleHeaders mocks base method.

func (*MockChainParser) ParseMsg

func (m *MockChainParser) ParseMsg(url string, data []byte, connectionType string, metadata []types.Metadata, extensionInfo extensionslib.ExtensionInfo) (ChainMessage, error)

ParseMsg mocks base method.

func (*MockChainParser) SeparateAddonsExtensions

func (m *MockChainParser) SeparateAddonsExtensions(supported []string) ([]string, []string, error)

SeparateAddonsExtensions mocks base method.

func (*MockChainParser) SetPolicy

func (m *MockChainParser) SetPolicy(policy PolicyInf, chainId, apiInterface string) error

SetPolicy mocks base method.

func (*MockChainParser) SetSpec

func (m *MockChainParser) SetSpec(spec types0.Spec)

SetSpec mocks base method.

func (*MockChainParser) UpdateBlockTime

func (m *MockChainParser) UpdateBlockTime(newBlockTime time.Duration)

UpdateBlockTime mocks base method.

type MockChainParserMockRecorder

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

MockChainParserMockRecorder is the mock recorder for MockChainParser.

func (*MockChainParserMockRecorder) Activate

func (mr *MockChainParserMockRecorder) Activate() *gomock.Call

Activate indicates an expected call of Activate.

func (*MockChainParserMockRecorder) Active

func (mr *MockChainParserMockRecorder) Active() *gomock.Call

Active indicates an expected call of Active.

func (*MockChainParserMockRecorder) ChainBlockStats

func (mr *MockChainParserMockRecorder) ChainBlockStats() *gomock.Call

ChainBlockStats indicates an expected call of ChainBlockStats.

func (*MockChainParserMockRecorder) CraftMessage

func (mr *MockChainParserMockRecorder) CraftMessage(parser, connectionType, craftData, metadata interface{}) *gomock.Call

CraftMessage indicates an expected call of CraftMessage.

func (*MockChainParserMockRecorder) DataReliabilityParams

func (mr *MockChainParserMockRecorder) DataReliabilityParams() *gomock.Call

DataReliabilityParams indicates an expected call of DataReliabilityParams.

func (*MockChainParserMockRecorder) ExtensionsParser

func (mr *MockChainParserMockRecorder) ExtensionsParser() *gomock.Call

ExtensionsParser indicates an expected call of ExtensionsParser.

func (*MockChainParserMockRecorder) GetParsingByTag

func (mr *MockChainParserMockRecorder) GetParsingByTag(tag interface{}) *gomock.Call

GetParsingByTag indicates an expected call of GetParsingByTag.

func (*MockChainParserMockRecorder) GetUniqueName

func (mr *MockChainParserMockRecorder) GetUniqueName() *gomock.Call

GetUniqueName indicates an expected call of GetUniqueName.

func (*MockChainParserMockRecorder) GetVerifications

func (mr *MockChainParserMockRecorder) GetVerifications(supported interface{}) *gomock.Call

GetVerifications indicates an expected call of GetVerifications.

func (*MockChainParserMockRecorder) HandleHeaders

func (mr *MockChainParserMockRecorder) HandleHeaders(metadata, apiCollection, headersDirection interface{}) *gomock.Call

HandleHeaders indicates an expected call of HandleHeaders.

func (*MockChainParserMockRecorder) ParseMsg

func (mr *MockChainParserMockRecorder) ParseMsg(url, data, connectionType, metadata, extensionInfo interface{}) *gomock.Call

ParseMsg indicates an expected call of ParseMsg.

func (*MockChainParserMockRecorder) SeparateAddonsExtensions

func (mr *MockChainParserMockRecorder) SeparateAddonsExtensions(supported interface{}) *gomock.Call

SeparateAddonsExtensions indicates an expected call of SeparateAddonsExtensions.

func (*MockChainParserMockRecorder) SetPolicy

func (mr *MockChainParserMockRecorder) SetPolicy(policy, chainId, apiInterface interface{}) *gomock.Call

SetPolicy indicates an expected call of SetPolicy.

func (*MockChainParserMockRecorder) SetSpec

func (mr *MockChainParserMockRecorder) SetSpec(spec interface{}) *gomock.Call

SetSpec indicates an expected call of SetSpec.

func (*MockChainParserMockRecorder) UpdateBlockTime

func (mr *MockChainParserMockRecorder) UpdateBlockTime(newBlockTime interface{}) *gomock.Call

UpdateBlockTime indicates an expected call of UpdateBlockTime.

type MockChainProxy

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

MockChainProxy is a mock of ChainProxy interface.

func NewMockChainProxy

func NewMockChainProxy(ctrl *gomock.Controller) *MockChainProxy

NewMockChainProxy creates a new mock instance.

func (*MockChainProxy) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockChainProxy) GetChainProxyInformation

func (m *MockChainProxy) GetChainProxyInformation() (common.NodeUrl, string)

GetChainProxyInformation mocks base method.

func (*MockChainProxy) SendNodeMsg

func (m *MockChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend) (*RelayReplyWrapper, string, *rpcclient.ClientSubscription, error)

SendNodeMsg mocks base method.

type MockChainProxyMockRecorder

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

MockChainProxyMockRecorder is the mock recorder for MockChainProxy.

func (*MockChainProxyMockRecorder) GetChainProxyInformation

func (mr *MockChainProxyMockRecorder) GetChainProxyInformation() *gomock.Call

GetChainProxyInformation indicates an expected call of GetChainProxyInformation.

func (*MockChainProxyMockRecorder) SendNodeMsg

func (mr *MockChainProxyMockRecorder) SendNodeMsg(ctx, ch, chainMessage interface{}) *gomock.Call

SendNodeMsg indicates an expected call of SendNodeMsg.

type MockChainRouter

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

MockChainRouter is a mock of ChainRouter interface.

func NewMockChainRouter

func NewMockChainRouter(ctrl *gomock.Controller) *MockChainRouter

NewMockChainRouter creates a new mock instance.

func (*MockChainRouter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockChainRouter) ExtensionsSupported

func (m *MockChainRouter) ExtensionsSupported(arg0 []string) bool

ExtensionsSupported mocks base method.

func (*MockChainRouter) SendNodeMsg

func (m *MockChainRouter) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend, extensions []string) (*RelayReplyWrapper, string, *rpcclient.ClientSubscription, common.NodeUrl, string, error)

SendNodeMsg mocks base method.

type MockChainRouterMockRecorder

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

MockChainRouterMockRecorder is the mock recorder for MockChainRouter.

func (*MockChainRouterMockRecorder) ExtensionsSupported

func (mr *MockChainRouterMockRecorder) ExtensionsSupported(arg0 interface{}) *gomock.Call

ExtensionsSupported indicates an expected call of ExtensionsSupported.

func (*MockChainRouterMockRecorder) SendNodeMsg

func (mr *MockChainRouterMockRecorder) SendNodeMsg(ctx, ch, chainMessage, extensions interface{}) *gomock.Call

SendNodeMsg indicates an expected call of SendNodeMsg.

type MockHealthReporter

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

MockHealthReporter is a mock of HealthReporter interface.

func NewMockHealthReporter

func NewMockHealthReporter(ctrl *gomock.Controller) *MockHealthReporter

NewMockHealthReporter creates a new mock instance.

func (*MockHealthReporter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockHealthReporter) IsHealthy

func (m *MockHealthReporter) IsHealthy() bool

IsHealthy mocks base method.

type MockHealthReporterMockRecorder

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

MockHealthReporterMockRecorder is the mock recorder for MockHealthReporter.

func (*MockHealthReporterMockRecorder) IsHealthy

func (mr *MockHealthReporterMockRecorder) IsHealthy() *gomock.Call

IsHealthy indicates an expected call of IsHealthy.

type MockRelaySender

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

MockRelaySender is a mock of RelaySender interface.

func NewMockRelaySender

func NewMockRelaySender(ctrl *gomock.Controller) *MockRelaySender

NewMockRelaySender creates a new mock instance.

func (*MockRelaySender) CancelSubscriptionContext

func (m *MockRelaySender) CancelSubscriptionContext(subscriptionKey string)

CancelSubscriptionContext mocks base method.

func (*MockRelaySender) CreateDappKey

func (m *MockRelaySender) CreateDappKey(userData common.UserData) string

CreateDappKey mocks base method.

func (*MockRelaySender) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRelaySender) ParseRelay

func (m *MockRelaySender) ParseRelay(ctx context.Context, url, req, connectionType, dappID, consumerIp string, analytics *metrics.RelayMetrics, metadata []types.Metadata) (ProtocolMessage, error)

ParseRelay mocks base method.

func (*MockRelaySender) SendParsedRelay

func (m *MockRelaySender) SendParsedRelay(ctx context.Context, analytics *metrics.RelayMetrics, protocolMessage ProtocolMessage) (*common.RelayResult, error)

SendParsedRelay mocks base method.

func (*MockRelaySender) SendRelay

func (m *MockRelaySender) SendRelay(ctx context.Context, url, req, connectionType, dappID, consumerIp string, analytics *metrics.RelayMetrics, metadataValues []types.Metadata) (*common.RelayResult, error)

SendRelay mocks base method.

func (*MockRelaySender) SetConsistencySeenBlock

func (m *MockRelaySender) SetConsistencySeenBlock(blockSeen int64, key string)

SetConsistencySeenBlock mocks base method.

type MockRelaySenderMockRecorder

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

MockRelaySenderMockRecorder is the mock recorder for MockRelaySender.

func (*MockRelaySenderMockRecorder) CancelSubscriptionContext

func (mr *MockRelaySenderMockRecorder) CancelSubscriptionContext(subscriptionKey interface{}) *gomock.Call

CancelSubscriptionContext indicates an expected call of CancelSubscriptionContext.

func (*MockRelaySenderMockRecorder) CreateDappKey

func (mr *MockRelaySenderMockRecorder) CreateDappKey(userData interface{}) *gomock.Call

CreateDappKey indicates an expected call of CreateDappKey.

func (*MockRelaySenderMockRecorder) ParseRelay

func (mr *MockRelaySenderMockRecorder) ParseRelay(ctx, url, req, connectionType, dappID, consumerIp, analytics, metadata interface{}) *gomock.Call

ParseRelay indicates an expected call of ParseRelay.

func (*MockRelaySenderMockRecorder) SendParsedRelay

func (mr *MockRelaySenderMockRecorder) SendParsedRelay(ctx, analytics, protocolMessage interface{}) *gomock.Call

SendParsedRelay indicates an expected call of SendParsedRelay.

func (*MockRelaySenderMockRecorder) SendRelay

func (mr *MockRelaySenderMockRecorder) SendRelay(ctx, url, req, connectionType, dappID, consumerIp, analytics, metadataValues interface{}) *gomock.Call

SendRelay indicates an expected call of SendRelay.

func (*MockRelaySenderMockRecorder) SetConsistencySeenBlock

func (mr *MockRelaySenderMockRecorder) SetConsistencySeenBlock(blockSeen, key interface{}) *gomock.Call

SetConsistencySeenBlock indicates an expected call of SetConsistencySeenBlock.

type PolicyInf

type PolicyInf interface {
	GetSupportedAddons(specID string) (addons []string, err error)
	GetSupportedExtensions(specID string) (extensions []epochstorage.EndpointService, err error)
}

type ProtocolMessage

type ProtocolMessage interface {
	ChainMessage
	GetDirectiveHeaders() map[string]string
	RelayPrivateData() *pairingtypes.RelayPrivateData
	HashCacheRequest(chainId string) ([]byte, func([]byte) []byte, error)
	GetBlockedProviders() []string
	GetUserData() common.UserData
}

func NewProtocolMessage

func NewProtocolMessage(chainMessage ChainMessage, directiveHeaders map[string]string, relayRequestData *pairingtypes.RelayPrivateData, dappId, consumerIp string) ProtocolMessage

type ProviderNodeSubscriptionManager

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

func NewProviderNodeSubscriptionManager

func NewProviderNodeSubscriptionManager(chainRouter ChainRouter, chainParser ChainParser, relayFinalizationBlocksHandler relayFinalizationBlocksHandler, privKey *btcec.PrivateKey) *ProviderNodeSubscriptionManager

func (*ProviderNodeSubscriptionManager) AddConsumer

func (pnsm *ProviderNodeSubscriptionManager) AddConsumer(ctx context.Context, request *pairingtypes.RelayRequest, chainMessage ChainMessage, consumerAddr sdk.AccAddress, consumerChannel chan<- *pairingtypes.RelayReply, consumerProcessGuid string) (subscriptionId string, err error)

func (*ProviderNodeSubscriptionManager) RemoveConsumer

func (pnsm *ProviderNodeSubscriptionManager) RemoveConsumer(ctx context.Context, chainMessage ChainMessageForSend, consumerAddr sdk.AccAddress, closeConsumerChannel bool, consumerProcessGuid string) error

type RefererData

type RefererData struct {
	Address        string
	Marker         string
	ReferrerClient *metrics.ConsumerReferrerClient
}

func (*RefererData) SendReferer

func (rd *RefererData) SendReferer(refererMatchString string, chainId string, msg string, userIp string, headers map[string][]string, c *websocket.Conn) error

type RelayReplyWrapper

type RelayReplyWrapper struct {
	StatusCode int
	RelayReply *pairingtypes.RelayReply
}

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)
	ParseRelay(
		ctx context.Context,
		url string,
		req string,
		connectionType string,
		dappID string,
		consumerIp string,
		analytics *metrics.RelayMetrics,
		metadata []pairingtypes.Metadata,
	) (ProtocolMessage, error)
	SendParsedRelay(
		ctx context.Context,
		analytics *metrics.RelayMetrics,
		protocolMessage ProtocolMessage,
	) (relayResult *common.RelayResult, errRet error)
	CreateDappKey(userData common.UserData) string
	CancelSubscriptionContext(subscriptionKey string)
	SetConsistencySeenBlock(blockSeen int64, key string)
}

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) GetListeningAddress

func (apil *RestChainListener) GetListeningAddress() string

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 *RelayReplyWrapper, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error)

type RestErrorHandler

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

func (*RestErrorHandler) HandleJSONFormatError

func (geh *RestErrorHandler) HandleJSONFormatError(replyData []byte) error

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 (geh *RestErrorHandler) HandleStatusError(statusCode int, strict bool) error

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 (geh *TendermintRPCErrorHandler) HandleJSONFormatError(replyData []byte) error

func (*TendermintRPCErrorHandler) HandleNodeError

func (tendermintErrorHandler *TendermintRPCErrorHandler) HandleNodeError(ctx context.Context, nodeError error) error

func (*TendermintRPCErrorHandler) HandleStatusError

func (geh *TendermintRPCErrorHandler) HandleStatusError(statusCode int, strict bool) error

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,
	consumerWsSubscriptionManager *ConsumerWSSubscriptionManager,
) (chainListener *TendermintRpcChainListener)

NewTendermintRpcChainListener creates a new instance of TendermintRpcChainListener

func (*TendermintRpcChainListener) GetListeningAddress

func (apil *TendermintRpcChainListener) GetListeningAddress() string

func (*TendermintRpcChainListener) Serve

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 SetupForTests(t *testing.T, numOfProviders int, specID string, getToTopMostPath string) TestStruct

func (*TestStruct) BondDenom

func (ts *TestStruct) BondDenom() string

type UserData

type UserData struct {
	ConsumerIp string
	DappId     string
}

type VerificationContainer

type VerificationContainer struct {
	InternalPath   string
	ConnectionType string
	Name           string
	ParseDirective spectypes.ParseDirective
	Value          string
	LatestDistance uint64
	Severity       spectypes.ParseValue_VerificationSeverity
	VerificationKey
}

func (*VerificationContainer) IsActive

func (vc *VerificationContainer) IsActive() bool

type VerificationKey

type VerificationKey struct {
	Extension string
	Addon     string
}

Directories

Path Synopsis
rpcclient
package rpcclient implements bi-directional JSON-RPC 2.0 on multiple transports.
package rpcclient implements bi-directional JSON-RPC 2.0 on multiple transports.
testproto
Package testproto is a reverse proxy.
Package testproto is a reverse proxy.

Jump to

Keyboard shortcuts

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