statetracker

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: Apache-2.0 Imports: 25 Imported by: ? modules, 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

Index

Constants

View Source
const (
	CacheMaxCost                = 10 * 1024 // 10K cost
	CacheNumCounters            = 100000    // expect 10K items
	DefaultTimeToLiveExpiration = 30 * time.Minute
	PairingRespKey              = "pairing-resp"
	VerifyPairingRespKey        = "verify-pairing-resp"
	VrfPkAndMaxCuResponseKey    = "vrf-and-max-cu-resp"
)
View Source
const (
	BlocksToSaveLavaChainTracker   = 1 // we only need the latest block
	TendermintConsensusParamsQuery = "consensus_params"
)
View Source
const (
	CallbackKeyForEpochUpdate = "epoch-update"
)
View Source
const (
	CallbackKeyForFinalizationConsensusUpdate = "finalization-consensus-update"
)
View Source
const (
	CallbackKeyForPairingUpdate = "pairing-update"
)
View Source
const (
	CallbackKeyForPaymentUpdate = "payment-update"
)
View Source
const (
	CallbackKeyForVoteUpdate = "vote-update"
)
View Source
const (
	RETRY_INCORRECT_SEQUENCE = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsumerStateQuery added in v0.5.1

type ConsumerStateQuery struct {
	StateQuery
	// contains filtered or unexported fields
}

func NewConsumerStateQuery added in v0.5.1

func NewConsumerStateQuery(ctx context.Context, clientCtx client.Context) *ConsumerStateQuery

func (*ConsumerStateQuery) GetMaxCUForUser added in v0.5.1

func (csq *ConsumerStateQuery) GetMaxCUForUser(ctx context.Context, chainID string, epoch uint64) (maxCu uint64, err error)

func (*ConsumerStateQuery) GetPairing added in v0.5.1

func (csq *ConsumerStateQuery) GetPairing(ctx context.Context, chainID string, latestBlock int64) (pairingList []epochstoragetypes.StakeEntry, epoch uint64, nextBlockForUpdate uint64, errRet error)

type ConsumerStateTracker

type ConsumerStateTracker struct {
	*StateTracker
	// 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) (ret *ConsumerStateTracker, err error)

func (*ConsumerStateTracker) RegisterChainParserForSpecUpdates added in v0.5.0

func (cst *ConsumerStateTracker) RegisterChainParserForSpecUpdates(ctx context.Context, chainParser chainlib.ChainParser, chainID string) error

func (*ConsumerStateTracker) RegisterConsumerSessionManagerForPairingUpdates

func (cst *ConsumerStateTracker) RegisterConsumerSessionManagerForPairingUpdates(ctx context.Context, consumerSessionManager *lavasession.ConsumerSessionManager)

func (*ConsumerStateTracker) RegisterFinalizationConsensusForUpdates

func (cst *ConsumerStateTracker) RegisterFinalizationConsensusForUpdates(ctx context.Context, finalizationConsensus *lavaprotocol.FinalizationConsensus)

func (*ConsumerStateTracker) TxConflictDetection

func (cst *ConsumerStateTracker) TxConflictDetection(ctx context.Context, finalizationConflict *conflicttypes.FinalizationConflict, responseConflict *conflicttypes.ResponseConflict, sameProviderConflict *conflicttypes.FinalizationConflict) error

type ConsumerTxSender

type ConsumerTxSender struct {
	*TxSender
}

func NewConsumerTxSender

func NewConsumerTxSender(ctx context.Context, clientCtx client.Context, txFactory tx.Factory) (ret *ConsumerTxSender, err error)

func (*ConsumerTxSender) TxConflictDetection added in v0.5.1

func (ts *ConsumerTxSender) TxConflictDetection(ctx context.Context, finalizationConflict *conflicttypes.FinalizationConflict, responseConflict *conflicttypes.ResponseConflict, sameProviderConflict *conflicttypes.FinalizationConflict) error

type EpochUpdatable added in v0.5.0

type EpochUpdatable interface {
	UpdateEpoch(epoch uint64)
}

type EpochUpdater added in v0.9.0

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

func NewEpochUpdater added in v0.9.0

func NewEpochUpdater(stateQuery *ProviderStateQuery) *EpochUpdater

func (*EpochUpdater) RegisterEpochUpdatable added in v0.9.0

func (eu *EpochUpdater) RegisterEpochUpdatable(ctx context.Context, epochUpdatable EpochUpdatable)

func (*EpochUpdater) Update added in v0.9.0

func (eu *EpochUpdater) Update(latestBlock int64)

func (*EpochUpdater) UpdaterKey added in v0.9.0

func (eu *EpochUpdater) UpdaterKey() string

type FinalizationConsensusUpdater added in v0.4.5

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

func NewFinalizationConsensusUpdater added in v0.4.5

func NewFinalizationConsensusUpdater(stateQuery *ConsumerStateQuery) *FinalizationConsensusUpdater

func (*FinalizationConsensusUpdater) RegisterFinalizationConsensus added in v0.4.5

func (fcu *FinalizationConsensusUpdater) RegisterFinalizationConsensus(finalizationConsensus *lavaprotocol.FinalizationConsensus)

func (*FinalizationConsensusUpdater) Update added in v0.4.5

func (fcu *FinalizationConsensusUpdater) Update(latestBlock int64)

func (*FinalizationConsensusUpdater) UpdaterKey added in v0.4.5

func (fcu *FinalizationConsensusUpdater) UpdaterKey() string

type PairingUpdater added in v0.4.5

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

func NewPairingUpdater added in v0.4.5

func NewPairingUpdater(stateQuery *ConsumerStateQuery) *PairingUpdater

func (*PairingUpdater) RegisterPairing added in v0.4.5

func (pu *PairingUpdater) RegisterPairing(ctx context.Context, consumerSessionManager *lavasession.ConsumerSessionManager) error

func (*PairingUpdater) Update added in v0.4.5

func (pu *PairingUpdater) Update(latestBlock int64)

func (*PairingUpdater) UpdaterKey added in v0.4.5

func (pu *PairingUpdater) UpdaterKey() string

type PaymentUpdatable added in v0.9.0

type PaymentUpdatable interface {
	PaymentHandler(*rewardserver.PaymentRequest)
	Description() string
}

type PaymentUpdater added in v0.9.0

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

func NewPaymentUpdater added in v0.9.0

func NewPaymentUpdater(stateQuery *ProviderStateQuery) *PaymentUpdater

func (*PaymentUpdater) RegisterPaymentUpdatable added in v0.9.0

func (pu *PaymentUpdater) RegisterPaymentUpdatable(ctx context.Context, paymentUpdatable *PaymentUpdatable)

func (*PaymentUpdater) Update added in v0.9.0

func (pu *PaymentUpdater) Update(latestBlock int64)

func (*PaymentUpdater) UpdaterKey added in v0.9.0

func (pu *PaymentUpdater) UpdaterKey() string

type ProviderStateQuery added in v0.9.0

type ProviderStateQuery struct {
	StateQuery
	// contains filtered or unexported fields
}

func NewProviderStateQuery added in v0.9.0

func NewProviderStateQuery(ctx context.Context, clientCtx client.Context) *ProviderStateQuery

func (*ProviderStateQuery) CurrentEpochStart added in v0.9.0

func (psq *ProviderStateQuery) CurrentEpochStart(ctx context.Context) (uint64, error)

func (*ProviderStateQuery) EarliestBlockInMemory added in v0.9.0

func (psq *ProviderStateQuery) EarliestBlockInMemory(ctx context.Context) (uint64, error)

func (*ProviderStateQuery) GetEpochSize added in v0.9.0

func (psq *ProviderStateQuery) GetEpochSize(ctx context.Context) (uint64, error)

func (*ProviderStateQuery) GetEpochSizeMultipliedByRecommendedEpochNumToCollectPayment added in v0.9.0

func (psq *ProviderStateQuery) GetEpochSizeMultipliedByRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error)

func (*ProviderStateQuery) GetProvidersCountForConsumer added in v0.9.0

func (psq *ProviderStateQuery) GetProvidersCountForConsumer(ctx context.Context, consumerAddress string, epoch uint64, chainID string) (uint32, error)

func (*ProviderStateQuery) GetRecommendedEpochNumToCollectPayment added in v0.9.0

func (psq *ProviderStateQuery) GetRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error)

