Documentation ¶
Index ¶
- func DefaultDBProvider(ctx *DBContext) (dbm.DB, error)
- func LoadStateFromDBOrGenesisDocProvider(stateDB dbm.DB, genesisDocProvider GenesisDocProvider) (sm.State, *types.GenesisDoc, error)
- func ParseMisbehaviors(str string) (map[int64]cs.Misbehavior, error)
- type DBContext
- type DBProvider
- type FilePV
- func (pv *FilePV) GetAddress() types.Address
- func (pv *FilePV) GetPubKey() (crypto.PubKey, error)
- func (pv *FilePV) Reset()
- func (pv *FilePV) Save()
- func (pv *FilePV) SignProposal(chainID string, proposal *cmtproto.Proposal) error
- func (pv *FilePV) SignVote(chainID string, vote *cmtproto.Vote) error
- func (pv *FilePV) String() string
- type FilePVKey
- type FilePVLastSignState
- type GenesisDocProvider
- type MetricsProvider
- type Node
- func (n *Node) BlockStore() *store.BlockStore
- func (n *Node) Config() *cfg.Config
- func (n *Node) ConfigureRPC() error
- func (n *Node) ConsensusReactor() *cs.Reactor
- func (n *Node) ConsensusState() *cs.State
- func (n *Node) EventBus() *types.EventBus
- func (n *Node) EvidencePool() *evidence.Pool
- func (n *Node) GenesisDoc() *types.GenesisDoc
- func (n *Node) IsListening() bool
- func (n *Node) Listeners() []string
- func (n *Node) Mempool() mempl.Mempool
- func (n *Node) MempoolReactor() p2p.Reactor
- func (n *Node) NodeInfo() p2p.NodeInfo
- func (n *Node) OnStart() error
- func (n *Node) OnStop()
- func (n *Node) PEXReactor() *pex.Reactor
- func (n *Node) PrivValidator() types.PrivValidator
- func (n *Node) ProxyApp() proxy.AppConns
- func (n *Node) Switch() *p2p.Switch
- type Option
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDBProvider ¶
DefaultDBProvider returns a database using the DBBackend and DBDir specified in the ctx.Config.
func LoadStateFromDBOrGenesisDocProvider ¶
func LoadStateFromDBOrGenesisDocProvider( stateDB dbm.DB, genesisDocProvider GenesisDocProvider, ) (sm.State, *types.GenesisDoc, error)
LoadStateFromDBOrGenesisDocProvider attempts to load the state from the database, or creates one using the given genesisDocProvider and persists the result to the database. On success this also returns the genesis doc loaded through the given provider.
func ParseMisbehaviors ¶
func ParseMisbehaviors(str string) (map[int64]cs.Misbehavior, error)
ParseMisbehaviors is a util function that converts a comma separated string into a map of misbehaviors to be executed by the maverick node
Types ¶
type DBProvider ¶
DBProvider takes a DBContext and returns an instantiated DB.
type FilePV ¶
type FilePV struct { Key FilePVKey LastSignState FilePVLastSignState }
FilePV implements PrivValidator using data persisted to disk to prevent double signing. NOTE: the directories containing pv.Key.filePath and pv.LastSignState.filePath must already exist. It includes the LastSignature and LastSignBytes so we don't lose the signature if the process crashes after signing but before the resulting consensus message is processed.
func GenFilePV ¶
GenFilePV generates a new validator with randomly generated private key and sets the filePaths, but does not call Save().
func LoadFilePV ¶
LoadFilePV loads a FilePV from the filePaths. The FilePV handles double signing prevention by persisting data to the stateFilePath. If either file path does not exist, the program will exit.
func LoadFilePVEmptyState ¶
LoadFilePVEmptyState loads a FilePV from the given keyFilePath, with an empty LastSignState. If the keyFilePath does not exist, the program will exit.
func LoadOrGenFilePV ¶
LoadOrGenFilePV loads a FilePV from the given filePaths or else generates a new one and saves it to the filePaths.
func (*FilePV) GetAddress ¶
GetAddress returns the address of the validator. Implements PrivValidator.
func (*FilePV) GetPubKey ¶
GetPubKey returns the public key of the validator. Implements PrivValidator.
func (*FilePV) Reset ¶
func (pv *FilePV) Reset()
Reset resets all fields in the FilePV. NOTE: Unsafe!
func (*FilePV) SignProposal ¶
SignProposal signs a canonical representation of the proposal, along with the chainID. Implements PrivValidator.
type FilePVKey ¶
type FilePVKey struct { Address types.Address `json:"address"` PubKey crypto.PubKey `json:"pub_key"` PrivKey crypto.PrivKey `json:"priv_key"` // contains filtered or unexported fields }
FilePVKey stores the immutable part of PrivValidator.
type FilePVLastSignState ¶
type FilePVLastSignState struct { Height int64 `json:"height"` Round int32 `json:"round"` Step int8 `json:"step"` Signature []byte `json:"signature,omitempty"` SignBytes cmtbytes.HexBytes `json:"signbytes,omitempty"` // contains filtered or unexported fields }
FilePVLastSignState stores the mutable part of PrivValidator.
func (*FilePVLastSignState) CheckHRS ¶
CheckHRS checks the given height, round, step (HRS) against that of the FilePVLastSignState. It returns an error if the arguments constitute a regression, or if they match but the SignBytes are empty. The returned boolean indicates whether the last Signature should be reused - it returns true if the HRS matches the arguments and the SignBytes are not empty (indicating we have already signed for this HRS, and can reuse the existing signature). It panics if the HRS matches the arguments, there's a SignBytes, but no Signature.
func (*FilePVLastSignState) Save ¶
func (lss *FilePVLastSignState) Save()
Save persists the FilePvLastSignState to its filePath.
type GenesisDocProvider ¶
type GenesisDocProvider func() (*types.GenesisDoc, error)
GenesisDocProvider returns a GenesisDoc. It allows the GenesisDoc to be pulled from sources other than the filesystem, for instance from a distributed key-value store cluster.
func DefaultGenesisDocProviderFunc ¶
func DefaultGenesisDocProviderFunc(config *cfg.Config) GenesisDocProvider
DefaultGenesisDocProviderFunc returns a GenesisDocProvider that loads the GenesisDoc from the config.GenesisFile() on the filesystem.
type MetricsProvider ¶
type MetricsProvider func(chainID string) (*consensus.Metrics, *p2p.Metrics, *mempl.Metrics, *sm.Metrics)
MetricsProvider returns a consensus, p2p and mempool Metrics.
func DefaultMetricsProvider ¶
func DefaultMetricsProvider(config *cfg.InstrumentationConfig) MetricsProvider
DefaultMetricsProvider returns Metrics build using Prometheus client library if Prometheus is enabled. Otherwise, it returns no-op Metrics.
type Node ¶
type Node struct { service.BaseService // contains filtered or unexported fields }
Node is the highest level interface to a full CometBFT node. It includes all configuration information and running services.
func DefaultNewNode ¶
func DefaultNewNode(config *cfg.Config, logger log.Logger, misbehaviors map[int64]cs.Misbehavior) (*Node, error)
DefaultNewNode returns a CometBFT node with default settings for the PrivValidator, ClientCreator, GenesisDoc, and DBProvider. It implements NodeProvider.
func NewNode ¶
func NewNode(config *cfg.Config, privValidator types.PrivValidator, nodeKey *p2p.NodeKey, clientCreator proxy.ClientCreator, genesisDocProvider GenesisDocProvider, dbProvider DBProvider, metricsProvider MetricsProvider, logger log.Logger, misbehaviors map[int64]cs.Misbehavior, options ...Option, ) (*Node, error)
NewNode returns a new, ready to go, CometBFT Node.
func (*Node) BlockStore ¶
func (n *Node) BlockStore() *store.BlockStore
BlockStore returns the Node's BlockStore.
func (*Node) ConfigureRPC ¶
ConfigureRPC makes sure RPC has all the objects it needs to operate.
func (*Node) ConsensusReactor ¶
ConsensusReactor returns the Node's ConsensusReactor.
func (*Node) ConsensusState ¶
ConsensusState returns the Node's ConsensusState.
func (*Node) EvidencePool ¶
EvidencePool returns the Node's EvidencePool.
func (*Node) GenesisDoc ¶
func (n *Node) GenesisDoc() *types.GenesisDoc
GenesisDoc returns the Node's GenesisDoc.
func (*Node) IsListening ¶
func (*Node) MempoolReactor ¶
MempoolReactor returns the Node's mempool reactor.
func (*Node) PEXReactor ¶
PEXReactor returns the Node's PEXReactor. It returns nil if PEX is disabled.
func (*Node) PrivValidator ¶
func (n *Node) PrivValidator() types.PrivValidator
PrivValidator returns the Node's PrivValidator. XXX: for convenience only!
type Option ¶
type Option func(*Node)
Option sets a parameter for the node.
func CustomReactors ¶
CustomReactors allows you to add custom reactors (name -> p2p.Reactor) to the node's Switch.
WARNING: using any name from the below list of the existing reactors will result in replacing it with the custom one.
- MEMPOOL
- BLOCKCHAIN
- CONSENSUS
- EVIDENCE
- PEX
- STATESYNC
func StateProvider ¶
func StateProvider(stateProvider statesync.StateProvider) Option
StateProvider overrides the state provider used by state sync to retrieve trusted app hashes and build a State object for bootstrapping the node. WARNING: this interface is considered unstable and subject to change.