Documentation ¶
Index ¶
- Constants
- Variables
- func CreateRPCProviderCobraCommand() *cobra.Command
- func CreateTestRPCProviderCobraCommand() *cobra.Command
- func ParseEndpoints(viper_endpoints *viper.Viper, geolocation uint64) (endpoints []*lavasession.RPCProviderEndpoint, err error)
- type ChainTrackers
- type ProviderListener
- type ProviderStateTrackerInf
- type RPCProvider
- func (rpcp *RPCProvider) RetryDisabledEndpoints(disabledEndpoints []*lavasession.RPCProviderEndpoint, retryCount int)
- func (rpcp *RPCProvider) SetupEndpoint(ctx context.Context, rpcProviderEndpoint *lavasession.RPCProviderEndpoint) error
- func (rpcp *RPCProvider) SetupProviderEndpoints(rpcProviderEndpoints []*lavasession.RPCProviderEndpoint, parallel bool) (disabledEndpointsRet []*lavasession.RPCProviderEndpoint)
- func (rpcp *RPCProvider) Start(ctx context.Context, txFactory tx.Factory, clientCtx client.Context, ...) (err error)
- type RPCProviderServer
- func (rpcps *RPCProviderServer) ExtractConsumerAddress(ctx context.Context, relaySession *pairingtypes.RelaySession) (extractedConsumerAddress sdk.AccAddress, err error)
- func (rpcps *RPCProviderServer) GetBlockDataForOptimisticFetch(ctx context.Context, 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) 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) 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, ...) (subscribed bool, errRet 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 StateTrackerInf
Constants ¶
View Source
const ( ChainTrackerDefaultMemory = 100 DEFAULT_ALLOWED_MISSING_CU = 0.2 ShardIDFlagName = "shard-id" DefaultShardID uint = 0 )
Variables ¶
View Source
var ( Yaml_config_properties = []string{"network-address.address", "chain-id", "api-interface", "node-urls.url"} DefaultRPCProviderFileName = "rpcprovider.yml" )
Functions ¶
func ParseEndpoints ¶
func ParseEndpoints(viper_endpoints *viper.Viper, geolocation uint64) (endpoints []*lavasession.RPCProviderEndpoint, err error)
Types ¶
type ChainTrackers ¶
type ChainTrackers struct {
// contains filtered or unexported fields
}
func (*ChainTrackers) GetLatestBlockNumForSpec ¶
func (ct *ChainTrackers) GetLatestBlockNumForSpec(specID string) int64
func (*ChainTrackers) GetTrackerPerChain ¶
func (ct *ChainTrackers) GetTrackerPerChain(specID string) (chainTracker *chaintracker.ChainTracker, found bool)
func (*ChainTrackers) SetTrackerForChain ¶
func (ct *ChainTrackers) SetTrackerForChain(specId string, chainTracker *chaintracker.ChainTracker)
type ProviderListener ¶
type ProviderListener struct {
// contains filtered or unexported fields
}
func NewProviderListener ¶
func NewProviderListener(ctx context.Context, networkAddress lavasession.NetworkAddressData) *ProviderListener
func (*ProviderListener) Key ¶
func (pl *ProviderListener) Key() string
func (*ProviderListener) RegisterReceiver ¶
func (pl *ProviderListener) RegisterReceiver(existingReceiver RelayReceiver, endpoint *lavasession.RPCProviderEndpoint) error
type ProviderStateTrackerInf ¶
type ProviderStateTrackerInf interface { RegisterForVersionUpdates(ctx context.Context, version *protocoltypes.Version, versionValidator statetracker.VersionValidationInf) RegisterForSpecUpdates(ctx context.Context, specUpdatable statetracker.SpecUpdatable, endpoint lavasession.RPCEndpoint) error RegisterReliabilityManagerForVoteUpdates(ctx context.Context, voteUpdatable statetracker.VoteUpdatable, endpointP *lavasession.RPCProviderEndpoint) RegisterForEpochUpdates(ctx context.Context, epochUpdatable statetracker.EpochUpdatable) TxRelayPayment(ctx context.Context, relayRequests []*pairingtypes.RelaySession, description string, latestBlocks []*pairingtypes.LatestBlockReport) error SendVoteReveal(voteID string, vote *reliabilitymanager.VoteData) error SendVoteCommitment(voteID string, vote *reliabilitymanager.VoteData) 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 statetracker.PaymentUpdatable) GetRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error) GetEpochSizeMultipliedByRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error) GetProtocolVersion(ctx context.Context) (*statetracker.ProtocolVersionResponse, error) }
type RPCProvider ¶
type RPCProvider struct {
// contains filtered or unexported fields
}
func (*RPCProvider) RetryDisabledEndpoints ¶
func (rpcp *RPCProvider) RetryDisabledEndpoints(disabledEndpoints []*lavasession.RPCProviderEndpoint, retryCount int)
func (*RPCProvider) SetupEndpoint ¶
func (rpcp *RPCProvider) SetupEndpoint(ctx context.Context, rpcProviderEndpoint *lavasession.RPCProviderEndpoint) error
func (*RPCProvider) SetupProviderEndpoints ¶
func (rpcp *RPCProvider) SetupProviderEndpoints(rpcProviderEndpoints []*lavasession.RPCProviderEndpoint, parallel bool) (disabledEndpointsRet []*lavasession.RPCProviderEndpoint)
func (*RPCProvider) Start ¶
func (rpcp *RPCProvider) Start(ctx context.Context, txFactory tx.Factory, clientCtx client.Context, rpcProviderEndpoints []*lavasession.RPCProviderEndpoint, cache *performance.Cache, parallelConnections uint, metricsListenAddress string, rewardStoragePath string, rewardTTL time.Duration, shardID uint, rewardsSnapshotThreshold uint, rewardsSnapshotTimeoutSec uint) (err error)
type RPCProviderServer ¶
type RPCProviderServer struct {
// contains filtered or unexported fields
}
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, 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) 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, )
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, srv pairingtypes.Relayer_RelaySubscribeServer, chainMessage chainlib.ChainMessage, consumerAddress sdk.AccAddress, relaySession *lavasession.SingleProviderSession, relayNumber uint64) (subscribed bool, errRet 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 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) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.