aggregator

package
v0.0.0-...-23a414b Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchExtCommitInfoFromProposal

func FetchExtCommitInfoFromProposal(
	proposal [][]byte,
	extCommitCodec codec.ExtendedCommitCodec,
) (abci.ExtendedCommitInfo, error)

Types

type MedianAggregator

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

func (*MedianAggregator) AggregateDaemonVEIntoFinalPricesAndConversionRate

func (ma *MedianAggregator) AggregateDaemonVEIntoFinalPricesAndConversionRate(
	ctx sdk.Context,
	votes []Vote,
) (map[string]veaggregator.AggregatorPricePair, *big.Int, error)

type Vote

type Vote struct {
	// ConsAddress is the validator that submitted the vote extension.
	ConsAddress sdk.ConsAddress
	// OracleVoteExtension
	DaemonVoteExtension vetypes.DaemonVoteExtension
}

Vote encapsulates the validator and oracle data contained within a vote extension.

func FetchVotesFromExtCommitInfo

func FetchVotesFromExtCommitInfo(
	extCommitInfo abci.ExtendedCommitInfo,
	veCodec codec.VoteExtensionCodec,
) ([]Vote, error)

func GetDaemonVotesFromBlock

func GetDaemonVotesFromBlock(
	proposal [][]byte,
	veCodec codec.VoteExtensionCodec,
	extCommitCodec codec.ExtendedCommitCodec,
) ([]Vote, error)

type VoteAggregator

type VoteAggregator interface {

	// In order for a currency pair to be included in the final oracle price, the currency
	// pair must be provided by a super-majority (2/3+) of validators. This is enforced by the
	// price aggregator but can be replaced by the application.
	AggregateDaemonVEIntoFinalPricesAndConversionRate(ctx sdk.Context, votes []Vote) (map[string]veaggregator.AggregatorPricePair, *big.Int, error)
}

VoteAggregator is an interface that defines the methods for aggregating oracle votes into a set of prices. This object holds both the aggregated price resulting from a given set of votes, and the prices reported by each validator.

func NewVeAggregator

func NewVeAggregator(
	logger log.Logger,
	pricekeeper pk.Keeper,
	ratelimitKeeper ratelimitkeeper.Keeper,
	pricesAggregateFn veaggregator.PricesAggregateFn,
	conversionRateAggregateFn veaggregator.ConversionRateAggregateFn,
) VoteAggregator

Jump to

Keyboard shortcuts

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