chainlib

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 68 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

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 (
	WebSocketRateLimitHeader            = "x-lava-websocket-rate-limit"
	WebSocketOpenConnectionsLimitHeader = "x-lava-websocket-open-connections-limit"
)
View Source
const (
	// MaxSameSlotRetries is the number of times to retry the same slot with a short
	// delay before falling back to previous slots. Handles propagation delays where
	// the slot data hasn't reached the node yet.
	MaxSameSlotRetries = 2
	// MaxPreviousSlotRetries is the number of previous slots to try after same-slot
	// retries are exhausted. Handles skipped slots where Solana produces no block.
	MaxPreviousSlotRetries = 3
	// SameSlotRetryDelay is the wait between same-slot retries.
	SameSlotRetryDelay = 150 * time.Millisecond
)
View Source
const GRPCStatusCodeOnFailedMessages = 32
View Source
const (
	INTERNAL_ADDRESS = "internal-addr"
)
View Source
const (
	SEP = "&"
)

Variables

View Source
var (
	SkipWebsocketVerification = false
	DefaultApiName            = "Default-"
)
View Source
var (
	TrailersToAddToHeaderResponse      = []string{RPCProviderNodeExtension, RpcProviderLoadRateHeader}
	InvalidResponses                   = []string{"null", "", "nil", "undefined"}
	FailedSendingSubscriptionToClients = errors.New("Failed Sending Subscription To Clients connection might have been closed by the user")
	NoActiveSubscriptionFound          = errors.New("no active subscriptions for hashed params.")
	MaxBatchRequestSize                = 0 // configured via --max-batch-request-size flag, 0 means unlimited
	ErrBatchRequestSizeExceeded        = errors.New("batch request size exceeded the configured limit")
)
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
	MaxIdleTimeInSeconds = int64(20 * 60)   // 20 minutes of idle time will disconnect the websocket connection
)
View Source
var IgnoreWsEnforcementForTestCommands = false
View Source
var MaximumNumberOfParallelWebsocketConnectionsPerIp int64 = 0

Functions

func ClassifyNodeError

func ClassifyNodeError(nodeError error, chainFamily common.ChainFamily, transport common.TransportType) *common.LavaError

ClassifyNodeError classifies a node error into a LavaError using the error registry. It extracts error codes and messages from JSON-RPC, gRPC, and HTTP errors, then delegates to common.ClassifyError for two-tier classification.

Parameters:

  • nodeError: the error from the node
  • chainFamily: the chain family for Tier 2 lookups (use -1 if unknown)
  • transport: the transport type for Tier 1 generic matcher partitioning

func ClassifyNodeErrorWithDetails

func ClassifyNodeErrorWithDetails(nodeError error, chainFamily common.ChainFamily, transport common.TransportType) (*common.LavaError, int, string)

ClassifyNodeErrorWithDetails is like ClassifyNodeError but also returns the numeric error code and inner error message extracted from the raw node error. Callers that emit structured logs should prefer this so they don't lose the precise code/message that classification already computed. Returns (nil, 0, "") when nodeError is nil.

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 CreateMockSpec

func CreateMockSpec() spectypes.Spec

CreateMockSpec returns a minimal spectypes.Spec suitable for unit tests.

func ExtractLavaError

func ExtractLavaError(err error) *common.LavaError

ExtractLavaError returns the *LavaError embedded in a LavaWrappedError, or LavaErrorUnknown. Use this when an error has already been classified (e.g., returned from handleAndClassify) and you need to retrieve its classification for structured logging.

func ExtractNodeErrorDetails

func ExtractNodeErrorDetails(nodeError error) (errorCode int, errorMessage string)

ExtractNodeErrorDetails extracts the numeric error code and canonical message from a node error. It handles three error shapes in priority order:

  1. HTTP-wrapped JSON-RPC body — extracts .error.code / .error.message
  2. gRPC status — extracts status code and description
  3. Raw HTTP status code — extracts the HTTP status integer

