abci

package
v0.5.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcPrices

func CalcPrices(ctx sdk.Context, params types.Params, k keeper.Keeper) error

func EndBlocker

func EndBlocker(ctx context.Context, k keeper.Keeper) error

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

func VoteExtensionsEnabled(ctx sdk.Context) bool

VoteExtensionsEnabled determines if vote extensions are enabled for the current block.

Types

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,
) *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.

Jump to

Keyboard shortcuts

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