Documentation ¶
Overview ¶
Package rpcconsumer is a generated GoMock package.
Package rpcconsumer is a generated GoMock package.
Index ¶
- Constants
- Variables
- func CreateRPCConsumerCobraCommand() *cobra.Command
- func CreateTestRPCConsumerCobraCommand() *cobra.Command
- func ParseEndpoints(viper_endpoints *viper.Viper, geolocation uint64) (endpoints []*lavasession.RPCEndpoint, err error)
- type AnalyticsServerAddressess
- type CancelableContextHolder
- type ConsumerConsistency
- func (cc *ConsumerConsistency) GetSeenBlock(dappId string, ip string) (int64, bool)
- func (cc *ConsumerConsistency) Key(dappId string, ip string) string
- func (cc *ConsumerConsistency) SetSeenBlock(blockSeen int64, dappId string, ip string)
- func (cc *ConsumerConsistency) SetSeenBlockFromKey(blockSeen int64, key string)
- type ConsumerStateTrackerInf
- type ConsumerTxSender
- type MetricsInterface
- type MockConsumerStateTrackerInf
- func (m *MockConsumerStateTrackerInf) EXPECT() *MockConsumerStateTrackerInfMockRecorder
- func (m *MockConsumerStateTrackerInf) GetConsumerPolicy(ctx context.Context, consumerAddress, chainID string) (*types0.Policy, error)
- func (m *MockConsumerStateTrackerInf) GetLatestVirtualEpoch() uint64
- func (m *MockConsumerStateTrackerInf) GetProtocolVersion(ctx context.Context) (*updaters.ProtocolVersionResponse, error)
- func (m *MockConsumerStateTrackerInf) RegisterConsumerSessionManagerForPairingUpdates(ctx context.Context, ...)
- func (m *MockConsumerStateTrackerInf) RegisterFinalizationConsensusForUpdates(arg0 context.Context, arg1 *finalizationconsensus.FinalizationConsensus)
- func (m *MockConsumerStateTrackerInf) RegisterForDowntimeParamsUpdates(ctx context.Context, downtimeParamsUpdatable updaters.DowntimeParamsUpdatable) error
- func (m *MockConsumerStateTrackerInf) RegisterForSpecUpdates(ctx context.Context, specUpdatable updaters.SpecUpdatable, ...) error
- func (m *MockConsumerStateTrackerInf) RegisterForVersionUpdates(ctx context.Context, version *types1.Version, ...)
- func (m *MockConsumerStateTrackerInf) TxConflictDetection(ctx context.Context, finalizationConflict *types.FinalizationConflict, ...) error
- type MockConsumerStateTrackerInfMockRecorder
- func (mr *MockConsumerStateTrackerInfMockRecorder) GetConsumerPolicy(ctx, consumerAddress, chainID any) *gomock.Call
- func (mr *MockConsumerStateTrackerInfMockRecorder) GetLatestVirtualEpoch() *gomock.Call
- func (mr *MockConsumerStateTrackerInfMockRecorder) GetProtocolVersion(ctx any) *gomock.Call
- func (mr *MockConsumerStateTrackerInfMockRecorder) RegisterConsumerSessionManagerForPairingUpdates(ctx, consumerSessionManager any) *gomock.Call
- func (mr *MockConsumerStateTrackerInfMockRecorder) RegisterFinalizationConsensusForUpdates(arg0, arg1 any) *gomock.Call
- func (mr *MockConsumerStateTrackerInfMockRecorder) RegisterForDowntimeParamsUpdates(ctx, downtimeParamsUpdatable any) *gomock.Call
- func (mr *MockConsumerStateTrackerInfMockRecorder) RegisterForSpecUpdates(ctx, specUpdatable, endpoint any) *gomock.Call
- func (mr *MockConsumerStateTrackerInfMockRecorder) RegisterForVersionUpdates(ctx, version, versionValidator any) *gomock.Call
- func (mr *MockConsumerStateTrackerInfMockRecorder) TxConflictDetection(ctx, finalizationConflict, responseConflict, conflictHandler any) *gomock.Call
- type MockRelayerClient
- func (m *MockRelayerClient) EXPECT() *MockRelayerClientMockRecorder
- func (m *MockRelayerClient) Probe(ctx context.Context, in *types.ProbeRequest, opts ...grpc.CallOption) (*types.ProbeReply, error)
- func (m *MockRelayerClient) Relay(ctx context.Context, in *types.RelayRequest, opts ...grpc.CallOption) (*types.RelayReply, error)
- func (m *MockRelayerClient) RelaySubscribe(ctx context.Context, in *types.RelayRequest, opts ...grpc.CallOption) (types.Relayer_RelaySubscribeClient, error)
- type MockRelayerClientMockRecorder
- type MockRelayerServer
- func (m *MockRelayerServer) EXPECT() *MockRelayerServerMockRecorder
- func (m *MockRelayerServer) Probe(arg0 context.Context, arg1 *types.ProbeRequest) (*types.ProbeReply, error)
- func (m *MockRelayerServer) Relay(arg0 context.Context, arg1 *types.RelayRequest) (*types.RelayReply, error)
- func (m *MockRelayerServer) RelaySubscribe(arg0 *types.RelayRequest, arg1 types.Relayer_RelaySubscribeServer) error
- type MockRelayerServerMockRecorder
- type MockRelayer_RelaySubscribeClient
- func (m *MockRelayer_RelaySubscribeClient) CloseSend() error
- func (m *MockRelayer_RelaySubscribeClient) Context() context.Context
- func (m *MockRelayer_RelaySubscribeClient) EXPECT() *MockRelayer_RelaySubscribeClientMockRecorder
- func (m *MockRelayer_RelaySubscribeClient) Header() (metadata.MD, error)
- func (m *MockRelayer_RelaySubscribeClient) Recv() (*types.RelayReply, error)
- func (m_2 *MockRelayer_RelaySubscribeClient) RecvMsg(m any) error
- func (m_2 *MockRelayer_RelaySubscribeClient) SendMsg(m any) error
- func (m *MockRelayer_RelaySubscribeClient) Trailer() metadata.MD
- type MockRelayer_RelaySubscribeClientMockRecorder
- func (mr *MockRelayer_RelaySubscribeClientMockRecorder) CloseSend() *gomock.Call
- func (mr *MockRelayer_RelaySubscribeClientMockRecorder) Context() *gomock.Call
- func (mr *MockRelayer_RelaySubscribeClientMockRecorder) Header() *gomock.Call
- func (mr *MockRelayer_RelaySubscribeClientMockRecorder) Recv() *gomock.Call
- func (mr *MockRelayer_RelaySubscribeClientMockRecorder) RecvMsg(m any) *gomock.Call
- func (mr *MockRelayer_RelaySubscribeClientMockRecorder) SendMsg(m any) *gomock.Call
- func (mr *MockRelayer_RelaySubscribeClientMockRecorder) Trailer() *gomock.Call
- type MockRelayer_RelaySubscribeServer
- func (m *MockRelayer_RelaySubscribeServer) Context() context.Context
- func (m *MockRelayer_RelaySubscribeServer) EXPECT() *MockRelayer_RelaySubscribeServerMockRecorder
- func (m_2 *MockRelayer_RelaySubscribeServer) RecvMsg(m any) error
- func (m *MockRelayer_RelaySubscribeServer) Send(arg0 *types.RelayReply) error
- func (m *MockRelayer_RelaySubscribeServer) SendHeader(arg0 metadata.MD) error
- func (m_2 *MockRelayer_RelaySubscribeServer) SendMsg(m any) error
- func (m *MockRelayer_RelaySubscribeServer) SetHeader(arg0 metadata.MD) error
- func (m *MockRelayer_RelaySubscribeServer) SetTrailer(arg0 metadata.MD)
- type MockRelayer_RelaySubscribeServerMockRecorder
- func (mr *MockRelayer_RelaySubscribeServerMockRecorder) Context() *gomock.Call
- func (mr *MockRelayer_RelaySubscribeServerMockRecorder) RecvMsg(m any) *gomock.Call
- func (mr *MockRelayer_RelaySubscribeServerMockRecorder) Send(arg0 any) *gomock.Call
- func (mr *MockRelayer_RelaySubscribeServerMockRecorder) SendHeader(arg0 any) *gomock.Call
- func (mr *MockRelayer_RelaySubscribeServerMockRecorder) SendMsg(m any) *gomock.Call
- func (mr *MockRelayer_RelaySubscribeServerMockRecorder) SetHeader(arg0 any) *gomock.Call
- func (mr *MockRelayer_RelaySubscribeServerMockRecorder) SetTrailer(arg0 any) *gomock.Call
- type RPCConsumer
- type RPCConsumerServer
- func (rpccs *RPCConsumerServer) CancelSubscriptionContext(subscriptionKey string)
- func (rpccs *RPCConsumerServer) CreateDappKey(dappID, consumerIp string) string
- func (rpccs *RPCConsumerServer) GetChainIdAndApiInterface() (string, string)
- func (rpccs *RPCConsumerServer) GetListeningAddress() string
- func (rpccs *RPCConsumerServer) HandleDirectiveHeadersForMessage(chainMessage chainlib.ChainMessage, directiveHeaders map[string]string)
- func (rpccs *RPCConsumerServer) IsHealthy() bool
- func (rpccs *RPCConsumerServer) LavaDirectiveHeaders(metadata []pairingtypes.Metadata) ([]pairingtypes.Metadata, map[string]string)
- func (rpccs *RPCConsumerServer) ParseRelay(ctx context.Context, url string, req string, connectionType string, ...) (protocolMessage chainlib.ProtocolMessage, err error)
- func (rpccs *RPCConsumerServer) ProcessRelaySend(ctx context.Context, protocolMessage chainlib.ProtocolMessage, dappID string, ...) (*RelayProcessor, error)
- func (rpccs *RPCConsumerServer) SendParsedRelay(ctx context.Context, dappID string, consumerIp string, ...) (relayResult *common.RelayResult, errRet error)
- func (rpccs *RPCConsumerServer) SendRelay(ctx context.Context, url string, req string, connectionType string, ...) (relayResult *common.RelayResult, errRet error)
- func (rpccs *RPCConsumerServer) ServeRPCRequests(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, ...) (err error)
- func (rpccs *RPCConsumerServer) SetConsistencySeenBlock(blockSeen int64, key string)
- type RelayError
- type RelayErrors
- type RelayProcessor
- func (rp *RelayProcessor) GetAllowSessionDegradation() bool
- func (rp *RelayProcessor) GetUsedProviders() *lavasession.UsedProviders
- func (rp *RelayProcessor) HasRequiredNodeResults() bool
- func (rp *RelayProcessor) HasResults() bool
- func (rp *RelayProcessor) NodeResults() []common.RelayResult
- func (rp *RelayProcessor) ProcessingResult() (returnedResult *common.RelayResult, processingError error)
- func (rp *RelayProcessor) ProtocolErrors() uint64
- func (rp *RelayProcessor) SetDisallowDegradation()
- func (rp *RelayProcessor) SetResponse(response *relayResponse)
- func (rp *RelayProcessor) ShouldRetry(numberOfRetriesLaunched int) bool
- func (rp *RelayProcessor) String() string
- func (rp *RelayProcessor) WaitForResults(ctx context.Context) error
- type RelayRetriesManager
- type Selection
Constants ¶
const ( CacheMaxCost = 2000 // each item cost would be 1 CacheNumCounters = 20000 // expect 2000 items EntryTTL = 5 * time.Minute )
this class handles seen block values in requests
const ( MaxCallsPerRelay = 50 NumberOfRetriesAllowedOnNodeErrors = 2 // we will try maximum additional 2 relays on node errors )
const ( DefaultRPCConsumerFileName = "rpcconsumer.yml" DebugRelaysFlagName = "debug-relays" DebugProbesFlagName = "debug-probes" )
const ( // maximum number of retries to send due to the ticker, if we didn't get a response after 10 different attempts then just wait. MaximumNumberOfTickerRelayRetries = 10 MaxRelayRetries = 6 SendRelayAttempts = 3 )
const RetryEntryTTL = 6 * time.Hour
entries ttl duration
Variables ¶
var ( Yaml_config_properties = []string{"network-address", "chain-id", "api-interface"} RelaysHealthEnableFlagDefault = true RelayHealthIntervalFlagDefault = 5 * time.Minute )
var NoResponseTimeout = sdkerrors.New("NoResponseTimeout Error", 685, "timeout occurred while waiting for providers responses")
Functions ¶
func ParseEndpoints ¶
func ParseEndpoints(viper_endpoints *viper.Viper, geolocation uint64) (endpoints []*lavasession.RPCEndpoint, err error)
Types ¶
type CancelableContextHolder ¶ added in v2.4.0
type CancelableContextHolder struct { Ctx context.Context CancelFunc context.CancelFunc }
type ConsumerConsistency ¶
type ConsumerConsistency struct {
// contains filtered or unexported fields
}
func NewConsumerConsistency ¶
func NewConsumerConsistency(specId string) *ConsumerConsistency
func (*ConsumerConsistency) GetSeenBlock ¶
func (cc *ConsumerConsistency) GetSeenBlock(dappId string, ip string) (int64, bool)
func (*ConsumerConsistency) Key ¶
func (cc *ConsumerConsistency) Key(dappId string, ip string) string
func (*ConsumerConsistency) SetSeenBlock ¶
func (cc *ConsumerConsistency) SetSeenBlock(blockSeen int64, dappId string, ip string)
func (*ConsumerConsistency) SetSeenBlockFromKey ¶ added in v2.4.0
func (cc *ConsumerConsistency) SetSeenBlockFromKey(blockSeen int64, key string)
used on subscription, where we already have the dapp key stored, but we don't keep the dappId and ip separately
type ConsumerStateTrackerInf ¶
type ConsumerStateTrackerInf interface { RegisterForVersionUpdates(ctx context.Context, version *protocoltypes.Version, versionValidator updaters.VersionValidationInf) RegisterConsumerSessionManagerForPairingUpdates(ctx context.Context, consumerSessionManager *lavasession.ConsumerSessionManager, staticProvidersList []*lavasession.RPCProviderEndpoint) RegisterForSpecUpdates(ctx context.Context, specUpdatable updaters.SpecUpdatable, endpoint lavasession.RPCEndpoint) error RegisterFinalizationConsensusForUpdates(context.Context, *finalizationconsensus.FinalizationConsensus) RegisterForDowntimeParamsUpdates(ctx context.Context, downtimeParamsUpdatable updaters.DowntimeParamsUpdatable) error TxConflictDetection(ctx context.Context, finalizationConflict *conflicttypes.FinalizationConflict, responseConflict *conflicttypes.ResponseConflict, conflictHandler common.ConflictHandlerInterface) error GetConsumerPolicy(ctx context.Context, consumerAddress, chainID string) (*plantypes.Policy, error) GetProtocolVersion(ctx context.Context) (*updaters.ProtocolVersionResponse, error) GetLatestVirtualEpoch() uint64 }
type ConsumerTxSender ¶
type ConsumerTxSender interface { TxConflictDetection(ctx context.Context, finalizationConflict *conflicttypes.FinalizationConflict, responseConflict *conflicttypes.ResponseConflict, conflictHandler common.ConflictHandlerInterface) error GetConsumerPolicy(ctx context.Context, consumerAddress, chainID string) (*plantypes.Policy, error) GetLatestVirtualEpoch() uint64 }
type MetricsInterface ¶
type MockConsumerStateTrackerInf ¶ added in v2.4.0
type MockConsumerStateTrackerInf struct {
// contains filtered or unexported fields
}
MockConsumerStateTrackerInf is a mock of ConsumerStateTrackerInf interface.
func NewMockConsumerStateTrackerInf ¶ added in v2.4.0
func NewMockConsumerStateTrackerInf(ctrl *gomock.Controller) *MockConsumerStateTrackerInf
NewMockConsumerStateTrackerInf creates a new mock instance.
func (*MockConsumerStateTrackerInf) EXPECT ¶ added in v2.4.0
func (m *MockConsumerStateTrackerInf) EXPECT() *MockConsumerStateTrackerInfMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockConsumerStateTrackerInf) GetConsumerPolicy ¶ added in v2.4.0
func (m *MockConsumerStateTrackerInf) GetConsumerPolicy(ctx context.Context, consumerAddress, chainID string) (*types0.Policy, error)
GetConsumerPolicy mocks base method.
func (*MockConsumerStateTrackerInf) GetLatestVirtualEpoch ¶ added in v2.4.0
func (m *MockConsumerStateTrackerInf) GetLatestVirtualEpoch() uint64
GetLatestVirtualEpoch mocks base method.
func (*MockConsumerStateTrackerInf) GetProtocolVersion ¶ added in v2.4.0
func (m *MockConsumerStateTrackerInf) GetProtocolVersion(ctx context.Context) (*updaters.ProtocolVersionResponse, error)
GetProtocolVersion mocks base method.
func (*MockConsumerStateTrackerInf) RegisterConsumerSessionManagerForPairingUpdates ¶ added in v2.4.0
func (m *MockConsumerStateTrackerInf) RegisterConsumerSessionManagerForPairingUpdates(ctx context.Context, consumerSessionManager *lavasession.ConsumerSessionManager, staticProviders []*lavasession.RPCProviderEndpoint)
RegisterConsumerSessionManagerForPairingUpdates mocks base method.
func (*MockConsumerStateTrackerInf) RegisterFinalizationConsensusForUpdates ¶ added in v2.4.0
func (m *MockConsumerStateTrackerInf) RegisterFinalizationConsensusForUpdates(arg0 context.Context, arg1 *finalizationconsensus.FinalizationConsensus)
RegisterFinalizationConsensusForUpdates mocks base method.
func (*MockConsumerStateTrackerInf) RegisterForDowntimeParamsUpdates ¶ added in v2.4.0
func (m *MockConsumerStateTrackerInf) RegisterForDowntimeParamsUpdates(ctx context.Context, downtimeParamsUpdatable updaters.DowntimeParamsUpdatable) error
RegisterForDowntimeParamsUpdates mocks base method.
func (*MockConsumerStateTrackerInf) RegisterForSpecUpdates ¶ added in v2.4.0
func (m *MockConsumerStateTrackerInf) RegisterForSpecUpdates(ctx context.Context, specUpdatable updaters.SpecUpdatable, endpoint lavasession.RPCEndpoint) error
RegisterForSpecUpdates mocks base method.
func (*MockConsumerStateTrackerInf) RegisterForVersionUpdates ¶ added in v2.4.0
func (m *MockConsumerStateTrackerInf) RegisterForVersionUpdates(ctx context.Context, version *types1.Version, versionValidator updaters.VersionValidationInf)
RegisterForVersionUpdates mocks base method.
func (*MockConsumerStateTrackerInf) TxConflictDetection ¶ added in v2.4.0
func (m *MockConsumerStateTrackerInf) TxConflictDetection(ctx context.Context, finalizationConflict *types.FinalizationConflict, responseConflict *types.ResponseConflict, conflictHandler common.ConflictHandlerInterface) error
TxConflictDetection mocks base method.
type MockConsumerStateTrackerInfMockRecorder ¶ added in v2.4.0
type MockConsumerStateTrackerInfMockRecorder struct {
// contains filtered or unexported fields
}
MockConsumerStateTrackerInfMockRecorder is the mock recorder for MockConsumerStateTrackerInf.
func (*MockConsumerStateTrackerInfMockRecorder) GetConsumerPolicy ¶ added in v2.4.0
func (mr *MockConsumerStateTrackerInfMockRecorder) GetConsumerPolicy(ctx, consumerAddress, chainID any) *gomock.Call
GetConsumerPolicy indicates an expected call of GetConsumerPolicy.
func (*MockConsumerStateTrackerInfMockRecorder) GetLatestVirtualEpoch ¶ added in v2.4.0
func (mr *MockConsumerStateTrackerInfMockRecorder) GetLatestVirtualEpoch() *gomock.Call
GetLatestVirtualEpoch indicates an expected call of GetLatestVirtualEpoch.
func (*MockConsumerStateTrackerInfMockRecorder) GetProtocolVersion ¶ added in v2.4.0
func (mr *MockConsumerStateTrackerInfMockRecorder) GetProtocolVersion(ctx any) *gomock.Call
GetProtocolVersion indicates an expected call of GetProtocolVersion.
func (*MockConsumerStateTrackerInfMockRecorder) RegisterConsumerSessionManagerForPairingUpdates ¶ added in v2.4.0
func (mr *MockConsumerStateTrackerInfMockRecorder) RegisterConsumerSessionManagerForPairingUpdates(ctx, consumerSessionManager any) *gomock.Call
RegisterConsumerSessionManagerForPairingUpdates indicates an expected call of RegisterConsumerSessionManagerForPairingUpdates.
func (*MockConsumerStateTrackerInfMockRecorder) RegisterFinalizationConsensusForUpdates ¶ added in v2.4.0
func (mr *MockConsumerStateTrackerInfMockRecorder) RegisterFinalizationConsensusForUpdates(arg0, arg1 any) *gomock.Call
RegisterFinalizationConsensusForUpdates indicates an expected call of RegisterFinalizationConsensusForUpdates.
func (*MockConsumerStateTrackerInfMockRecorder) RegisterForDowntimeParamsUpdates ¶ added in v2.4.0
func (mr *MockConsumerStateTrackerInfMockRecorder) RegisterForDowntimeParamsUpdates(ctx, downtimeParamsUpdatable any) *gomock.Call
RegisterForDowntimeParamsUpdates indicates an expected call of RegisterForDowntimeParamsUpdates.
func (*MockConsumerStateTrackerInfMockRecorder) RegisterForSpecUpdates ¶ added in v2.4.0
func (mr *MockConsumerStateTrackerInfMockRecorder) RegisterForSpecUpdates(ctx, specUpdatable, endpoint any) *gomock.Call
RegisterForSpecUpdates indicates an expected call of RegisterForSpecUpdates.
func (*MockConsumerStateTrackerInfMockRecorder) RegisterForVersionUpdates ¶ added in v2.4.0
func (mr *MockConsumerStateTrackerInfMockRecorder) RegisterForVersionUpdates(ctx, version, versionValidator any) *gomock.Call
RegisterForVersionUpdates indicates an expected call of RegisterForVersionUpdates.
func (*MockConsumerStateTrackerInfMockRecorder) TxConflictDetection ¶ added in v2.4.0
func (mr *MockConsumerStateTrackerInfMockRecorder) TxConflictDetection(ctx, finalizationConflict, responseConflict, conflictHandler any) *gomock.Call
TxConflictDetection indicates an expected call of TxConflictDetection.
type MockRelayerClient ¶ added in v2.4.0
type MockRelayerClient struct {
// contains filtered or unexported fields
}
MockRelayerClient is a mock of RelayerClient interface.
func NewMockRelayerClient ¶ added in v2.4.0
func NewMockRelayerClient(ctrl *gomock.Controller) *MockRelayerClient
NewMockRelayerClient creates a new mock instance.
func (*MockRelayerClient) EXPECT ¶ added in v2.4.0
func (m *MockRelayerClient) EXPECT() *MockRelayerClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRelayerClient) Probe ¶ added in v2.4.0
func (m *MockRelayerClient) Probe(ctx context.Context, in *types.ProbeRequest, opts ...grpc.CallOption) (*types.ProbeReply, error)
Probe mocks base method.
func (*MockRelayerClient) Relay ¶ added in v2.4.0
func (m *MockRelayerClient) Relay(ctx context.Context, in *types.RelayRequest, opts ...grpc.CallOption) (*types.RelayReply, error)
Relay mocks base method.
func (*MockRelayerClient) RelaySubscribe ¶ added in v2.4.0
func (m *MockRelayerClient) RelaySubscribe(ctx context.Context, in *types.RelayRequest, opts ...grpc.CallOption) (types.Relayer_RelaySubscribeClient, error)
RelaySubscribe mocks base method.
type MockRelayerClientMockRecorder ¶ added in v2.4.0
type MockRelayerClientMockRecorder struct {
// contains filtered or unexported fields
}
MockRelayerClientMockRecorder is the mock recorder for MockRelayerClient.
func (*MockRelayerClientMockRecorder) Probe ¶ added in v2.4.0
func (mr *MockRelayerClientMockRecorder) Probe(ctx, in any, opts ...any) *gomock.Call
Probe indicates an expected call of Probe.
func (*MockRelayerClientMockRecorder) Relay ¶ added in v2.4.0
func (mr *MockRelayerClientMockRecorder) Relay(ctx, in any, opts ...any) *gomock.Call
Relay indicates an expected call of Relay.
func (*MockRelayerClientMockRecorder) RelaySubscribe ¶ added in v2.4.0
func (mr *MockRelayerClientMockRecorder) RelaySubscribe(ctx, in any, opts ...any) *gomock.Call
RelaySubscribe indicates an expected call of RelaySubscribe.
type MockRelayerServer ¶ added in v2.4.0
type MockRelayerServer struct {
// contains filtered or unexported fields
}
MockRelayerServer is a mock of RelayerServer interface.
func NewMockRelayerServer ¶ added in v2.4.0
func NewMockRelayerServer(ctrl *gomock.Controller) *MockRelayerServer
NewMockRelayerServer creates a new mock instance.
func (*MockRelayerServer) EXPECT ¶ added in v2.4.0
func (m *MockRelayerServer) EXPECT() *MockRelayerServerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRelayerServer) Probe ¶ added in v2.4.0
func (m *MockRelayerServer) Probe(arg0 context.Context, arg1 *types.ProbeRequest) (*types.ProbeReply, error)
Probe mocks base method.
func (*MockRelayerServer) Relay ¶ added in v2.4.0
func (m *MockRelayerServer) Relay(arg0 context.Context, arg1 *types.RelayRequest) (*types.RelayReply, error)
Relay mocks base method.
func (*MockRelayerServer) RelaySubscribe ¶ added in v2.4.0
func (m *MockRelayerServer) RelaySubscribe(arg0 *types.RelayRequest, arg1 types.Relayer_RelaySubscribeServer) error
RelaySubscribe mocks base method.
type MockRelayerServerMockRecorder ¶ added in v2.4.0
type MockRelayerServerMockRecorder struct {
// contains filtered or unexported fields
}
MockRelayerServerMockRecorder is the mock recorder for MockRelayerServer.
func (*MockRelayerServerMockRecorder) Probe ¶ added in v2.4.0
func (mr *MockRelayerServerMockRecorder) Probe(arg0, arg1 any) *gomock.Call
Probe indicates an expected call of Probe.
func (*MockRelayerServerMockRecorder) Relay ¶ added in v2.4.0
func (mr *MockRelayerServerMockRecorder) Relay(arg0, arg1 any) *gomock.Call
Relay indicates an expected call of Relay.
func (*MockRelayerServerMockRecorder) RelaySubscribe ¶ added in v2.4.0
func (mr *MockRelayerServerMockRecorder) RelaySubscribe(arg0, arg1 any) *gomock.Call
RelaySubscribe indicates an expected call of RelaySubscribe.
type MockRelayer_RelaySubscribeClient ¶ added in v2.4.0
type MockRelayer_RelaySubscribeClient struct {
// contains filtered or unexported fields
}
MockRelayer_RelaySubscribeClient is a mock of Relayer_RelaySubscribeClient interface.
func NewMockRelayer_RelaySubscribeClient ¶ added in v2.4.0
func NewMockRelayer_RelaySubscribeClient(ctrl *gomock.Controller) *MockRelayer_RelaySubscribeClient
NewMockRelayer_RelaySubscribeClient creates a new mock instance.
func (*MockRelayer_RelaySubscribeClient) CloseSend ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeClient) CloseSend() error
CloseSend mocks base method.
func (*MockRelayer_RelaySubscribeClient) Context ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeClient) Context() context.Context
Context mocks base method.
func (*MockRelayer_RelaySubscribeClient) EXPECT ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeClient) EXPECT() *MockRelayer_RelaySubscribeClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRelayer_RelaySubscribeClient) Header ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeClient) Header() (metadata.MD, error)
Header mocks base method.
func (*MockRelayer_RelaySubscribeClient) Recv ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeClient) Recv() (*types.RelayReply, error)
Recv mocks base method.
func (*MockRelayer_RelaySubscribeClient) RecvMsg ¶ added in v2.4.0
func (m_2 *MockRelayer_RelaySubscribeClient) RecvMsg(m any) error
RecvMsg mocks base method.
func (*MockRelayer_RelaySubscribeClient) SendMsg ¶ added in v2.4.0
func (m_2 *MockRelayer_RelaySubscribeClient) SendMsg(m any) error
SendMsg mocks base method.
func (*MockRelayer_RelaySubscribeClient) Trailer ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeClient) Trailer() metadata.MD
Trailer mocks base method.
type MockRelayer_RelaySubscribeClientMockRecorder ¶ added in v2.4.0
type MockRelayer_RelaySubscribeClientMockRecorder struct {
// contains filtered or unexported fields
}
MockRelayer_RelaySubscribeClientMockRecorder is the mock recorder for MockRelayer_RelaySubscribeClient.
func (*MockRelayer_RelaySubscribeClientMockRecorder) CloseSend ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeClientMockRecorder) CloseSend() *gomock.Call
CloseSend indicates an expected call of CloseSend.
func (*MockRelayer_RelaySubscribeClientMockRecorder) Context ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeClientMockRecorder) Context() *gomock.Call
Context indicates an expected call of Context.
func (*MockRelayer_RelaySubscribeClientMockRecorder) Header ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeClientMockRecorder) Header() *gomock.Call
Header indicates an expected call of Header.
func (*MockRelayer_RelaySubscribeClientMockRecorder) Recv ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeClientMockRecorder) Recv() *gomock.Call
Recv indicates an expected call of Recv.
func (*MockRelayer_RelaySubscribeClientMockRecorder) RecvMsg ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeClientMockRecorder) RecvMsg(m any) *gomock.Call
RecvMsg indicates an expected call of RecvMsg.
func (*MockRelayer_RelaySubscribeClientMockRecorder) SendMsg ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeClientMockRecorder) SendMsg(m any) *gomock.Call
SendMsg indicates an expected call of SendMsg.
func (*MockRelayer_RelaySubscribeClientMockRecorder) Trailer ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeClientMockRecorder) Trailer() *gomock.Call
Trailer indicates an expected call of Trailer.
type MockRelayer_RelaySubscribeServer ¶ added in v2.4.0
type MockRelayer_RelaySubscribeServer struct {
// contains filtered or unexported fields
}
MockRelayer_RelaySubscribeServer is a mock of Relayer_RelaySubscribeServer interface.
func NewMockRelayer_RelaySubscribeServer ¶ added in v2.4.0
func NewMockRelayer_RelaySubscribeServer(ctrl *gomock.Controller) *MockRelayer_RelaySubscribeServer
NewMockRelayer_RelaySubscribeServer creates a new mock instance.
func (*MockRelayer_RelaySubscribeServer) Context ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeServer) Context() context.Context
Context mocks base method.
func (*MockRelayer_RelaySubscribeServer) EXPECT ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeServer) EXPECT() *MockRelayer_RelaySubscribeServerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRelayer_RelaySubscribeServer) RecvMsg ¶ added in v2.4.0
func (m_2 *MockRelayer_RelaySubscribeServer) RecvMsg(m any) error
RecvMsg mocks base method.
func (*MockRelayer_RelaySubscribeServer) Send ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeServer) Send(arg0 *types.RelayReply) error
Send mocks base method.
func (*MockRelayer_RelaySubscribeServer) SendHeader ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeServer) SendHeader(arg0 metadata.MD) error
SendHeader mocks base method.
func (*MockRelayer_RelaySubscribeServer) SendMsg ¶ added in v2.4.0
func (m_2 *MockRelayer_RelaySubscribeServer) SendMsg(m any) error
SendMsg mocks base method.
func (*MockRelayer_RelaySubscribeServer) SetHeader ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeServer) SetHeader(arg0 metadata.MD) error
SetHeader mocks base method.
func (*MockRelayer_RelaySubscribeServer) SetTrailer ¶ added in v2.4.0
func (m *MockRelayer_RelaySubscribeServer) SetTrailer(arg0 metadata.MD)
SetTrailer mocks base method.
type MockRelayer_RelaySubscribeServerMockRecorder ¶ added in v2.4.0
type MockRelayer_RelaySubscribeServerMockRecorder struct {
// contains filtered or unexported fields
}
MockRelayer_RelaySubscribeServerMockRecorder is the mock recorder for MockRelayer_RelaySubscribeServer.
func (*MockRelayer_RelaySubscribeServerMockRecorder) Context ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeServerMockRecorder) Context() *gomock.Call
Context indicates an expected call of Context.
func (*MockRelayer_RelaySubscribeServerMockRecorder) RecvMsg ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeServerMockRecorder) RecvMsg(m any) *gomock.Call
RecvMsg indicates an expected call of RecvMsg.
func (*MockRelayer_RelaySubscribeServerMockRecorder) Send ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeServerMockRecorder) Send(arg0 any) *gomock.Call
Send indicates an expected call of Send.
func (*MockRelayer_RelaySubscribeServerMockRecorder) SendHeader ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeServerMockRecorder) SendHeader(arg0 any) *gomock.Call
SendHeader indicates an expected call of SendHeader.
func (*MockRelayer_RelaySubscribeServerMockRecorder) SendMsg ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeServerMockRecorder) SendMsg(m any) *gomock.Call
SendMsg indicates an expected call of SendMsg.
func (*MockRelayer_RelaySubscribeServerMockRecorder) SetHeader ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeServerMockRecorder) SetHeader(arg0 any) *gomock.Call
SetHeader indicates an expected call of SetHeader.
func (*MockRelayer_RelaySubscribeServerMockRecorder) SetTrailer ¶ added in v2.4.0
func (mr *MockRelayer_RelaySubscribeServerMockRecorder) SetTrailer(arg0 any) *gomock.Call
SetTrailer indicates an expected call of SetTrailer.
type RPCConsumer ¶
type RPCConsumer struct {
// contains filtered or unexported fields
}
type RPCConsumerServer ¶
type RPCConsumerServer struct { ConsumerAddress sdk.AccAddress // contains filtered or unexported fields }
implements Relay Sender interfaced and uses an ChainListener to get it called
func (*RPCConsumerServer) CancelSubscriptionContext ¶ added in v2.4.0
func (rpccs *RPCConsumerServer) CancelSubscriptionContext(subscriptionKey string)
func (*RPCConsumerServer) CreateDappKey ¶ added in v2.4.0
func (rpccs *RPCConsumerServer) CreateDappKey(dappID, consumerIp string) string
func (*RPCConsumerServer) GetChainIdAndApiInterface ¶
func (rpccs *RPCConsumerServer) GetChainIdAndApiInterface() (string, string)
func (*RPCConsumerServer) GetListeningAddress ¶ added in v2.4.0
func (rpccs *RPCConsumerServer) GetListeningAddress() string
func (*RPCConsumerServer) HandleDirectiveHeadersForMessage ¶
func (rpccs *RPCConsumerServer) HandleDirectiveHeadersForMessage(chainMessage chainlib.ChainMessage, directiveHeaders map[string]string)
func (*RPCConsumerServer) IsHealthy ¶
func (rpccs *RPCConsumerServer) IsHealthy() bool
func (*RPCConsumerServer) LavaDirectiveHeaders ¶
func (rpccs *RPCConsumerServer) LavaDirectiveHeaders(metadata []pairingtypes.Metadata) ([]pairingtypes.Metadata, map[string]string)
func (*RPCConsumerServer) ParseRelay ¶ added in v2.4.0
func (rpccs *RPCConsumerServer) ParseRelay( ctx context.Context, url string, req string, connectionType string, dappID string, consumerIp string, analytics *metrics.RelayMetrics, metadata []pairingtypes.Metadata, ) (protocolMessage chainlib.ProtocolMessage, err error)
func (*RPCConsumerServer) ProcessRelaySend ¶
func (rpccs *RPCConsumerServer) ProcessRelaySend(ctx context.Context, protocolMessage chainlib.ProtocolMessage, dappID string, consumerIp string, analytics *metrics.RelayMetrics) (*RelayProcessor, error)
func (*RPCConsumerServer) SendParsedRelay ¶ added in v2.4.0
func (rpccs *RPCConsumerServer) SendParsedRelay( ctx context.Context, dappID string, consumerIp string, analytics *metrics.RelayMetrics, protocolMessage chainlib.ProtocolMessage, ) (relayResult *common.RelayResult, errRet error)
func (*RPCConsumerServer) SendRelay ¶
func (rpccs *RPCConsumerServer) SendRelay( ctx context.Context, url string, req string, connectionType string, dappID string, consumerIp string, analytics *metrics.RelayMetrics, metadata []pairingtypes.Metadata, ) (relayResult *common.RelayResult, errRet error)
func (*RPCConsumerServer) ServeRPCRequests ¶
func (rpccs *RPCConsumerServer) ServeRPCRequests(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, consumerStateTracker ConsumerStateTrackerInf, chainParser chainlib.ChainParser, finalizationConsensus finalizationconsensus.FinalizationConsensusInf, consumerSessionManager *lavasession.ConsumerSessionManager, requiredResponses int, privKey *btcec.PrivateKey, lavaChainID string, cache *performance.Cache, rpcConsumerLogs *metrics.RPCConsumerLogs, consumerAddress sdk.AccAddress, consumerConsistency *ConsumerConsistency, relaysMonitor *metrics.RelaysMonitor, cmdFlags common.ConsumerCmdFlags, sharedState bool, refererData *chainlib.RefererData, reporter metrics.Reporter, consumerWsSubscriptionManager *chainlib.ConsumerWSSubscriptionManager, ) (err error)
func (*RPCConsumerServer) SetConsistencySeenBlock ¶ added in v2.4.0
func (rpccs *RPCConsumerServer) SetConsistencySeenBlock(blockSeen int64, key string)
type RelayError ¶
type RelayError struct { ProviderInfo common.ProviderInfo // contains filtered or unexported fields }
TODO: there's no need to save error twice and provider info twice, this can just be a relayResponse
func (RelayError) String ¶
func (re RelayError) String() string
type RelayErrors ¶
type RelayErrors struct {
// contains filtered or unexported fields
}
func (*RelayErrors) GetBestErrorMessageForUser ¶
func (r *RelayErrors) GetBestErrorMessageForUser() RelayError
type RelayProcessor ¶
type RelayProcessor struct {
// contains filtered or unexported fields
}
func NewRelayProcessor ¶
func NewRelayProcessor( ctx context.Context, usedProviders *lavasession.UsedProviders, requiredSuccesses int, chainMessage chainlib.ChainMessage, consumerConsistency *ConsumerConsistency, dappID string, consumerIp string, debugRelay bool, metricsInf MetricsInterface, chainIdAndApiInterfaceGetter chainIdAndApiInterfaceGetter, retryOptions relayProcessorRetryOptions, relayRetriesManager *RelayRetriesManager, ) *RelayProcessor
func (*RelayProcessor) GetAllowSessionDegradation ¶
func (rp *RelayProcessor) GetAllowSessionDegradation() bool
true if we never got an extension. (default value)
func (*RelayProcessor) GetUsedProviders ¶
func (rp *RelayProcessor) GetUsedProviders() *lavasession.UsedProviders
func (*RelayProcessor) HasRequiredNodeResults ¶
func (rp *RelayProcessor) HasRequiredNodeResults() bool
func (*RelayProcessor) HasResults ¶
func (rp *RelayProcessor) HasResults() bool
this function defines if we should use the processor to return the result (meaning it has some insight and responses) or just return to the user
func (*RelayProcessor) NodeResults ¶
func (rp *RelayProcessor) NodeResults() []common.RelayResult
this function returns all results that came from a node, meaning success, and node errors
func (*RelayProcessor) ProcessingResult ¶
func (rp *RelayProcessor) ProcessingResult() (returnedResult *common.RelayResult, processingError error)
this function returns the results according to the defined strategy results were stored in WaitForResults and now there's logic to select which results are returned to the user will return an error if we did not meet quota of replies, if we did we follow the strategies: if return strategy == get_first: return the first success, if none: get best node error if strategy == quorum get majority of node responses on error: we will return a placeholder relayResult, with a provider address and a status code
func (*RelayProcessor) ProtocolErrors ¶
func (rp *RelayProcessor) ProtocolErrors() uint64
func (*RelayProcessor) SetDisallowDegradation ¶
func (rp *RelayProcessor) SetDisallowDegradation()
in case we had an extension and managed to get a session successfully, we prevent session degradation.
func (*RelayProcessor) SetResponse ¶
func (rp *RelayProcessor) SetResponse(response *relayResponse)
func (*RelayProcessor) ShouldRetry ¶
func (rp *RelayProcessor) ShouldRetry(numberOfRetriesLaunched int) bool
func (*RelayProcessor) String ¶
func (rp *RelayProcessor) String() string
func (*RelayProcessor) WaitForResults ¶
func (rp *RelayProcessor) WaitForResults(ctx context.Context) error
this function waits for the processing results, they are written by multiple go routines and read by this go routine it then updates the responses in their respective place, node errors, protocol errors or success results
type RelayRetriesManager ¶
type RelayRetriesManager struct {
// contains filtered or unexported fields
}
On node errors we try to send a relay again. If this relay failed all retries we ban it from retries to avoid spam and save resources
func NewRelayRetriesManager ¶
func NewRelayRetriesManager() *RelayRetriesManager
func (*RelayRetriesManager) AddHashToCache ¶
func (rrm *RelayRetriesManager) AddHashToCache(hash string)
Add hash to the retry cache.
func (*RelayRetriesManager) CheckHashInCache ¶
func (rrm *RelayRetriesManager) CheckHashInCache(hash string) bool
Check if we already have this hash so we don't retry.
func (*RelayRetriesManager) RemoveHashFromCache ¶
func (rrm *RelayRetriesManager) RemoveHashFromCache(hash string)
Remove hash from cache if it exists