The priority is strict: each step returns on success so a later step cannot overwrite an earlier extraction. In particular, a JSON-RPC error body inside an rpcclient.HTTPError must NOT be overwritten by the HTTP status code — downstream classification relies on the structured JSON-RPC code.

Falls back to (0, err.Error()) when none of the above apply.

MAG-1666 — HTTP status digits must reach the classifier ------------------------------------------------------- Step 1 returns the JSON-RPC body's code and message, which is correct when the body carries a standard JSON-RPC error code (e.g. -32601 method not found in an HTTP 200 reply). But some upstreams (geth/erigon/nethermind when their own HTTP layer rejects the request, and L7 proxies configured to emit JSON error pages) return HTTP 4xx/5xx with a JSON-RPC error body whose code is meaningless (-1, 0, or a vendor-specific number). For those, the HTTPStatusContains(N) classifier rules in error_classifier.go are the authoritative source of the retry/non-retry verdict — but they only fire when the digits "N" appear in the synthesised errorMessage.

We therefore prefix "HTTP <status>: " when the wrapped error is an rpcclient.HTTPError with a non-2xx status. The body's JSON-RPC code is still returned as errorCode, so Tier-1 CodeEquals matchers (e.g. CodeEquals(-32601)) still win when they're applicable — they're evaluated before HTTPStatusContains. The prefix only changes the outcome for generic/unknown body codes where the HTTPStatusContains predicate is supposed to drive classification but currently sees a message without the digit. See BUGS/JIRA_DRAFT_HTTP_404_CLASSIFIER_BUG.md and BUGS/JIRA_DRAFT_HTTP_413_CLASSIFIER_BUG.md in smart-router-automation.

func FetchBlockHashWithSolanaRetry

func FetchBlockHashWithSolanaRetry(ctx context.Context, blockNum int64, retryDelay time.Duration, fetch blockHashFetchFn) (hash string, fetchedBlock int64, err error)

fetchBlockHashWithSolanaRetry implements the two-phase -32004 retry strategy:

  1. Retry the same slot up to MaxSameSlotRetries times with retryDelay (propagation delays).
  2. Try up to MaxPreviousSlotRetries previous slots without delay (skipped slots).

Returns the hash, the block number that succeeded, and any error. Pass retryDelay=SameSlotRetryDelay in production; use a shorter value in tests.

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 GetHeaderFromCachedMap

func GetHeaderFromCachedMap(headers map[string][]string, key string, defaultValue string) string

GetHeaderFromCachedMap extracts a header value from a cached headers map. Returns the first value if present, or the defaultValue if not found. This avoids repeated calls to fiberCtx.Get() which has overhead.

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 IsBlockNotAvailableError

func IsBlockNotAvailableError(responseData []byte) bool

IsBlockNotAvailableError reports whether a Solana JSON-RPC response classifies as LavaErrorChainBlockNotFound (e.g. -32004 "Block not available for slot X"), via the chain-aware error registry. Callers must gate invocation to Solana-family chains.

func IsFunctionTagOfType

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

func IsHangingApi

func IsHangingApi(chainMessage ChainMessageForSend) bool

func IsSolanaNonRetryableError

func IsSolanaNonRetryableError(nodeError error) bool

IsSolanaNonRetryableError checks if an error indicates a Solana error that should not be retried. Covers -32009 (missing in long-term storage) and -32602 (invalid params). Note: -32007 (ledger jump) IS retryable as another provider may have the data.

func IsSolanaNonRetryableErrorType

func IsSolanaNonRetryableErrorType(err error) bool

IsSolanaNonRetryableErrorType checks if an error wraps a non-retryable LavaError.

func IsUnsupportedMethodError

func IsUnsupportedMethodError(nodeError error) bool

IsUnsupportedMethodError checks if an error indicates an unsupported method. Uses the error registry's SubCategory classification for a unified check across all transports (JSON-RPC, REST, gRPC) and all pattern types (codes, messages).

