Documentation ¶
Overview ¶
Code generated by MockGen. DO NOT EDIT. Source: protocol/rpcprovider/provider_listener.go
Generated by this command:
mockgen -source=protocol/rpcprovider/provider_listener.go -destination protocol/rpcprovider/provider_listener_mock.go -package rpcprovider
Package rpcprovider is a generated GoMock package.
Index ¶
- Constants
- Variables
- func CreateRPCProviderCobraCommand() *cobra.Command
- func CreateTestRPCProviderCobraCommand() *cobra.Command
- func GetAllNodeUrlsInternalPaths(nodeUrls []common.NodeUrl) []string
- func ParseEndpoints(viper_endpoints *viper.Viper, geolocation uint64) (endpoints []*lavasession.RPCProviderEndpoint, err error)
- func ParseEndpointsCustomName(viper_endpoints *viper.Viper, endpointsConfigName string, geolocation uint64) (endpoints []*lavasession.RPCProviderEndpoint, err error)
- func PerformCORSCheck(endpoint epochstoragetypes.Endpoint) error
- type MockRelayReceiver
- func (m *MockRelayReceiver) EXPECT() *MockRelayReceiverMockRecorder
- func (m *MockRelayReceiver) Probe(ctx context.Context, probeReq *types.ProbeRequest) (*types.ProbeReply, error)
- func (m *MockRelayReceiver) Relay(ctx context.Context, request *types.RelayRequest) (*types.RelayReply, error)
- func (m *MockRelayReceiver) RelaySubscribe(request *types.RelayRequest, srv types.Relayer_RelaySubscribeServer) error
- type MockRelayReceiverMockRecorder
- type ProviderListener
- type ProviderLoadManager
- type ProviderPolicy
- type ProviderRelaySender
- type ProviderStateMachine
- type ProviderStateTrackerInf
- type RPCProvider
- func (rpcp *RPCProvider) GetLatestBlockNumForSpec(specID string) int64
- func (rpcp *RPCProvider) RetryDisabledEndpoints(disabledEndpoints []*lavasession.RPCProviderEndpoint, ...)
- func (rpcp *RPCProvider) SetupEndpoint(ctx context.Context, rpcProviderEndpoint *lavasession.RPCProviderEndpoint, ...) error
- func (rpcp *RPCProvider) SetupProviderEndpoints(rpcProviderEndpoints []*lavasession.RPCProviderEndpoint, ...) (disabledEndpointsRet []*lavasession.RPCProviderEndpoint)
- func (rpcp *RPCProvider) Start(options *rpcProviderStartOptions) (err error)
- type RPCProviderServer
- func (rpcps *RPCProviderServer) BuildRelayFinalizedBlockHashes(ctx context.Context, request *pairingtypes.RelayRequest, ...) (err error)
- func (rpcps *RPCProviderServer) ExtractConsumerAddress(ctx context.Context, relaySession *pairingtypes.RelaySession) (extractedConsumerAddress sdk.AccAddress, err error)
- func (rpcps *RPCProviderServer) GetBlockDataForOptimisticFetch(ctx context.Context, relayBaseTimeout time.Duration, requiredProofBlock int64, ...) (latestBlock int64, requestedHashes []*chaintracker.BlockStore, err error)
- func (rpcps *RPCProviderServer) GetLatestBlockData(ctx context.Context, blockDistanceToFinalization uint32, ...) (latestBlock int64, requestedHashes []*chaintracker.BlockStore, ...)
- func (rpcps *RPCProviderServer) GetParametersForRelayDataReliability(ctx context.Context, request *pairingtypes.RelayRequest, ...) (latestBlock int64, requestedBlockHash []byte, ...)
- func (rpcps *RPCProviderServer) IsHealthy() bool
- func (rpcps *RPCProviderServer) Probe(ctx context.Context, probeReq *pairingtypes.ProbeRequest) (*pairingtypes.ProbeReply, error)
- func (rpcps *RPCProviderServer) Relay(ctx context.Context, request *pairingtypes.RelayRequest) (*pairingtypes.RelayReply, error)
- func (rpcps *RPCProviderServer) RelaySubscribe(request *pairingtypes.RelayRequest, ...) error
- func (rpcps *RPCProviderServer) SendProof(ctx context.Context, epoch uint64, request *pairingtypes.RelayRequest, ...) error
- func (rpcps *RPCProviderServer) ServeRPCRequests(ctx context.Context, rpcProviderEndpoint *lavasession.RPCProviderEndpoint, ...)
- func (rpcps *RPCProviderServer) SetProviderUniqueId(uniqueId string)
- func (rpcps *RPCProviderServer) SleepUntilTimeOrConditionReached(ctx context.Context, queryTime time.Duration, condition func() bool) (sleepTime time.Duration)
- func (rpcps *RPCProviderServer) TryRelay(ctx context.Context, request *pairingtypes.RelayRequest, ...) (*pairingtypes.RelayReply, error)
- func (rpcps *RPCProviderServer) TryRelaySubscribe(ctx context.Context, requestBlockHeight uint64, ...) (subscribedSuccessfully bool, errRet error)
- func (rpcps *RPCProviderServer) TryRelayUnsubscribe(ctx context.Context, request *pairingtypes.RelayRequest, ...) (*pairingtypes.RelayReply, error)
- func (rpcps *RPCProviderServer) ValidateAddonsExtensions(addon string, extensions []string, chainMessage chainlib.ChainMessage) error
- func (rpcps *RPCProviderServer) ValidateRequest(chainMessage chainlib.ChainMessage, request *pairingtypes.RelayRequest, ...) error
- type RelayReceiver
- type ReliabilityManagerInf
- type RewardServerInf
- type SpecValidator
- func (sv *SpecValidator) Active() bool
- func (sv *SpecValidator) AddChainFetcher(ctx context.Context, chainFetcher *chainlib.ChainFetcherIf, chainId string) error
- func (sv *SpecValidator) AddRPCProviderListener(address string, providerListener *ProviderListener)
- func (sv *SpecValidator) GetUniqueName() string
- func (sv *SpecValidator) Start(ctx context.Context)
- func (sv *SpecValidator) VerifySpec(spec spectypes.Spec)
- type StateTrackerInf
Constants ¶
const ( HealthCheckURLPathFlagName = "health-check-url-path" HealthCheckURLPathFlagDefault = "/lava/health" )
const ( ChainTrackerDefaultMemory = 100 DEFAULT_ALLOWED_MISSING_CU = 0.2 ShardIDFlagName = "shard-id" StickinessHeaderName = "sticky-header" DefaultShardID uint = 0 )
const ( SpecValidationIntervalFlagName = "spec-validation-interval" SpecValidationIntervalDisabledChainsFlagName = "spec-validation-interval-disabled-chains" )
const (
RPCProviderAddressHeader = "Lava-Provider-Address"
)
Variables ¶
var ( Yaml_config_properties = []string{"network-address.address", "chain-id", "api-interface", "node-urls.url"} DefaultRPCProviderFileName = "rpcprovider.yml" RelaysHealthEnableFlagDefault = true RelayHealthIntervalFlagDefault = 5 * time.Minute )
var ( SpecValidationInterval = 3 * time.Hour SpecValidationIntervalDisabledChains = 3 * time.Minute )
var (
RPCProviderStickinessHeaderName = "X-Node-Sticky"
)
Functions ¶
func GetAllNodeUrlsInternalPaths ¶ added in v4.1.1
func ParseEndpoints ¶
func ParseEndpoints(viper_endpoints *viper.Viper, geolocation uint64) (endpoints []*lavasession.RPCProviderEndpoint, err error)
func ParseEndpointsCustomName ¶
func ParseEndpointsCustomName(viper_endpoints *viper.Viper, endpointsConfigName string, geolocation uint64) (endpoints []*lavasession.RPCProviderEndpoint, err error)
func PerformCORSCheck ¶
func PerformCORSCheck(endpoint epochstoragetypes.Endpoint) error
Types ¶
type MockRelayReceiver ¶
type MockRelayReceiver struct {
// contains filtered or unexported fields
}
MockRelayReceiver is a mock of RelayReceiver interface.
func NewMockRelayReceiver ¶
func NewMockRelayReceiver(ctrl *gomock.Controller) *MockRelayReceiver
NewMockRelayReceiver creates a new mock instance.
func (*MockRelayReceiver) EXPECT ¶
func (m *MockRelayReceiver) EXPECT() *MockRelayReceiverMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRelayReceiver) Probe ¶
func (m *MockRelayReceiver) Probe(ctx context.Context, probeReq *types.ProbeRequest) (*types.ProbeReply, error)
Probe mocks base method.
func (*MockRelayReceiver) Relay ¶
func (m *MockRelayReceiver) Relay(ctx context.Context, request *types.RelayRequest) (*types.RelayReply, error)
Relay mocks base method.
func (*MockRelayReceiver) RelaySubscribe ¶
func (m *MockRelayReceiver) RelaySubscribe(request *types.RelayRequest, srv types.Relayer_RelaySubscribeServer) error
RelaySubscribe mocks base method.
type MockRelayReceiverMockRecorder ¶
type MockRelayReceiverMockRecorder struct {
// contains filtered or unexported fields
}
MockRelayReceiverMockRecorder is the mock recorder for MockRelayReceiver.
func (*MockRelayReceiverMockRecorder) Probe ¶
func (mr *MockRelayReceiverMockRecorder) Probe(ctx, probeReq any) *gomock.Call
Probe indicates an expected call of Probe.
func (*MockRelayReceiverMockRecorder) Relay ¶
func (mr *MockRelayReceiverMockRecorder) Relay(ctx, request any) *gomock.Call
Relay indicates an expected call of Relay.
func (*MockRelayReceiverMockRecorder) RelaySubscribe ¶
func (mr *MockRelayReceiverMockRecorder) RelaySubscribe(request, srv any) *gomock.Call
RelaySubscribe indicates an expected call of RelaySubscribe.
type ProviderListener ¶
type ProviderListener struct {
// contains filtered or unexported fields
}
func NewProviderListener ¶
func NewProviderListener(ctx context.Context, networkAddress lavasession.NetworkAddressData, healthCheckPath string) *ProviderListener
func (*ProviderListener) Key ¶
func (pl *ProviderListener) Key() string
func (*ProviderListener) RegisterReceiver ¶
func (pl *ProviderListener) RegisterReceiver(existingReceiver RelayReceiver, endpoint *lavasession.RPCProviderEndpoint) error
type ProviderLoadManager ¶ added in v4.1.0
type ProviderLoadManager struct {
// contains filtered or unexported fields
}
func NewProviderLoadManager ¶ added in v4.1.0
func NewProviderLoadManager(rateLimitThreshold uint64) *ProviderLoadManager
type ProviderPolicy ¶
type ProviderPolicy struct {
// contains filtered or unexported fields
}
used to call SetPolicy in base chain parser so we are allowed to run verifications on the addons and extensions
func GetAllAddonsAndExtensionsFromNodeUrlSlice ¶
func GetAllAddonsAndExtensionsFromNodeUrlSlice(nodeUrls []common.NodeUrl) *ProviderPolicy
func (*ProviderPolicy) GetSupportedAddons ¶
func (pp *ProviderPolicy) GetSupportedAddons(specID string) (addons []string, err error)
func (*ProviderPolicy) GetSupportedExtensions ¶
func (pp *ProviderPolicy) GetSupportedExtensions(specID string) (extensions []epochstorage.EndpointService, err error)
type ProviderRelaySender ¶
type ProviderRelaySender interface {
SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage chainlib.ChainMessageForSend, extensions []string) (relayReply *chainlib.RelayReplyWrapper, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, proxyUrl common.NodeUrl, chainId string, err error)
}
type ProviderStateMachine ¶
type ProviderStateMachine struct {
// contains filtered or unexported fields
}
func NewProviderStateMachine ¶
func NewProviderStateMachine(chainId string, relayRetriesManager lavaprotocol.RelayRetriesManagerInf, relaySender ProviderRelaySender) *ProviderStateMachine
func (*ProviderStateMachine) SendNodeMessage ¶
func (psm *ProviderStateMachine) SendNodeMessage(ctx context.Context, chainMsg chainlib.ChainMessage, request *pairingtypes.RelayRequest) (*chainlib.RelayReplyWrapper, error)
type ProviderStateTrackerInf ¶
type ProviderStateTrackerInf interface { RegisterForVersionUpdates(ctx context.Context, version *protocoltypes.Version, versionValidator updaters.VersionValidationInf) RegisterForSpecUpdates(ctx context.Context, specUpdatable updaters.SpecUpdatable, endpoint lavasession.RPCEndpoint) error RegisterForSpecVerifications(ctx context.Context, specVerifier updaters.SpecVerifier, chainId string) error RegisterReliabilityManagerForVoteUpdates(ctx context.Context, voteUpdatable updaters.VoteUpdatable, endpointP *lavasession.RPCProviderEndpoint) RegisterForEpochUpdates(ctx context.Context, epochUpdatable updaters.EpochUpdatable) RegisterForDowntimeParamsUpdates(ctx context.Context, downtimeParamsUpdatable updaters.DowntimeParamsUpdatable) error TxRelayPayment(ctx context.Context, relayRequests []*pairingtypes.RelaySession, description string, latestBlocks []*pairingtypes.LatestBlockReport) error SendVoteReveal(voteID string, vote *reliabilitymanager.VoteData, specID string) error SendVoteCommitment(voteID string, vote *reliabilitymanager.VoteData, specID string) error LatestBlock() int64 GetMaxCuForUser(ctx context.Context, consumerAddress, chainID string, epocu uint64) (maxCu uint64, err error) VerifyPairing(ctx context.Context, consumerAddress, providerAddress string, epoch uint64, chainID string) (valid bool, total int64, projectId string, err error) GetEpochSize(ctx context.Context) (uint64, error) EarliestBlockInMemory(ctx context.Context) (uint64, error) RegisterPaymentUpdatableForPayments(ctx context.Context, paymentUpdatable updaters.PaymentUpdatable) GetRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error) GetEpochSizeMultipliedByRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error) GetProtocolVersion(ctx context.Context) (*updaters.ProtocolVersionResponse, error) GetVirtualEpoch(epoch uint64) uint64 GetAverageBlockTime() time.Duration }
type RPCProvider ¶
type RPCProvider struct {
// contains filtered or unexported fields
}
func (*RPCProvider) GetLatestBlockNumForSpec ¶
func (rpcp *RPCProvider) GetLatestBlockNumForSpec(specID string) int64
func (*RPCProvider) RetryDisabledEndpoints ¶
func (rpcp *RPCProvider) RetryDisabledEndpoints(disabledEndpoints []*lavasession.RPCProviderEndpoint, specValidator *SpecValidator, retryCount int)
func (*RPCProvider) SetupEndpoint ¶
func (rpcp *RPCProvider) SetupEndpoint(ctx context.Context, rpcProviderEndpoint *lavasession.RPCProviderEndpoint, specValidator *SpecValidator) error
func (*RPCProvider) SetupProviderEndpoints ¶
func (rpcp *RPCProvider) SetupProviderEndpoints(rpcProviderEndpoints []*lavasession.RPCProviderEndpoint, specValidator *SpecValidator, parallel bool) (disabledEndpointsRet []*lavasession.RPCProviderEndpoint)
func (*RPCProvider) Start ¶
func (rpcp *RPCProvider) Start(options *rpcProviderStartOptions) (err error)
type RPCProviderServer ¶
type RPCProviderServer struct { StaticProvider bool // contains filtered or unexported fields }
func (*RPCProviderServer) BuildRelayFinalizedBlockHashes ¶
func (rpcps *RPCProviderServer) BuildRelayFinalizedBlockHashes( ctx context.Context, request *pairingtypes.RelayRequest, reply *pairingtypes.RelayReply, latestBlock int64, requestedHashes []*chaintracker.BlockStore, updatedChainMessage bool, relayTimeout time.Duration, averageBlockTime time.Duration, blockDistanceToFinalization uint32, blocksInFinalizationData uint32, modifiedReqBlock int64, ) (err error)
func (*RPCProviderServer) ExtractConsumerAddress ¶
func (rpcps *RPCProviderServer) ExtractConsumerAddress(ctx context.Context, relaySession *pairingtypes.RelaySession) (extractedConsumerAddress sdk.AccAddress, err error)
func (*RPCProviderServer) GetBlockDataForOptimisticFetch ¶
func (rpcps *RPCProviderServer) GetBlockDataForOptimisticFetch(ctx context.Context, relayBaseTimeout time.Duration, requiredProofBlock int64, blockDistanceToFinalization uint32, blocksInFinalizationData uint32, averageBlockTime time.Duration) (latestBlock int64, requestedHashes []*chaintracker.BlockStore, err error)
func (*RPCProviderServer) GetLatestBlockData ¶
func (rpcps *RPCProviderServer) GetLatestBlockData(ctx context.Context, blockDistanceToFinalization uint32, blocksInFinalizationData uint32) (latestBlock int64, requestedHashes []*chaintracker.BlockStore, changeTime time.Time, err error)
func (*RPCProviderServer) GetParametersForRelayDataReliability ¶
func (rpcps *RPCProviderServer) GetParametersForRelayDataReliability( ctx context.Context, request *pairingtypes.RelayRequest, chainMsg chainlib.ChainMessage, relayTimeout time.Duration, blockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceToFinalization, blocksInFinalizationData uint32, ) (latestBlock int64, requestedBlockHash []byte, requestedHashes []*chaintracker.BlockStore, modifiedReqBlock int64, finalized, updatedChainMessage bool, err error)
func (*RPCProviderServer) IsHealthy ¶
func (rpcps *RPCProviderServer) IsHealthy() bool
func (*RPCProviderServer) Probe ¶
func (rpcps *RPCProviderServer) Probe(ctx context.Context, probeReq *pairingtypes.ProbeRequest) (*pairingtypes.ProbeReply, error)
func (*RPCProviderServer) Relay ¶
func (rpcps *RPCProviderServer) Relay(ctx context.Context, request *pairingtypes.RelayRequest) (*pairingtypes.RelayReply, error)
function used to handle relay requests from a consumer, it is called by a provider_listener by calling RegisterReceiver
func (*RPCProviderServer) RelaySubscribe ¶
func (rpcps *RPCProviderServer) RelaySubscribe(request *pairingtypes.RelayRequest, srv pairingtypes.Relayer_RelaySubscribeServer) error
func (*RPCProviderServer) SendProof ¶
func (rpcps *RPCProviderServer) SendProof(ctx context.Context, epoch uint64, request *pairingtypes.RelayRequest, consumerAddress sdk.AccAddress, apiInterface string) error
func (*RPCProviderServer) ServeRPCRequests ¶
func (rpcps *RPCProviderServer) ServeRPCRequests( ctx context.Context, rpcProviderEndpoint *lavasession.RPCProviderEndpoint, chainParser chainlib.ChainParser, rewardServer RewardServerInf, providerSessionManager *lavasession.ProviderSessionManager, reliabilityManager ReliabilityManagerInf, privKey *btcec.PrivateKey, cache *performance.Cache, chainRouter chainlib.ChainRouter, stateTracker StateTrackerInf, providerAddress sdk.AccAddress, lavaChainID string, allowedMissingCUThreshold float64, providerMetrics *metrics.ProviderMetrics, relaysMonitor *metrics.RelaysMonitor, providerNodeSubscriptionManager *chainlib.ProviderNodeSubscriptionManager, staticProvider bool, providerLoadManager *ProviderLoadManager, )
func (*RPCProviderServer) SetProviderUniqueId ¶
func (rpcps *RPCProviderServer) SetProviderUniqueId(uniqueId string)
func (*RPCProviderServer) SleepUntilTimeOrConditionReached ¶
func (*RPCProviderServer) TryRelay ¶
func (rpcps *RPCProviderServer) TryRelay(ctx context.Context, request *pairingtypes.RelayRequest, consumerAddr sdk.AccAddress, chainMsg chainlib.ChainMessage) (*pairingtypes.RelayReply, error)
func (*RPCProviderServer) TryRelaySubscribe ¶
func (rpcps *RPCProviderServer) TryRelaySubscribe(ctx context.Context, requestBlockHeight uint64, request *pairingtypes.RelayRequest, srv pairingtypes.Relayer_RelaySubscribeServer, chainMessage chainlib.ChainMessage, consumerAddress sdk.AccAddress, relaySession *lavasession.SingleProviderSession, relayNumber uint64) (subscribedSuccessfully bool, errRet error)
func (*RPCProviderServer) TryRelayUnsubscribe ¶
func (rpcps *RPCProviderServer) TryRelayUnsubscribe(ctx context.Context, request *pairingtypes.RelayRequest, consumerAddress sdk.AccAddress, chainMessage chainlib.ChainMessage) (*pairingtypes.RelayReply, error)
func (*RPCProviderServer) ValidateAddonsExtensions ¶
func (rpcps *RPCProviderServer) ValidateAddonsExtensions(addon string, extensions []string, chainMessage chainlib.ChainMessage) error
func (*RPCProviderServer) ValidateRequest ¶
func (rpcps *RPCProviderServer) ValidateRequest(chainMessage chainlib.ChainMessage, request *pairingtypes.RelayRequest, ctx context.Context) error
type RelayReceiver ¶
type RelayReceiver interface { Relay(ctx context.Context, request *pairingtypes.RelayRequest) (*pairingtypes.RelayReply, error) RelaySubscribe(request *pairingtypes.RelayRequest, srv pairingtypes.Relayer_RelaySubscribeServer) error Probe(ctx context.Context, probeReq *pairingtypes.ProbeRequest) (*pairingtypes.ProbeReply, error) }
type ReliabilityManagerInf ¶
type ReliabilityManagerInf interface { GetLatestBlockData(fromBlock, toBlock, specificBlock int64) (latestBlock int64, requestedHashes []*chaintracker.BlockStore, changeTime time.Time, err error) GetLatestBlockNum() (int64, time.Time) }
type RewardServerInf ¶
type RewardServerInf interface { SendNewProof(ctx context.Context, proof *pairingtypes.RelaySession, epoch uint64, consumerAddr, apiInterface string) (existingCU uint64, updatedWithProof bool) SubscribeStarted(consumer string, epoch uint64, subscribeID string) SubscribeEnded(consumer string, epoch uint64, subscribeID string) }
type SpecValidator ¶
type SpecValidator struct {
// contains filtered or unexported fields
}
func NewSpecValidator ¶
func NewSpecValidator() *SpecValidator
func (*SpecValidator) Active ¶
func (sv *SpecValidator) Active() bool
func (*SpecValidator) AddChainFetcher ¶
func (sv *SpecValidator) AddChainFetcher(ctx context.Context, chainFetcher *chainlib.ChainFetcherIf, chainId string) error
func (*SpecValidator) AddRPCProviderListener ¶
func (sv *SpecValidator) AddRPCProviderListener(address string, providerListener *ProviderListener)
func (*SpecValidator) GetUniqueName ¶
func (sv *SpecValidator) GetUniqueName() string
func (*SpecValidator) Start ¶
func (sv *SpecValidator) Start(ctx context.Context)
func (*SpecValidator) VerifySpec ¶
func (sv *SpecValidator) VerifySpec(spec spectypes.Spec)
type StateTrackerInf ¶
type StateTrackerInf interface { LatestBlock() int64 GetMaxCuForUser(ctx context.Context, consumerAddress, chainID string, epocu uint64) (maxCu uint64, err error) VerifyPairing(ctx context.Context, consumerAddress, providerAddress string, epoch uint64, chainID string) (valid bool, total int64, projectId string, err error) GetVirtualEpoch(epoch uint64) uint64 }