func (*ProviderStateQuery) GetVrfPkAndMaxCuForUser added in v0.9.0

func (psq *ProviderStateQuery) GetVrfPkAndMaxCuForUser(ctx context.Context, consumerAddress string, chainID string, epoch uint64) (vrfPk *utils.VrfPubKey, maxCu uint64, err error)

func (*ProviderStateQuery) PaymentEvents added in v0.9.0

func (psq *ProviderStateQuery) PaymentEvents(ctx context.Context, latestBlock int64) (payments []*rewardserver.PaymentRequest, err error)

func (*ProviderStateQuery) VerifyPairing added in v0.9.0

func (psq *ProviderStateQuery) VerifyPairing(ctx context.Context, consumerAddress string, providerAddress string, epoch uint64, chainID string) (valid bool, index int64, err error)

func (*ProviderStateQuery) VoteEvents added in v0.9.0

func (psq *ProviderStateQuery) VoteEvents(ctx context.Context, latestBlock int64) (votes []*reliabilitymanager.VoteParams, err error)

type ProviderStateTracker

type ProviderStateTracker struct {
	*StateTracker
	// 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) (ret *ProviderStateTracker, err error)

func (*ProviderStateTracker) EarliestBlockInMemory

func (pst *ProviderStateTracker) EarliestBlockInMemory(ctx context.Context) (uint64, error)

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) GetProvidersCountForConsumer added in v0.9.0

