Documentation ¶
Index ¶
- Constants
- Variables
- func AddQueryFlagsToCmd(cmd *cobra.Command)
- func GetConsensusParams[T transaction.Tx](ctx context.Context, app handlers.AppManager[T]) (*cmtproto.ConsensusParams, error)
- func GetSnapshotStore(rootDir string) (*snapshots.Store, error)
- func QueryBlockCmd() *cobra.Command
- func QueryBlockResultsCmd() *cobra.Command
- func QueryBlocksCmd() *cobra.Command
- func RawTx(tx []byte) transaction.Tx
- func ShowAddressCmd() *cobra.Command
- func ShowNodeIDCmd() *cobra.Command
- func ShowValidatorCmd() *cobra.Command
- func StatusCommand() *cobra.Command
- func ToSDKCommitInfo(commit abci.CommitInfo) *comet.CommitInfo
- func ToSDKEvidence(ev []abci.Misbehavior) []*comet.Evidence
- func ToSDKExtendedCommitInfo(commit abci.ExtendedCommitInfo) comet.CommitInfo
- func ValidateVoteExtensions[T transaction.Tx](ctx context.Context, app handlers.AppManager[T], chainID string, ...) error
- func VersionCmd() *cobra.Command
- type AppCodecs
- type AppTomlConfig
- type CfgOption
- type CometBFTServer
- func (s *CometBFTServer[T]) BootstrapStateCmd() *cobra.Command
- func (s *CometBFTServer[T]) CLICommands() serverv2.CLIConfig
- func (s *CometBFTServer[T]) Config() any
- func (s *CometBFTServer[T]) GRPCServiceRegistrar(clientCtx client.Context, cfg server.ConfigMap) func(srv *grpc.Server) error
- func (s *CometBFTServer[T]) Name() string
- func (s *CometBFTServer[T]) Start(ctx context.Context) error
- func (s *CometBFTServer[T]) StartCmdFlags() *pflag.FlagSet
- func (s *CometBFTServer[T]) Stop(context.Context) error
- func (s *CometBFTServer[T]) WriteCustomConfigAt(configPath string) error
- type Config
- type InjectedTx
- type ServerOptions
Constants ¶
const ( QueryPathApp = "app" QueryPathP2P = "p2p" QueryPathStore = "store" )
const ( FlagQuery = "query" FlagType = "type" FlagOrderBy = "order_by" FlagChainID = "chain-id" FlagNode = "node" FlagGRPC = "grpc-addr" FlagGRPCInsecure = "grpc-insecure" FlagHeight = "height" FlagPage = "page" FlagLimit = "limit" FlagOutput = "output" TypeHash = "hash" TypeHeight = "height" )
Query flags
const ( OutputFormatJSON = "json" OutputFormatText = "text" )
List of supported output formats
const ServerName = "comet"
Variables ¶
var ( Standalone = prefix("standalone") FlagAddress = prefix("address") FlagTransport = prefix("transport") FlagHaltHeight = prefix("halt-height") FlagHaltTime = prefix("halt-time") FlagTrace = prefix("trace") FlagMempoolMaxTxs = prefix("mempool.max-txs") )
Server flags
var CometBFTAutoCLIDescriptor = &autocliv1.ServiceCommandDescriptor{ Service: cmtv1beta1.Service_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "GetNodeInfo", Use: "node-info", Short: "Query the current node info", }, { RpcMethod: "GetSyncing", Use: "syncing", Short: "Query node syncing status", }, { RpcMethod: "GetLatestBlock", Use: "block-latest", Short: "Query for the latest committed block", }, { RpcMethod: "GetBlockByHeight", Use: "block-by-height <height>", Short: "Query for a committed block by height", Long: "Query for a specific committed block using the CometBFT RPC `block_by_height` method", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}}, }, { RpcMethod: "GetLatestValidatorSet", Use: "validator-set", Alias: []string{"validator-set-latest", "comet-validator-set", "cometbft-validator-set", "tendermint-validator-set"}, Short: "Query for the latest validator set", }, { RpcMethod: "GetValidatorSetByHeight", Use: "validator-set-by-height <height>", Short: "Query for a validator set by height", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}}, }, { RpcMethod: "ABCIQuery", Skip: true, }, }, }
CometBFTAutoCLIDescriptor is the auto-generated CLI descriptor for the CometBFT service
var Version = ""
Functions ¶
func AddQueryFlagsToCmd ¶
AddQueryFlagsToCmd adds common flags to a module query command.
func GetConsensusParams ¶
func GetConsensusParams[T transaction.Tx](ctx context.Context, app handlers.AppManager[T]) (*cmtproto.ConsensusParams, error)
GetConsensusParams makes a query to the consensus module in order to get the latest consensus parameters from committed state
func GetSnapshotStore ¶
GetSnapshotStore returns a snapshot store for the given application options. It creates a directory for storing snapshots if it doesn't exist. It initializes a GoLevelDB database for storing metadata of the snapshots. The snapshot store is then created using the initialized database and directory. If any error occurs during the process, it is returned along with a nil snapshot store.
func QueryBlockCmd ¶
QueryBlockCmd implements the default command for a Block query.
func QueryBlockResultsCmd ¶
QueryBlockResultsCmd implements the default command for a BlockResults query.
func QueryBlocksCmd ¶
QueryBlocksCmd returns a command to search through blocks by events.
func RawTx ¶
func RawTx(tx []byte) transaction.Tx
RawTx allows access to the raw bytes of a transaction even if it failed to decode.
func ShowAddressCmd ¶
ShowAddressCmd - show this node's validator address
func ShowNodeIDCmd ¶
ShowNodeIDCmd - ported from CometBFT, dump node ID to stdout
func ShowValidatorCmd ¶
ShowValidatorCmd - ported from CometBFT, show this node's validator info
func StatusCommand ¶
StatusCommand returns the command to return the status of the network.
func ToSDKCommitInfo ¶
func ToSDKCommitInfo(commit abci.CommitInfo) *comet.CommitInfo
ToSDKCommitInfo takes comet commit info and returns sdk commit info
func ToSDKEvidence ¶
func ToSDKEvidence(ev []abci.Misbehavior) []*comet.Evidence
ToSDKEvidence takes comet evidence and returns sdk evidence
func ToSDKExtendedCommitInfo ¶
func ToSDKExtendedCommitInfo(commit abci.ExtendedCommitInfo) comet.CommitInfo
ToSDKExtendedCommitInfo takes comet extended commit info and returns sdk commit info
func ValidateVoteExtensions ¶
func ValidateVoteExtensions[T transaction.Tx]( ctx context.Context, app handlers.AppManager[T], chainID string, validatorStore func(context.Context, []byte) (cryptotypes.PubKey, error), extCommit abci.ExtendedCommitInfo, currentHeight int64, commitInfo *abci.CommitInfo, ) error
ValidateVoteExtensions defines a helper function for verifying vote extension signatures that may be passed or manually injected into a block proposal from a proposer in PrepareProposal. It returns an error if any signature is invalid or if unexpected vote extensions and/or signatures are found or less than 2/3 power is received. If commitInfo is nil, this function can be used to check a set of vote extensions without comparing them to a commit.
func VersionCmd ¶
VersionCmd prints CometBFT and ABCI version numbers.
Types ¶
type AppCodecs ¶
type AppCodecs[T transaction.Tx] struct { TxCodec transaction.Codec[T] // The following codecs are only required for the gRPC services AppCodec codec.Codec LegacyAmino registry.AminoRegistrar ConsensusAddressCodec addresscodec.Codec }
AppCodecs contains all codecs that the CometBFT server requires provided by the application. They are extracted in struct to not be API breaking once amino is completely deprecated or new codecs should be added.
type AppTomlConfig ¶
type AppTomlConfig struct { MinRetainBlocks uint64 `` /* 285-byte string literal not displayed */ HaltHeight uint64 `` /* 199-byte string literal not displayed */ HaltTime uint64 `` /* 217-byte string literal not displayed */ Address string `mapstructure:"address" toml:"address" comment:"address defines the CometBFT RPC server address to bind to."` Transport string `` /* 126-byte string literal not displayed */ Trace bool `` /* 140-byte string literal not displayed */ Standalone bool `` /* 153-byte string literal not displayed */ // Sub configs Mempool mempool.Config `` /* 136-byte string literal not displayed */ Indexer indexer.IndexingConfig `` /* 126-byte string literal not displayed */ IndexABCIEvents []string `` /* 227-byte string literal not displayed */ DisableIndexABCIEvents bool `` /* 282-byte string literal not displayed */ DisableABCIEvents bool `` /* 176-byte string literal not displayed */ }
func DefaultAppTomlConfig ¶
func DefaultAppTomlConfig() *AppTomlConfig
type CfgOption ¶
type CfgOption func(*Config)
CfgOption is a function that allows to overwrite the default server configuration.
func OverwriteDefaultAppTomlConfig ¶
func OverwriteDefaultAppTomlConfig(newCfg *AppTomlConfig) CfgOption
OverwriteDefaultAppTomlConfig overwrites the default comet config with the new config.
func OverwriteDefaultConfigTomlConfig ¶
OverwriteDefaultConfigTomlConfig overwrites the default comet config with the new config.
type CometBFTServer ¶
type CometBFTServer[T transaction.Tx] struct { Node *node.Node Consensus abci.Application // contains filtered or unexported fields }
func New ¶
func New[T transaction.Tx]( logger log.Logger, appName string, store types.Store, app appmanager.AppManager[T], appCodecs AppCodecs[T], queryHandlers map[string]appmodulev2.Handler, decoderResolver decoding.DecoderResolver, serverOptions ServerOptions[T], cfg server.ConfigMap, cfgOptions ...CfgOption, ) (*CometBFTServer[T], error)
func NewWithConfigOptions ¶
func NewWithConfigOptions[T transaction.Tx](opts ...CfgOption) *CometBFTServer[T]
NewWithConfigOptions creates a new CometBFT server with the provided config options. It is *not* a fully functional server (since it has been created without dependencies) The returned server should only be used to get and set configuration.
func (*CometBFTServer[T]) BootstrapStateCmd ¶
func (s *CometBFTServer[T]) BootstrapStateCmd() *cobra.Command
func (*CometBFTServer[T]) CLICommands ¶
func (s *CometBFTServer[T]) CLICommands() serverv2.CLIConfig
func (*CometBFTServer[T]) Config ¶
func (s *CometBFTServer[T]) Config() any
Config returns the (app.toml) server configuration.
func (*CometBFTServer[T]) GRPCServiceRegistrar ¶
func (s *CometBFTServer[T]) GRPCServiceRegistrar( clientCtx client.Context, cfg server.ConfigMap, ) func(srv *grpc.Server) error
gRPCServiceRegistrar returns a function that registers the CometBFT gRPC service Those services are defined for backward compatibility. Eventually, they will be removed in favor of the new gRPC services.
func (*CometBFTServer[T]) Name ¶
func (s *CometBFTServer[T]) Name() string
func (*CometBFTServer[T]) StartCmdFlags ¶
func (s *CometBFTServer[T]) StartCmdFlags() *pflag.FlagSet
func (*CometBFTServer[T]) WriteCustomConfigAt ¶
func (s *CometBFTServer[T]) WriteCustomConfigAt(configPath string) error
WriteCustomConfigAt writes the default cometbft config.toml
type Config ¶
type Config struct { AppTomlConfig *AppTomlConfig ConfigTomlConfig *cmtcfg.Config }
Config is the configuration for the CometBFT application
type InjectedTx ¶
type InjectedTx []byte
func (InjectedTx) Bytes ¶
func (tx InjectedTx) Bytes() []byte
func (InjectedTx) GetGasLimit ¶
func (tx InjectedTx) GetGasLimit() (uint64, error)
func (InjectedTx) GetMessages ¶
func (tx InjectedTx) GetMessages() ([]transaction.Msg, error)
func (InjectedTx) GetSenders ¶
func (tx InjectedTx) GetSenders() ([]transaction.Identity, error)
func (InjectedTx) Hash ¶
func (tx InjectedTx) Hash() [32]byte
type ServerOptions ¶
type ServerOptions[T transaction.Tx] struct { PrepareProposalHandler handlers.PrepareHandler[T] ProcessProposalHandler handlers.ProcessHandler[T] CheckTxHandler handlers.CheckTxHandler[T] VerifyVoteExtensionHandler handlers.VerifyVoteExtensionHandler ExtendVoteHandler handlers.ExtendVoteHandler KeygenF keyGenF // Set mempool for the consensus module. Mempool func(cfg map[string]any) mempool.Mempool[T] // Set streaming manager for the consensus module. StreamingManager streaming.Manager // Set snapshot options for the consensus module. SnapshotOptions func(cfg map[string]any) snapshots.SnapshotOptions // Allows additional snapshotter implementations to be used for creating and restoring snapshots. SnapshotExtensions []snapshots.ExtensionSnapshotter AddrPeerFilter types.PeerFilter // filter peers by address and port IdPeerFilter types.PeerFilter // filter peers by node ID }
ServerOptions defines the options for the CometBFT server. When an option takes a map[string]any, it can access the app.tom's cometbft section and the config.toml config.
func DefaultServerOptions ¶
func DefaultServerOptions[T transaction.Tx]() ServerOptions[T]
DefaultServerOptions returns the default server options. It defaults to a NoOpMempool and NoOp handlers.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
client
|
|
internal
|
|
Package mempool defines a few mempool services which can be used in conjunction with your consensus implementation.
|
Package mempool defines a few mempool services which can be used in conjunction with your consensus implementation. |