Documentation ¶
Index ¶
- func CalcPrices(ctx sdk.Context, params types.Params, k keeper.Keeper) error
- func EndBlocker(ctx context.Context, k keeper.Keeper) error
- func Tally(ballot types.ExchangeRateBallot, rewardBand math.LegacyDec, ...) (math.LegacyDec, error)
- func VoteExtensionsEnabled(ctx sdk.Context) bool
- type AggregateExchangeRateVotes
- type OracleVoteExtension
- type PreBlockHandler
- type ProposalHandler
- type VoteExtensionHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EndBlocker ¶
EndBlocker is called at the end of every block
func Tally ¶
func Tally( ballot types.ExchangeRateBallot, rewardBand math.LegacyDec, validatorClaimMap map[string]types.Claim, incrementWin bool, ) (math.LegacyDec, error)
Tally calculates and returns the median. It sets the set of voters to be rewarded, i.e. voted within a reasonable spread from the weighted median to the store. Note, the ballot is sorted by ExchangeRate.
func VoteExtensionsEnabled ¶
VoteExtensionsEnabled determines if vote extensions are enabled for the current block.
Types ¶
type AggregateExchangeRateVotes ¶
type AggregateExchangeRateVotes struct { ExchangeRateVotes []oracletypes.AggregateExchangeRateVote ExtendedCommitInfo cometabci.ExtendedCommitInfo }
type OracleVoteExtension ¶
OracleVoteExtension defines the canonical vote extension structure.
type PreBlockHandler ¶
type PreBlockHandler struct {
// contains filtered or unexported fields
}
func NewPreBlockHandler ¶
func NewPreBlockHandler(logger log.Logger, keeper keeper.Keeper) *PreBlockHandler
func (*PreBlockHandler) PreBlocker ¶
func (h *PreBlockHandler) PreBlocker() sdk.PreBlocker
PreBlocker is run before finalize block to update the aggregrate exchange rate votes on the oracle module that were verified by the vote etension handler so that the exchange rate votes are available during the entire block execution (from BeginBlock).
type ProposalHandler ¶
type ProposalHandler struct {
// contains filtered or unexported fields
}
func NewProposalHandler ¶
func NewProposalHandler( logger log.Logger, oracleKeeper oraclekeeper.Keeper, stakingKeeper *stakingkeeper.Keeper, ) *ProposalHandler
func (*ProposalHandler) PrepareProposalHandler ¶
func (h *ProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler
PrepareProposalHandler is called only on the selected validator as "block proposer" (selected by CometBFT, read more about this process here: https://docs.cometbft.com/v0.38/spec/consensus/proposer-selection). The block proposer is in charge of creating the next block by selecting the transactions from the mempool, and in this method it will create an extra transaction using the vote extension from the previous block which are only available on the next height at which vote extensions were enabled.
func (*ProposalHandler) ProcessProposalHandler ¶
func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler
ProcessProposalHandler is called on all validators, and they can verify if the proposed block is valid. In case an invalid block is being proposed validators can reject it, causing a new round of PrepareProposal to happen. This step MUST be deterministic.
type VoteExtensionHandler ¶
type VoteExtensionHandler struct {
// contains filtered or unexported fields
}
func NewVoteExtensionHandler ¶
func NewVoteExtensionHandler( logger log.Logger, oracleKeeper keeper.Keeper, priceFeeder *pricefeeder.PriceFeeder, ) *VoteExtensionHandler
NewVoteExtensionHandler returns a new VoteExtensionHandler.
func (*VoteExtensionHandler) ExtendVoteHandler ¶
func (h *VoteExtensionHandler) ExtendVoteHandler() sdk.ExtendVoteHandler
ExtendVoteHandler creates an OracleVoteExtension using the prices fetched from the price feeder service. It will filter out exchange rates that are not part of the oracle module's accept list.
func (*VoteExtensionHandler) VerifyVoteExtensionHandler ¶
func (h *VoteExtensionHandler) VerifyVoteExtensionHandler() sdk.VerifyVoteExtensionHandler
VerifyVoteExtensionHandler validates the OracleVoteExtension created by the ExtendVoteHandler. It verifies that the vote extension can unmarshal correctly and is for the correct height.