func (pst *ProviderStateTracker) GetProvidersCountForConsumer(ctx context.Context, consumerAddress string, epoch uint64, chainID string) (uint32, error)

func (*ProviderStateTracker) GetRecommendedEpochNumToCollectPayment

func (pst *ProviderStateTracker) GetRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error)

func (*ProviderStateTracker) GetVrfPkAndMaxCuForUser added in v0.9.0

func (pst *ProviderStateTracker) GetVrfPkAndMaxCuForUser(ctx context.Context, consumerAddress string, chainID string, epoch uint64) (vrfPk *utils.VrfPubKey, maxCu uint64, err error)

func (*ProviderStateTracker) LatestBlock

func (pst *ProviderStateTracker) LatestBlock() int64

func (*ProviderStateTracker) RegisterChainParserForSpecUpdates added in v0.5.0

func (pst *ProviderStateTracker) RegisterChainParserForSpecUpdates(ctx context.Context, chainParser chainlib.ChainParser, chainID string) error

func (*ProviderStateTracker) RegisterForEpochUpdates

func (pst *ProviderStateTracker) RegisterForEpochUpdates(ctx context.Context, epochUpdatable EpochUpdatable)

func (*ProviderStateTracker) RegisterPaymentUpdatableForPayments

func (pst *ProviderStateTracker) RegisterPaymentUpdatableForPayments(ctx context.Context, paymentUpdatable PaymentUpdatable)

func (*ProviderStateTracker) RegisterReliabilityManagerForVoteUpdates

func (pst *ProviderStateTracker) RegisterReliabilityManagerForVoteUpdates(ctx context.Context, voteUpdatable VoteUpdatable, endpointP *lavasession.RPCProviderEndpoint)

func (*ProviderStateTracker) SendVoteCommitment