func IsUnsupportedMethodErrorType

func IsUnsupportedMethodErrorType(err error) bool

IsUnsupportedMethodErrorType checks if an error wraps a LavaError with unsupported method SubCategory.

func IsUrlWebSocket

func IsUrlWebSocket(urlToParse string) (bool, error)

func ListenWithRetry

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

func NewSolanaNonRetryableError

func NewSolanaNonRetryableError(err error) error

NewSolanaNonRetryableError creates an error wrapping a LavaError with non-retryable classification.

func NewUnsupportedMethodError

func NewUnsupportedMethodError(_ error, methodName string) error

NewUnsupportedMethodError creates an error wrapping a LavaError with unsupported method classification. The methodName is included in the context for logging.

func ShouldRetryError

func ShouldRetryError(err error) bool

ShouldRetryError determines if an error should trigger retry attempts. Convenience wrapper that uses default chain family and transport. Prefer ShouldRetryErrorWithContext when chain/transport info is available.

func ShouldRetryErrorWithContext

func ShouldRetryErrorWithContext(err error, chainFamily common.ChainFamily, transport common.TransportType) bool

ShouldRetryErrorWithContext determines if an error should trigger retry attempts, using chain family and transport for accurate Tier 2 classification.

func ShouldSendToAllProviders

func ShouldSendToAllProviders(chainMessage ChainMessage) bool

func TryRecoverNodeErrorFromClientError

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]InternalPath, 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) ExtractDataFromRequest

func (apip *BaseChainParser) ExtractDataFromRequest(request *http.Request) (url string, data string, connectionType string, metadata []pairingtypes.Metadata, err error)

take an http request and direct it through the consumer

func (*BaseChainParser) GetAllInternalPaths

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

func (bcp *BaseChainParser) IsInternalPathEnabled(internalPath string, apiInterface string, addon string) bool

func (*BaseChainParser) IsTagInCollection

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

func (*BaseChainParser) ParseDirectiveEnabled

func (bcp *BaseChainParser) ParseDirectiveEnabled() bool

func (*BaseChainParser) SeparateAddonsExtensions

func (bcp *BaseChainParser) SeparateAddonsExtensions(ctx context.Context, 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) SetResponseFromRelayResult

func (apip *BaseChainParser) SetResponseFromRelayResult(relayResult *common.RelayResult) (*http.Response, error)

func (*BaseChainParser) UpdateBlockTime

func (bcp *BaseChainParser) UpdateBlockTime(newBlockTime time.Duration)

func (*BaseChainParser) ValidateMessage

func (bcp *BaseChainParser) ValidateMessage(chainMsg ChainMessage) error

ValidateMessage validates the chain message against the consumer's policy (allowed addons). Should be called after ParseMsg by consumers/providers that enforce policy. Smart-router does not call this since it uses static providers without on-chain policy.

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

func (bpm *BaseProtocolMessage) GetCrossValidationParameters() (common.CrossValidationParams, bool, error)

GetCrossValidationParameters parses cross-validation headers from the request. Returns (params, headersPresent, error). - headersPresent is true if any cross-validation header was found (used by state machine to set Selection) - error is returned if headers are present but invalid

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

func (bpm *BaseProtocolMessage) IsDefaultApi() bool

func (*BaseProtocolMessage) RelayPrivateData

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

func (*BaseProtocolMessage) UpdateEarliestAndValidateExtensionRules

func (bpm *BaseProtocolMessage) UpdateEarliestAndValidateExtensionRules(extensionParser *extensionslib.ExtensionParser, earliestBlockHashRequested int64, addon string, seenBlock int64) bool

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

func (cf *ChainFetcher) CustomMessage(ctx context.Context, path string, data []byte, connectionType string, apiName string) ([]byte, error)

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

func (cf *ChainFetcher) GetVerificationsStatus() []*pairingtypes.Verification

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 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
	Shutdown(ctx context.Context) error
}

func NewChainListener

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

func NewEmptyChainListener

