Documentation ¶
Index ¶
- Constants
- Variables
- func CreateEventsCobraCommand() *cobra.Command
- func CreateRelayPaymentCSVCobraCommand() *cobra.Command
- func CreateTxCounterCobraCommand() *cobra.Command
- func GetLavaSpecWithRetry(ctx context.Context, specQueryClient spectypes.QueryClient) (*spectypes.QueryGetSpecResponse, error)
- func IsLavaNativeSpec(checked string) bool
- func RegisterForSpecUpdatesOrSetStaticSpec(ctx context.Context, chainParser chainlib.ChainParser, specPath string, ...) (err error)
- type ConsumerEmergencyTrackerInf
- type ConsumerStateTracker
- func (cst *ConsumerStateTracker) GetConsumerPolicy(ctx context.Context, consumerAddress, chainID string) (*plantypes.Policy, error)
- func (cst *ConsumerStateTracker) GetProtocolVersion(ctx context.Context) (*updaters.ProtocolVersionResponse, error)
- func (cst *ConsumerStateTracker) RegisterConsumerSessionManagerForPairingUpdates(ctx context.Context, ...)
- func (cst *ConsumerStateTracker) RegisterFinalizationConsensusForUpdates(ctx context.Context, ...)
- func (cst *ConsumerStateTracker) RegisterForDowntimeParamsUpdates(ctx context.Context, downtimeParamsUpdatable updaters.DowntimeParamsUpdatable) error
- func (cst *ConsumerStateTracker) RegisterForPairingUpdates(ctx context.Context, pairingUpdatable updaters.PairingUpdatable, specId string)
- func (cst *ConsumerStateTracker) RegisterForSpecUpdates(ctx context.Context, specUpdatable updaters.SpecUpdatable, ...) error
- func (cst *ConsumerStateTracker) RegisterForVersionUpdates(ctx context.Context, version *protocoltypes.Version, ...)
- func (cst *ConsumerStateTracker) TxConflictDetection(ctx context.Context, finalizationConflict *conflicttypes.FinalizationConflict, ...) error
- type ConsumerTxSender
- type ConsumerTxSenderInf
- type EmergencyTracker
- func (cs *EmergencyTracker) GetDowntimeParams() downtimev1.Params
- func (cs *EmergencyTracker) GetLatestVirtualEpoch() uint64
- func (cs *EmergencyTracker) GetVirtualEpoch(epoch uint64) uint64
- func (cs *EmergencyTracker) SetDowntimeParams(params downtimev1.Params)
- func (cs *EmergencyTracker) UpdateEpoch(epoch uint64)
- type EmergencyTrackerMetrics
- type ProviderRewards
- type ProviderStateTracker
- func (pst *ProviderStateTracker) EarliestBlockInMemory(ctx context.Context) (uint64, error)
- func (pst *ProviderStateTracker) GetAverageBlockTime() time.Duration
- func (pst *ProviderStateTracker) GetEpochSize(ctx context.Context) (uint64, error)
- func (pst *ProviderStateTracker) GetEpochSizeMultipliedByRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error)
- func (pst *ProviderStateTracker) GetMaxCuForUser(ctx context.Context, consumerAddress, chainID string, epoch uint64) (maxCu uint64, err error)
- func (pst *ProviderStateTracker) GetProtocolVersion(ctx context.Context) (*updaters.ProtocolVersionResponse, error)
- func (pst *ProviderStateTracker) GetRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error)
- func (pst *ProviderStateTracker) LatestBlock() int64
- func (pst *ProviderStateTracker) RegisterForDowntimeParamsUpdates(ctx context.Context, downtimeParamsUpdatable updaters.DowntimeParamsUpdatable) error
- func (pst *ProviderStateTracker) RegisterForEpochUpdates(ctx context.Context, epochUpdatable updaters.EpochUpdatable)
- func (pst *ProviderStateTracker) RegisterForSpecUpdates(ctx context.Context, specUpdatable updaters.SpecUpdatable, ...) error
- func (pst *ProviderStateTracker) RegisterForSpecVerifications(ctx context.Context, specVerifier updaters.SpecVerifier, chainId string) error
- func (pst *ProviderStateTracker) RegisterForVersionUpdates(ctx context.Context, version *protocoltypes.Version, ...)
- func (pst *ProviderStateTracker) RegisterPaymentUpdatableForPayments(ctx context.Context, paymentUpdatable updaters.PaymentUpdatable)
- func (pst *ProviderStateTracker) RegisterReliabilityManagerForVoteUpdates(ctx context.Context, voteUpdatable updaters.VoteUpdatable, ...)
- func (pst *ProviderStateTracker) SendVoteCommitment(voteID string, vote *reliabilitymanager.VoteData, specID string) error
- func (pst *ProviderStateTracker) SendVoteReveal(voteID string, vote *reliabilitymanager.VoteData, specID string) error
- func (pst *ProviderStateTracker) TxRelayPayment(ctx context.Context, relayRequests []*pairingtypes.RelaySession, ...) error
- func (pst *ProviderStateTracker) VerifyPairing(ctx context.Context, consumerAddress, providerAddress string, epoch uint64, ...) (valid bool, total int64, projectId string, err error)
- type ProviderTxSender
- func (pts *ProviderTxSender) SendVoteCommitment(ctx context.Context, voteID string, vote *reliabilitymanager.VoteData, ...) error
- func (pts *ProviderTxSender) SendVoteReveal(ctx context.Context, voteID string, vote *reliabilitymanager.VoteData, ...) error
- func (pts *ProviderTxSender) TxRelayPayment(ctx context.Context, relayRequests []*pairingtypes.RelaySession, ...) error
- func (pts *ProviderTxSender) UpdateEpoch(epoch uint64)
- type SpecUpdaterInf
- type StateTracker
- type TxSender
- type Updater
Constants ¶
const ( FlagTimeout = "timeout" FlagValue = "value" FlagEventName = "event" FlagBreak = "break" FlagHasAttributeName = "has-attribute" FlagShowAttributeName = "show-attribute" FlagReset = "reset" FlagDisableInteractiveShell = "disable-interactive" )
const ( BlocksToSaveLavaChainTracker = 1 // we only need the latest block TendermintConsensusParamsQuery = "consensus_params" MAINNET_SPEC = "LAVA" TESTNET_SPEC = "LAV1" )
const ( DefaultGasPrice = "0.00002" + commontypes.TokenDenom DefaultGasAdjustment = "3.0" // same account can continue failing the more providers you have under the same account // for example if you have a provider staked at 20 chains you will ask for 20 payments per epoch. // therefore currently our best solution is to continue retrying increasing sequence number until successful RETRY_INCORRECT_SEQUENCE = 100 )
Variables ¶
var ( // TODO: add a governance param change that indicates what spec id belongs to lava. LavaSpecOptions = []string{TESTNET_SPEC, MAINNET_SPEC} )
Functions ¶
func GetLavaSpecWithRetry ¶
func GetLavaSpecWithRetry(ctx context.Context, specQueryClient spectypes.QueryClient) (*spectypes.QueryGetSpecResponse, error)
func IsLavaNativeSpec ¶ added in v4.1.4
func RegisterForSpecUpdatesOrSetStaticSpec ¶
func RegisterForSpecUpdatesOrSetStaticSpec(ctx context.Context, chainParser chainlib.ChainParser, specPath string, rpcEndpoint lavasession.RPCEndpoint, specUpdaterInf SpecUpdaterInf) (err error)
Either register for spec updates or set spec for offline spec, used in both consumer and provider process
Types ¶
type ConsumerEmergencyTrackerInf ¶
type ConsumerEmergencyTrackerInf interface {
GetLatestVirtualEpoch() uint64
}
type ConsumerStateTracker ¶
type ConsumerStateTracker struct { StateQuery *updaters.ConsumerStateQuery ConsumerTxSenderInf *StateTracker ConsumerEmergencyTrackerInf // contains filtered or unexported fields }
ConsumerStateTracker CSTis a class for tracking consumer data from the lava blockchain, such as epoch changes. it allows also to query specific data form the blockchain and acts as a single place to send transactions
func NewConsumerStateTracker ¶
func NewConsumerStateTracker(ctx context.Context, txFactory tx.Factory, clientCtx client.Context, chainFetcher chaintracker.ChainFetcher, metrics *metrics.ConsumerMetricsManager, disableConflictTransactions bool) (ret *ConsumerStateTracker, err error)
func (*ConsumerStateTracker) GetConsumerPolicy ¶
func (*ConsumerStateTracker) GetProtocolVersion ¶
func (cst *ConsumerStateTracker) GetProtocolVersion(ctx context.Context) (*updaters.ProtocolVersionResponse, error)
func (*ConsumerStateTracker) RegisterConsumerSessionManagerForPairingUpdates ¶
func (cst *ConsumerStateTracker) RegisterConsumerSessionManagerForPairingUpdates(ctx context.Context, consumerSessionManager *lavasession.ConsumerSessionManager, staticProvidersList []*lavasession.RPCProviderEndpoint)
func (*ConsumerStateTracker) RegisterFinalizationConsensusForUpdates ¶
func (cst *ConsumerStateTracker) RegisterFinalizationConsensusForUpdates(ctx context.Context, finalizationConsensus *finalizationconsensus.FinalizationConsensus)
func (*ConsumerStateTracker) RegisterForDowntimeParamsUpdates ¶
func (cst *ConsumerStateTracker) RegisterForDowntimeParamsUpdates(ctx context.Context, downtimeParamsUpdatable updaters.DowntimeParamsUpdatable) error
func (*ConsumerStateTracker) RegisterForPairingUpdates ¶
func (cst *ConsumerStateTracker) RegisterForPairingUpdates(ctx context.Context, pairingUpdatable updaters.PairingUpdatable, specId string)
func (*ConsumerStateTracker) RegisterForSpecUpdates ¶
func (cst *ConsumerStateTracker) RegisterForSpecUpdates(ctx context.Context, specUpdatable updaters.SpecUpdatable, endpoint lavasession.RPCEndpoint) error
func (*ConsumerStateTracker) RegisterForVersionUpdates ¶
func (cst *ConsumerStateTracker) RegisterForVersionUpdates(ctx context.Context, version *protocoltypes.Version, versionValidator updaters.VersionValidationInf)
func (*ConsumerStateTracker) TxConflictDetection ¶
func (cst *ConsumerStateTracker) TxConflictDetection(ctx context.Context, finalizationConflict *conflicttypes.FinalizationConflict, responseConflict *conflicttypes.ResponseConflict, conflictHandler common.ConflictHandlerInterface) error
type ConsumerTxSender ¶
type ConsumerTxSender struct {
*TxSender
}
func NewConsumerTxSender ¶
func (*ConsumerTxSender) TxSenderConflictDetection ¶
func (ts *ConsumerTxSender) TxSenderConflictDetection(ctx context.Context, finalizationConflict *conflicttypes.FinalizationConflict, responseConflict *conflicttypes.ResponseConflict) error
type ConsumerTxSenderInf ¶
type ConsumerTxSenderInf interface {
TxSenderConflictDetection(ctx context.Context, finalizationConflict *conflicttypes.FinalizationConflict, responseConflict *conflicttypes.ResponseConflict) error
}
type EmergencyTracker ¶
type EmergencyTracker struct {
// contains filtered or unexported fields
}
func NewEmergencyTracker ¶
func NewEmergencyTracker(metrics EmergencyTrackerMetrics) (emergencyTracker *EmergencyTracker, emergencyCallback func(latestBlockTime time.Time))
func (*EmergencyTracker) GetDowntimeParams ¶
func (cs *EmergencyTracker) GetDowntimeParams() downtimev1.Params
func (*EmergencyTracker) GetLatestVirtualEpoch ¶
func (cs *EmergencyTracker) GetLatestVirtualEpoch() uint64
func (*EmergencyTracker) GetVirtualEpoch ¶
func (cs *EmergencyTracker) GetVirtualEpoch(epoch uint64) uint64
func (*EmergencyTracker) SetDowntimeParams ¶
func (cs *EmergencyTracker) SetDowntimeParams(params downtimev1.Params)
func (*EmergencyTracker) UpdateEpoch ¶
func (cs *EmergencyTracker) UpdateEpoch(epoch uint64)
type EmergencyTrackerMetrics ¶
type EmergencyTrackerMetrics interface {
SetVirtualEpoch(virtualEpoch uint64)
}
type ProviderRewards ¶
per chain per provider, accumulated cu
type ProviderStateTracker ¶
type ProviderStateTracker struct { StateQuery *updaters.ProviderStateQuery *StateTracker *EmergencyTracker // contains filtered or unexported fields }
ProviderStateTracker PST is a class for tracking provider data from the lava blockchain, such as epoch changes. it allows also to query specific data form the blockchain and acts as a single place to send transactions
func NewProviderStateTracker ¶
func NewProviderStateTracker(ctx context.Context, txFactory tx.Factory, clientCtx client.Context, chainFetcher chaintracker.ChainFetcher, metrics *metrics.ProviderMetricsManager) (ret *ProviderStateTracker, err error)
func (*ProviderStateTracker) EarliestBlockInMemory ¶
func (pst *ProviderStateTracker) EarliestBlockInMemory(ctx context.Context) (uint64, error)
func (*ProviderStateTracker) GetAverageBlockTime ¶
func (pst *ProviderStateTracker) GetAverageBlockTime() time.Duration
func (*ProviderStateTracker) GetEpochSize ¶
func (pst *ProviderStateTracker) GetEpochSize(ctx context.Context) (uint64, error)
func (*ProviderStateTracker) GetEpochSizeMultipliedByRecommendedEpochNumToCollectPayment ¶
func (pst *ProviderStateTracker) GetEpochSizeMultipliedByRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error)
func (*ProviderStateTracker) GetMaxCuForUser ¶
func (*ProviderStateTracker) GetProtocolVersion ¶
func (pst *ProviderStateTracker) GetProtocolVersion(ctx context.Context) (*updaters.ProtocolVersionResponse, error)
func (*ProviderStateTracker) GetRecommendedEpochNumToCollectPayment ¶
func (pst *ProviderStateTracker) GetRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error)
func (*ProviderStateTracker) LatestBlock ¶
func (pst *ProviderStateTracker) LatestBlock() int64
func (*ProviderStateTracker) RegisterForDowntimeParamsUpdates ¶
func (pst *ProviderStateTracker) RegisterForDowntimeParamsUpdates(ctx context.Context, downtimeParamsUpdatable updaters.DowntimeParamsUpdatable) error
func (*ProviderStateTracker) RegisterForEpochUpdates ¶
func (pst *ProviderStateTracker) RegisterForEpochUpdates(ctx context.Context, epochUpdatable updaters.EpochUpdatable)
func (*ProviderStateTracker) RegisterForSpecUpdates ¶
func (pst *ProviderStateTracker) RegisterForSpecUpdates(ctx context.Context, specUpdatable updaters.SpecUpdatable, endpoint lavasession.RPCEndpoint) error
func (*ProviderStateTracker) RegisterForSpecVerifications ¶
func (pst *ProviderStateTracker) RegisterForSpecVerifications(ctx context.Context, specVerifier updaters.SpecVerifier, chainId string) error
func (*ProviderStateTracker) RegisterForVersionUpdates ¶
func (pst *ProviderStateTracker) RegisterForVersionUpdates(ctx context.Context, version *protocoltypes.Version, versionValidator updaters.VersionValidationInf)
func (*ProviderStateTracker) RegisterPaymentUpdatableForPayments ¶
func (pst *ProviderStateTracker) RegisterPaymentUpdatableForPayments(ctx context.Context, paymentUpdatable updaters.PaymentUpdatable)
func (*ProviderStateTracker) RegisterReliabilityManagerForVoteUpdates ¶
func (pst *ProviderStateTracker) RegisterReliabilityManagerForVoteUpdates(ctx context.Context, voteUpdatable updaters.VoteUpdatable, endpointP *lavasession.RPCProviderEndpoint)
func (*ProviderStateTracker) SendVoteCommitment ¶
func (pst *ProviderStateTracker) SendVoteCommitment(voteID string, vote *reliabilitymanager.VoteData, specID string) error
func (*ProviderStateTracker) SendVoteReveal ¶
func (pst *ProviderStateTracker) SendVoteReveal(voteID string, vote *reliabilitymanager.VoteData, specID string) error
func (*ProviderStateTracker) TxRelayPayment ¶
func (pst *ProviderStateTracker) TxRelayPayment(ctx context.Context, relayRequests []*pairingtypes.RelaySession, description string, latestBlocks []*pairingtypes.LatestBlockReport) error
type ProviderTxSender ¶
type ProviderTxSender struct { *TxSender // contains filtered or unexported fields }
func NewProviderTxSender ¶
func (*ProviderTxSender) SendVoteCommitment ¶
func (pts *ProviderTxSender) SendVoteCommitment(ctx context.Context, voteID string, vote *reliabilitymanager.VoteData, specId string) error
func (*ProviderTxSender) SendVoteReveal ¶
func (pts *ProviderTxSender) SendVoteReveal(ctx context.Context, voteID string, vote *reliabilitymanager.VoteData, specId string) error
func (*ProviderTxSender) TxRelayPayment ¶
func (pts *ProviderTxSender) TxRelayPayment(ctx context.Context, relayRequests []*pairingtypes.RelaySession, description string, latestBlocks []*pairingtypes.LatestBlockReport) error
func (*ProviderTxSender) UpdateEpoch ¶
func (pts *ProviderTxSender) UpdateEpoch(epoch uint64)
type SpecUpdaterInf ¶
type SpecUpdaterInf interface {
RegisterForSpecUpdates(ctx context.Context, specUpdatable updaters.SpecUpdatable, endpoint lavasession.RPCEndpoint) error
}
type StateTracker ¶
type StateTracker struct { EventTracker *updaters.EventTracker AverageBlockTime time.Duration // contains filtered or unexported fields }
ConsumerStateTracker CSTis a class for tracking consumer data from the lava blockchain, such as epoch changes. it allows also to query specific data form the blockchain and acts as a single place to send transactions
func NewStateTracker ¶
func NewStateTracker(ctx context.Context, txFactory tx.Factory, stateQuery *updaters.StateQuery, chainFetcher chaintracker.ChainFetcher, blockNotFoundCallback func(latestBlockTime time.Time)) (ret *StateTracker, err error)
func (*StateTracker) GetAverageBlockTime ¶
func (st *StateTracker) GetAverageBlockTime() time.Duration
func (*StateTracker) GetEventTracker ¶
func (st *StateTracker) GetEventTracker() *updaters.EventTracker
For lavavisor access
func (*StateTracker) RegisterForUpdates ¶
func (st *StateTracker) RegisterForUpdates(ctx context.Context, updater Updater) Updater
func (*StateTracker) UpdateBlockTime ¶
func (st *StateTracker) UpdateBlockTime(blockTime time.Duration)
type TxSender ¶
type TxSender struct {
// contains filtered or unexported fields
}