func (pst *ProviderStateTracker) SendVoteCommitment(voteID string, vote *reliabilitymanager.VoteData) error

func (*ProviderStateTracker) SendVoteReveal

func (pst *ProviderStateTracker) SendVoteReveal(voteID string, vote *reliabilitymanager.VoteData) error

func (*ProviderStateTracker) TxRelayPayment

func (pst *ProviderStateTracker) TxRelayPayment(ctx context.Context, relayRequests []*pairingtypes.RelaySession, dataReliabilityProofs []*pairingtypes.VRFData, description string) error

func (*ProviderStateTracker) VerifyPairing

func (pst *ProviderStateTracker) VerifyPairing(ctx context.Context, consumerAddress string, providerAddress string, epoch uint64, chainID string) (valid bool, index int64, err error)

type ProviderTxSender

type ProviderTxSender struct {
	*TxSender
}

func NewProviderTxSender

func NewProviderTxSender(ctx context.Context, clientCtx client.Context, txFactory tx.Factory) (ret *ProviderTxSender, err error)

func (*ProviderTxSender) SendVoteCommitment

func (pts *ProviderTxSender) SendVoteCommitment(voteID string, vote *reliabilitymanager.VoteData) error

func (*ProviderTxSender) SendVoteReveal

func (pts *ProviderTxSender) SendVoteReveal(voteID string, vote *reliabilitymanager.VoteData) error

func (*ProviderTxSender) TxRelayPayment

func (pts *ProviderTxSender) TxRelayPayment(ctx context.Context, relayRequests []*pairingtypes.RelaySession, dataReliabilityProofs []*pairingtypes.VRFData, description string) error

type StateQuery added in v0.4.5

type StateQuery struct {
	SpecQueryClient         spectypes.QueryClient
	PairingQueryClient      pairingtypes.QueryClient
	EpochStorageQueryClient epochstoragetypes.QueryClient
	ResponsesCache          *ristretto.Cache
}

func NewStateQuery added in v0.5.1

func NewStateQuery(ctx context.Context, clientCtx client.Context) *StateQuery

func (*StateQuery) GetSpec added in v0.9.0

func (csq *StateQuery) GetSpec(ctx context.Context, chainID string) (*spectypes.Spec, error)

type StateTracker

type StateTracker struct {
	// 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, clientCtx client.Context, chainFetcher chaintracker.ChainFetcher) (ret *StateTracker, err error)

func (*StateTracker) RegisterForUpdates

func (cst *StateTracker) RegisterForUpdates(ctx context.Context, updater Updater) Updater

type TxSender

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

func NewTxSender

func NewTxSender(ctx context.Context, clientCtx client.Context, txFactory tx.Factory) (ret *TxSender, err error)

func (*TxSender) SimulateAndBroadCastTxWithRetryOnSeqMismatch

func (ts *TxSender) SimulateAndBroadCastTxWithRetryOnSeqMismatch(msg sdk.Msg, checkProfitability bool) error

type Updater

type Updater interface {
	Update(int64)
	UpdaterKey() string
}

type VoteUpdatable added in v0.9.0

type VoteUpdatable interface {
	VoteHandler(*reliabilitymanager.VoteParams, uint64)
}

type VoteUpdater added in v0.9.0

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

func NewVoteUpdater added in v0.9.0

func NewVoteUpdater(stateQuery *ProviderStateQuery) *VoteUpdater

func (*VoteUpdater) RegisterVoteUpdatable added in v0.9.0

func (vu *VoteUpdater) RegisterVoteUpdatable(ctx context.Context, voteUpdatable *VoteUpdatable, endpoint lavasession.RPCEndpoint)

func (*VoteUpdater) Update added in v0.9.0

func (vu *VoteUpdater) Update(latestBlock int64)

func (*VoteUpdater) UpdaterKey added in v0.9.0

func (vu *VoteUpdater) UpdaterKey() string

Jump to

Keyboard shortcuts

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