func NewEmptyChainListener() ChainListener

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
	UpdateEarliestInMessage(incomingEarliest int64) bool
	SetExtension(extension *spectypes.Extension)
	GetUsedDefaultValue() bool
	// IsBatch returns true if this is a batch request (e.g., JSON-RPC batch)
	IsBatch() bool

	ChainMessageForSend
}

func ParseAndValidateMessage

func ParseAndValidateMessage(parser ChainParser, url string, data []byte, connectionType string, metadata []pairingtypes.Metadata, extensionInfo extensionslib.ExtensionInfo) (ChainMessage, error)

ParseAndValidateMessage parses the message and validates it against the consumer's addon policy. Use this in consumer/provider paths. Smart-router should call ParseMsg directly (no policy to enforce).

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)
	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
	IsInternalPathEnabled(internalPath string, apiInterface string, addon string) 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, internalPath string, apiInterface string) ([]VerificationContainer, error)
	SeparateAddonsExtensions(ctx context.Context, supported []string) (addons, extensions []string, err error)
	SetPolicy(policy PolicyInf, chainId string, apiInterface string) error
	ValidateMessage(ChainMessage) error
	Active() bool
	Activate()
	UpdateBlockTime(newBlockTime time.Duration)
	GetUniqueName() string
	ExtensionsParser() *extensionslib.ExtensionParser
	ExtractDataFromRequest(*http.Request) (url string, data string, connectionType string, metadata []pairingtypes.Metadata, err error)
	SetResponseFromRelayResult(*common.RelayResult) (*http.Response, error)
	ParseDirectiveEnabled() bool
}

func CloneChainParserForValidation

func CloneChainParserForValidation(parser ChainParser) ChainParser

CloneChainParserForValidation returns a parser instance safe to pass into GetChainRouter / NewChainProxy for one-shot verification (e.g., the spec re-verification loop) WITHOUT mutating the live serving parser.

For gRPC: NewGrpcChainProxy calls (*GrpcChainParser).setupForProvider, which replaces the parser's registry and codec fields with ones bound to the verification connection's lifetime. If the live parser is passed and the verification context is later cancelled (e.g. a per-attempt WithTimeout), the connection backing those fields dies and live gRPC relays panic on a nil connector. Cloning isolates the mutation.

For non-gRPC parsers no equivalent mutation occurs during chain-proxy construction, so the original parser is returned unchanged.

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(internalPath string, extensions []string) bool
}

func GetChainRouter

func GetChainRouter(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint, chainParser ChainParser) (ChainRouter, error)

func NewTestModeChainRouter

func NewTestModeChainRouter() ChainRouter

type CollectionKey

type CollectionKey struct {
	ConnectionType string
	InternalPath   string
	Addon          string
}

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(ctx context.Context)

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

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 EmptyChainListener

type EmptyChainListener struct{}

func (*EmptyChainListener) GetListeningAddress

func (*EmptyChainListener) GetListeningAddress() string

func (*EmptyChainListener) Serve

func (*EmptyChainListener) Shutdown

