abci

package
v0.0.0-...-f66a822 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

NOTE: These types are TEMPORARY and will be removed once the Cosmos SDK v0.48 alpha/RC tag is released. These types are simply used to prototype and develop against.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	GetFinalizeBlockStateCtx() sdk.Context
}

type ExtendVoteHandler

type ExtendVoteHandler func(sdk.Context, *RequestExtendVote) (*ResponseExtendVote, error)

ExtendVoteHandler defines a function type alias for extending a pre-commit vote.

type OracleVoteExtension

type OracleVoteExtension struct {
	Height int64
	Prices map[string]sdk.Dec
}

OracleVoteExtension defines the canonical vote extension structure.

type ProposalHandler

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

func (*ProposalHandler) PrepareProposal

func (h *ProposalHandler) PrepareProposal() sdk.PrepareProposalHandler

func (*ProposalHandler) ProcessProposal

func (h *ProposalHandler) ProcessProposal() sdk.ProcessProposalHandler

type Provider

type Provider interface {
	GetTickerPrices(...keepers.CurrencyPair) (map[string]keepers.TickerPrice, error)
	GetCandlePrices(...keepers.CurrencyPair) (map[string][]keepers.CandlePrice, error)
}

Provider defines an interface for fetching prices and candles for a given set of currency pairs. The provider is presumed to be a trusted source of prices.

type ProviderAggregator

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

ProviderAggregator is a simple aggregator for provider prices and candles. It is thread-safe since it is assumed to be called concurrently in price fetching goroutines, i.e. ExtendVote.

func NewProviderAggregator

func NewProviderAggregator() *ProviderAggregator

func (*ProviderAggregator) SetProviderTickerPricesAndCandles

func (p *ProviderAggregator) SetProviderTickerPricesAndCandles(
	providerName string,
	prices map[string]keepers.TickerPrice,
	candles map[string][]keepers.CandlePrice,
	pair keepers.CurrencyPair,
) bool

type RequestExtendVote

type RequestExtendVote struct {
	// the hash of the block  that this vote may be referring to
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// the height of the extended vote
	Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
}

type RequestVerifyVoteExtension

type RequestVerifyVoteExtension struct {
	// the hash of the block that this received vote corresponds to
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// the validator that signed the vote extension
	ValidatorAddress []byte `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"`
	Height           int64  `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
	VoteExtension    []byte `protobuf:"bytes,4,opt,name=vote_extension,json=voteExtension,proto3" json:"vote_extension,omitempty"`
}

type ResponseExtendVote

type ResponseExtendVote struct {
	VoteExtension []byte `protobuf:"bytes,1,opt,name=vote_extension,json=voteExtension,proto3" json:"vote_extension,omitempty"`
}

type ResponseVerifyVoteExtension

type ResponseVerifyVoteExtension struct {
	Status ResponseVerifyVoteExtension_VerifyStatus `` /* 128-byte string literal not displayed */
}

type ResponseVerifyVoteExtension_VerifyStatus

type ResponseVerifyVoteExtension_VerifyStatus int32
const (
	ResponseVerifyVoteExtension_UNKNOWN ResponseVerifyVoteExtension_VerifyStatus = 0
	ResponseVerifyVoteExtension_ACCEPT  ResponseVerifyVoteExtension_VerifyStatus = 1
	// Rejecting the vote extension will reject the entire precommit by the sender.
	// Incorrectly implementing this thus has liveness implications as it may affect
	// CometBFT's ability to receive 2/3+ valid votes to finalize the block.
	// Honest nodes should never be rejected.
	ResponseVerifyVoteExtension_REJECT ResponseVerifyVoteExtension_VerifyStatus = 2
)

type StakeWeightedPrices

type StakeWeightedPrices struct {
	StakeWeightedPrices map[string]sdk.Dec
	ExtendedCommitInfo  abci.ExtendedCommitInfo
}

StakeWeightedPrices defines the structure a proposer should use to calculate and submit the stake-weighted prices for a given set of supported currency pairs, in addition to the vote extensions used to calculate them. This is so validators can verify the proposer's calculations.

type VerifyVoteExtensionHandler

type VerifyVoteExtensionHandler func(sdk.Context, *RequestVerifyVoteExtension) (*ResponseVerifyVoteExtension, error)

VerifyVoteExtensionHandler defines a function type alias for verifying a pre-commit vote extension.

type VoteExtHandler

type VoteExtHandler struct {
	FauxOracleKeeper keepers.FauxOracleKeeper
	// contains filtered or unexported fields
}

VoteExtHandler defines a handler which implements the ExtendVote and VerifyVoteExtension ABCI methods. This handler is to be instantiated and set on the BaseApp when constructing an application.

For demo purposes, we presume the the application, via some module, maintains a list of asset pairs (base/quote) that it will produce and accept votes for.

For each asset pair, to produce a vote extension, the handler will fetch the latest prices from a trusted set of oracle sources, serialize this in a structure the application can unmarshal and understand.

For each incoming vote extension that CometBFT asks us to verify, we will ensure it is within some safe range of the latest price we have seen for those assets.

func (*VoteExtHandler) ExtendVoteHandler

func (h *VoteExtHandler) ExtendVoteHandler() ExtendVoteHandler

func (*VoteExtHandler) VerifyVoteExtensionHandler

func (h *VoteExtHandler) VerifyVoteExtensionHandler() VerifyVoteExtensionHandler

Jump to

Keyboard shortcuts

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