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 ¶
- type App
- type ExtendVoteHandler
- type OracleVoteExtension
- type ProposalHandler
- type Provider
- type ProviderAggregator
- type RequestExtendVote
- type RequestVerifyVoteExtension
- type ResponseExtendVote
- type ResponseVerifyVoteExtension
- type ResponseVerifyVoteExtension_VerifyStatus
- type StakeWeightedPrices
- type VerifyVoteExtensionHandler
- type VoteExtHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtendVoteHandler ¶
type ExtendVoteHandler func(sdk.Context, *RequestExtendVote) (*ResponseExtendVote, error)
ExtendVoteHandler defines a function type alias for extending a pre-commit vote.
type OracleVoteExtension ¶
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 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