func (*EmptyChainListener) Shutdown(_ 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 GRPCReflectionProvider

type GRPCReflectionProvider interface {
	// GetGRPCReflectionConnection returns a gRPC connection for reflection requests.
	// The cleanup function should be called when the connection is no longer needed.
	// Returns nil if reflection is not supported.
	GetGRPCReflectionConnection(ctx context.Context) (conn *grpc.ClientConn, cleanup func(), err error)
}

GRPCReflectionProvider is an optional interface that can be implemented by RelaySender to provide gRPC reflection support. When implemented, the gRPC listener will register a reflection proxy service that enables tools like grpcurl to discover services.

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,
) (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

func (*GrpcChainListener) Shutdown

func (apil *GrpcChainListener) Shutdown(ctx context.Context) error

Shutdown drains in-flight gRPC unary requests and closes the listener. http.Server.Shutdown sends HTTP/2 GOAWAY frames automatically — that is the gRPC "going away" equivalent for streaming clients (the smart router's gRPC API is currently unary-only, so no client streams exist to drain).

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

type IChainFetcher interface {
	FetchLatestBlockNum(ctx context.Context) (int64, error)
	FetchBlockHashByNum(ctx context.Context, blockNum int64) (string, error)
	FetchEndpoint() lavasession.RPCProviderEndpoint
	Validate(ctx context.Context) error
	GetVerificationsStatus() []*pairingtypes.Verification
	CustomMessage(ctx context.Context, path string, data []byte, connectionType string, apiName string) ([]byte, error)
}

type InternalPath

type InternalPath struct {
	Path           string
	Enabled        bool
	ApiInterface   string
	ConnectionType string
	Addon          string
}

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,
	wsSubscriptionManager WSSubscriptionManager,
) (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

func (*JsonRPCChainListener) Shutdown

func (apil *JsonRPCChainListener) Shutdown(ctx context.Context) error

Shutdown stops accepting new connections, drains in-flight HTTP requests, and then waits for active WebSocket goroutines to finish. See drainHTTPThenWS for the full rationale on the ordering of HTTP-then-WS.

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

func (m *MockChainFetcherIf) CustomMessage(ctx context.Context, path string, data []byte, connectionType string, apiName string) ([]byte, error)

FetchBlockHashByNum mocks base method.

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

func (m *MockChainFetcherIf) GetVerificationsStatus() []*pairingtypes.Verification

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

func (mr *MockChainFetcherIfMockRecorder) CustomMessage(ctx, path, data, connectionType, apiName any) *gomock.Call

FetchBlockHashByNum indicates an expected call of FetchBlockHashByNum.

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

func (mr *MockChainFetcherIfMockRecorder) GetVerificationsStatus() *gomock.Call

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.

func (*MockChainListener) Shutdown

func (m *MockChainListener) Shutdown(ctx context.Context) error

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

func (*MockChainListenerMockRecorder) Shutdown

func (mr *MockChainListenerMockRecorder) Shutdown(ctx interface{}) *gomock.Call

Shutdown indicates an expected call of Shutdown.

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 []relay.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() *spec.Api

GetApi mocks base method.

func (*MockChainMessage) GetApiCollection

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

GetApiCollection mocks base method.

func (*MockChainMessage) GetExtensions

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

GetExtensions mocks base method.

func (*MockChainMessage) GetForceCacheRefresh

func (m *MockChainMessage) GetForceCacheRefresh() bool

GetForceCacheRefresh mocks base method.

func (*MockChainMessage) GetParseDirective

func (m *MockChainMessage) GetParseDirective() *spec.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

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

GetRequestedBlocksHashes mocks base method.

func (*MockChainMessage) GetUsedDefaultValue

func (m *MockChainMessage) GetUsedDefaultValue() bool

GetUsedDefaultValue mocks base method.

func (*MockChainMessage) IsBatch

func (m *MockChainMessage) IsBatch() bool

IsBatch 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) SetExtension

func (m *MockChainMessage) SetExtension(extension *spec.Extension)

SetExtension 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) UpdateEarliestInMessage

func (m *MockChainMessage) UpdateEarliestInMessage(incomingEarliest int64) bool

UpdateEarliestInMessage 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() *spec.Api

GetApi mocks base method.

func (*MockChainMessageForSend) GetApiCollection

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

GetApiCollection mocks base method.

func (*MockChainMessageForSend) GetParseDirective

func (m *MockChainMessageForSend) GetParseDirective() *spec.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) GetRequestedBlocksHashes

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

GetRequestedBlocksHashes indicates an expected call of GetRequestedBlocksHashes.

func (*MockChainMessageMockRecorder) GetUsedDefaultValue

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

GetUsedDefaultValue indicates an expected call of GetUsedDefaultValue.

func (*MockChainMessageMockRecorder) IsBatch

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

IsBatch indicates an expected call of IsBatch.

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

func (mr *MockChainMessageMockRecorder) SetExtension(extension interface{}) *gomock.Call

SetExtension indicates an expected call of SetExtension.

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

func (mr *MockChainMessageMockRecorder) UpdateEarliestInMessage(incomingEarliest interface{}) *gomock.Call

UpdateEarliestInMessage indicates an expected call of UpdateEarliestInMessage.

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 *spec.ParseDirective, connectionType string, craftData *CraftData, metadata []relay.Metadata) (ChainMessageForSend, error)

CraftMessage 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) ExtractDataFromRequest

func (m *MockChainParser) ExtractDataFromRequest(arg0 *http.Request) (string, string, string, []relay.Metadata, error)

ExtractDataFromRequest mocks base method.

func (*MockChainParser) GetAllInternalPaths

func (m *MockChainParser) GetAllInternalPaths() []string

GetAllInternalPaths 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, internalPath, apiInterface string) ([]VerificationContainer, error)

GetVerifications mocks base method.

func (*MockChainParser) HandleHeaders

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

HandleHeaders mocks base method.

func (*MockChainParser) IsInternalPathEnabled

func (m *MockChainParser) IsInternalPathEnabled(internalPath, apiInterface, addon string) bool

IsInternalPathEnabled mocks base method.

func (*MockChainParser) IsTagInCollection

func (m *MockChainParser) IsTagInCollection(tag spec.FUNCTION_TAG, collectionKey CollectionKey) bool

IsTagInCollection mocks base method.

func (*MockChainParser) ParseDirectiveEnabled

func (m *MockChainParser) ParseDirectiveEnabled() bool

ParseDirectiveEnabled mocks base method.

func (*MockChainParser) ParseMsg

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

ParseMsg mocks base method.

func (*MockChainParser) SeparateAddonsExtensions

func (m *MockChainParser) SeparateAddonsExtensions(ctx context.Context, 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) SetResponseFromRelayResult

func (m *MockChainParser) SetResponseFromRelayResult(arg0 *common.RelayResult) (*http.Response, error)

SetResponseFromRelayResult mocks base method.

func (*MockChainParser) SetSpec

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

SetSpec mocks base method.

func (*MockChainParser) UpdateBlockTime

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

UpdateBlockTime mocks base method.

func (*MockChainParser) ValidateMessage

func (m *MockChainParser) ValidateMessage(arg0 ChainMessage) error

ValidateMessage 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) ExtensionsParser

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

ExtensionsParser indicates an expected call of ExtensionsParser.

func (*MockChainParserMockRecorder) ExtractDataFromRequest

func (mr *MockChainParserMockRecorder) ExtractDataFromRequest(arg0 interface{}) *gomock.Call

ExtractDataFromRequest indicates an expected call of ExtractDataFromRequest.

func (*MockChainParserMockRecorder) GetAllInternalPaths

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

GetAllInternalPaths indicates an expected call of GetAllInternalPaths.

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, internalPath, apiInterface 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) IsInternalPathEnabled

func (mr *MockChainParserMockRecorder) IsInternalPathEnabled(internalPath, apiInterface, addon interface{}) *gomock.Call

IsInternalPathEnabled indicates an expected call of IsInternalPathEnabled.

func (*MockChainParserMockRecorder) IsTagInCollection

func (mr *MockChainParserMockRecorder) IsTagInCollection(tag, collectionKey interface{}) *gomock.Call

IsTagInCollection indicates an expected call of IsTagInCollection.

func (*MockChainParserMockRecorder) ParseDirectiveEnabled

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

ParseDirectiveEnabled indicates an expected call of ParseDirectiveEnabled.

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(ctx, 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) SetResponseFromRelayResult

func (mr *MockChainParserMockRecorder) SetResponseFromRelayResult(arg0 interface{}) *gomock.Call

SetResponseFromRelayResult indicates an expected call of SetResponseFromRelayResult.

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.

func (*MockChainParserMockRecorder) ValidateMessage

func (mr *MockChainParserMockRecorder) ValidateMessage(arg0 interface{}) *gomock.Call

ValidateMessage indicates an expected call of ValidateMessage.

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(internalPath string, extensions []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(internalPath, extensions 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 MockGRPCReflectionProvider

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

MockGRPCReflectionProvider is a mock of GRPCReflectionProvider interface.

func NewMockGRPCReflectionProvider

func NewMockGRPCReflectionProvider(ctrl *gomock.Controller) *MockGRPCReflectionProvider

NewMockGRPCReflectionProvider creates a new mock instance.

func (*MockGRPCReflectionProvider) EXPECT

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

func (*MockGRPCReflectionProvider) GetGRPCReflectionConnection

func (m *MockGRPCReflectionProvider) GetGRPCReflectionConnection(ctx context.Context) (*grpc.ClientConn, func(), error)

GetGRPCReflectionConnection mocks base method.

type MockGRPCReflectionProviderMockRecorder

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

MockGRPCReflectionProviderMockRecorder is the mock recorder for MockGRPCReflectionProvider.

func (*MockGRPCReflectionProviderMockRecorder) GetGRPCReflectionConnection

func (mr *MockGRPCReflectionProviderMockRecorder) GetGRPCReflectionConnection(ctx interface{}) *gomock.Call

GetGRPCReflectionConnection indicates an expected call of GetGRPCReflectionConnection.

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, metadata []relay.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 []relay.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, 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 MockWebsocketConnection

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

MockWebsocketConnection is a mock of WebsocketConnection interface.

func NewMockWebsocketConnection

func NewMockWebsocketConnection(ctrl *gomock.Controller) *MockWebsocketConnection

NewMockWebsocketConnection creates a new mock instance.

func (*MockWebsocketConnection) EXPECT

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

func (*MockWebsocketConnection) Locals

func (m *MockWebsocketConnection) Locals(key string) interface{}

Locals mocks base method.

func (*MockWebsocketConnection) RemoteAddr

func (m *MockWebsocketConnection) RemoteAddr() net.Addr

RemoteAddr mocks base method.

func (*MockWebsocketConnection) WriteMessage

func (m *MockWebsocketConnection) WriteMessage(messageType int, data []byte) error

WriteMessage mocks base method.

type MockWebsocketConnectionMockRecorder

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

MockWebsocketConnectionMockRecorder is the mock recorder for MockWebsocketConnection.

func (*MockWebsocketConnectionMockRecorder) Locals

func (mr *MockWebsocketConnectionMockRecorder) Locals(key interface{}) *gomock.Call

Locals indicates an expected call of Locals.

func (*MockWebsocketConnectionMockRecorder) RemoteAddr

RemoteAddr indicates an expected call of RemoteAddr.

func (*MockWebsocketConnectionMockRecorder) WriteMessage

func (mr *MockWebsocketConnectionMockRecorder) WriteMessage(messageType, data interface{}) *gomock.Call

WriteMessage indicates an expected call of WriteMessage.

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
	IsDefaultApi() bool
	UpdateEarliestAndValidateExtensionRules(extensionParser *extensionslib.ExtensionParser, earliestBlockHashRequested int64, addon string, seenBlock int64) bool
	// GetCrossValidationParameters returns (params, headersPresent, error)
	// headersPresent indicates if cross-validation headers were found (used to set Selection type)
	GetCrossValidationParameters() (common.CrossValidationParams, bool, error)
}

func NewProtocolMessage

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

type RefererData

type RefererData struct{}

RefererData is a no-op stub. Referer functionality was removed in #2137; this type is kept only to satisfy compile-time references that have not yet been cleaned up on this branch.

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,
		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,
) (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

func (*RestChainListener) Shutdown

func (apil *RestChainListener) Shutdown(ctx context.Context) error

Shutdown drains in-flight HTTP requests and closes the listener. REST has no client-facing WebSockets, so no 1001 close frames are needed.

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

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

func (apip *TendermintChainParser) ExtractDataFromRequest(request *http.Request) (url string, data string, connectionType string, metadata []pairingtypes.Metadata, err error)

overwritten because tendermintrpc doesnt use POST but an empty connecionType

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,
	wsSubscriptionManager WSSubscriptionManager,
) (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

func (*TendermintRpcChainListener) Shutdown

func (apil *TendermintRpcChainListener) Shutdown(ctx context.Context) error

Shutdown stops accepting new connections, drains in-flight HTTP requests, and then waits for active WebSocket goroutines to finish. See drainHTTPThenWS for the full rationale on the ordering of HTTP-then-WS.

type TestModeChainRouter

type TestModeChainRouter struct{}

TestModeChainRouter is a minimal ChainRouter implementation for provider test-mode. In test-mode, providers are expected to serve relays from predefined responses and should not dial external nodes. Any routing attempt is treated as an error.

func (*TestModeChainRouter) ExtensionsSupported

func (*TestModeChainRouter) ExtensionsSupported(internalPath string, extensions []string) bool

func (*TestModeChainRouter) SendNodeMsg

func (*TestModeChainRouter) 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)

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
}

type WSSubscriptionManager

type WSSubscriptionManager interface {
	// StartSubscription starts a new WebSocket subscription or joins an existing one.
	// If a subscription with the same parameters already exists, the client joins it
	// (subscription deduplication).
	//
	// Returns:
	//   - firstReply: The initial subscription confirmation reply
	//   - repliesChan: Channel for receiving subscription messages (nil if joining existing)
	//   - error: Any error that occurred
	StartSubscription(
		ctx context.Context,
		protocolMessage ProtocolMessage,
		dappID string,
		consumerIp string,
		webSocketConnectionUniqueId string,
		metricsData *metrics.RelayMetrics,
	) (firstReply *pairingtypes.RelayReply, repliesChan <-chan *pairingtypes.RelayReply, err error)

	// Unsubscribe handles an explicit unsubscribe request from a client.
	// The subscription ID is extracted from the protocolMessage.
	// Returns the node's response bytes when available (e.g. DirectWS streams actual node response);
	// returns nil when the implementation does not provide a response (e.g. provider relay path).
	Unsubscribe(
		ctx context.Context,
		protocolMessage ProtocolMessage,
		dappID string,
		consumerIp string,
		webSocketConnectionUniqueId string,
		metricsData *metrics.RelayMetrics,
	) (response []byte, err error)

	// UnsubscribeAll removes all subscriptions for a specific client connection.
	// Called when a WebSocket connection is closed.
	UnsubscribeAll(
		ctx context.Context,
		dappID string,
		consumerIp string,
		webSocketConnectionUniqueId string,
		metricsData *metrics.RelayMetrics,
	) error
}

WSSubscriptionManager defines the interface for WebSocket subscription management. This interface is implemented by both:

  • ConsumerWSSubscriptionManager: routes subscriptions through Lava providers
  • DirectWSSubscriptionManager: connects directly to RPC endpoints (for smart router)

The interface enables the chain listener to work with either implementation, supporting both provider-based and direct RPC subscription models.

type WebsocketConnection

type WebsocketConnection interface {
	// Add only the methods you need to mock
	RemoteAddr() net.Addr
	Locals(key string) interface{}
	WriteMessage(messageType int, data []byte) error
}

WebsocketConnection defines the interface for websocket connections

type WebsocketConnectionLimiter

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

Will limit a certain amount of connections per IP

func (*WebsocketConnectionLimiter) CanOpenConnection

func (wcl *WebsocketConnectionLimiter) CanOpenConnection(websocketConn WebsocketConnection) (bool, func())

func (*WebsocketConnectionLimiter) HandleFiberRateLimitFlags

func (wcl *WebsocketConnectionLimiter) HandleFiberRateLimitFlags(c *fiber.Ctx)

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.

Jump to

Keyboard shortcuts

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