Documentation ¶
Index ¶
- Constants
- Variables
- func AddQueryFlagsToCmd(cmd *cobra.Command)
- func GetSnapshotStore(rootDir string) (*snapshots.Store, error)
- func QueryBlockCmd() *cobra.Command
- func QueryBlockResultsCmd() *cobra.Command
- func QueryBlocksCmd() *cobra.Command
- func QueryResult(err error, debug bool) *abci.QueryResponse
- 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 VersionCmd() *cobra.Command
- 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]) Init(appI serverv2.AppI[T], cfg map[string]any, logger log.Logger) 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 Consensus
- func (c *Consensus[T]) ApplySnapshotChunk(_ context.Context, req *abci.ApplySnapshotChunkRequest) (*abci.ApplySnapshotChunkResponse, error)
- func (c *Consensus[T]) CheckTx(ctx context.Context, req *abciproto.CheckTxRequest) (*abciproto.CheckTxResponse, error)
- func (c *Consensus[T]) Commit(ctx context.Context, _ *abciproto.CommitRequest) (*abciproto.CommitResponse, error)
- func (c *Consensus[T]) ExtendVote(ctx context.Context, req *abciproto.ExtendVoteRequest) (*abciproto.ExtendVoteResponse, error)
- func (c *Consensus[T]) FinalizeBlock(ctx context.Context, req *abciproto.FinalizeBlockRequest) (*abciproto.FinalizeBlockResponse, error)
- func (c *Consensus[T]) GetBlockRetentionHeight(cp *cmtproto.ConsensusParams, commitHeight int64) int64
- func (c *Consensus[T]) GetConsensusParams(ctx context.Context) (*cmtproto.ConsensusParams, error)
- func (c *Consensus[T]) Info(ctx context.Context, _ *abciproto.InfoRequest) (*abciproto.InfoResponse, error)
- func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRequest) (*abciproto.InitChainResponse, error)
- func (c *Consensus[T]) ListSnapshots(_ context.Context, ctx *abci.ListSnapshotsRequest) (*abci.ListSnapshotsResponse, error)
- func (c *Consensus[T]) LoadSnapshotChunk(_ context.Context, req *abci.LoadSnapshotChunkRequest) (*abci.LoadSnapshotChunkResponse, error)
- func (c *Consensus[T]) OfferSnapshot(_ context.Context, req *abci.OfferSnapshotRequest) (*abci.OfferSnapshotResponse, error)
- func (c *Consensus[T]) PrepareProposal(ctx context.Context, req *abciproto.PrepareProposalRequest) (resp *abciproto.PrepareProposalResponse, err error)
- func (c *Consensus[T]) ProcessProposal(ctx context.Context, req *abciproto.ProcessProposalRequest) (*abciproto.ProcessProposalResponse, error)
- func (c *Consensus[T]) Query(ctx context.Context, req *abciproto.QueryRequest) (resp *abciproto.QueryResponse, err error)
- func (c *Consensus[T]) RegisterSnapshotExtensions(extensions ...snapshots.ExtensionSnapshotter) error
- func (c *Consensus[T]) SetStreamingManager(sm streaming.Manager)
- func (c *Consensus[T]) VerifyVoteExtension(ctx context.Context, req *abciproto.VerifyVoteExtensionRequest) (*abciproto.VerifyVoteExtensionResponse, error)
- type ServerOptions
Constants ¶
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 Version = ""
Functions ¶
func AddQueryFlagsToCmd ¶
AddQueryFlagsToCmd adds common flags to a module query command.
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 QueryResult ¶
func QueryResult(err error, debug bool) *abci.QueryResponse
QueryResult returns a ResponseQuery from an error. It will try to parse ABCI info from the error.
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 VersionCmd ¶
VersionCmd prints CometBFT and ABCI version numbers.
Types ¶
type AppTomlConfig ¶
type AppTomlConfig struct { MinRetainBlocks uint64 `` /* 285-byte string literal not displayed */ IndexEvents []string `` /* 212-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 */ }
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 *Consensus[T] // contains filtered or unexported fields }
func New ¶
func New[T transaction.Tx]( txCodec transaction.Codec[T], serverOptions ServerOptions[T], cfgOptions ...CfgOption, ) *CometBFTServer[T]
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]) 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 Consensus ¶
type Consensus[T transaction.Tx] struct { // contains filtered or unexported fields }
func NewConsensus ¶
func NewConsensus[T transaction.Tx]( logger log.Logger, appName string, app *appmanager.AppManager[T], appCloser func() error, mp mempool.Mempool[T], indexedEvents map[string]struct{}, queryHandlersMap map[string]appmodulev2.Handler, store types.Store, cfg Config, txCodec transaction.Codec[T], chainId string, ) *Consensus[T]
func (*Consensus[T]) ApplySnapshotChunk ¶
func (c *Consensus[T]) ApplySnapshotChunk(_ context.Context, req *abci.ApplySnapshotChunkRequest) (*abci.ApplySnapshotChunkResponse, error)
ApplySnapshotChunk implements types.Application.
func (*Consensus[T]) CheckTx ¶
func (c *Consensus[T]) CheckTx(ctx context.Context, req *abciproto.CheckTxRequest) (*abciproto.CheckTxResponse, error)
CheckTx implements types.Application. It is called by cometbft to verify transaction validity
func (*Consensus[T]) Commit ¶
func (c *Consensus[T]) Commit(ctx context.Context, _ *abciproto.CommitRequest) (*abciproto.CommitResponse, error)
Commit implements types.Application. It is called by cometbft to notify the application that a block was committed.
func (*Consensus[T]) ExtendVote ¶
func (c *Consensus[T]) ExtendVote(ctx context.Context, req *abciproto.ExtendVoteRequest) (*abciproto.ExtendVoteResponse, error)
ExtendVote implements types.Application.
func (*Consensus[T]) FinalizeBlock ¶
func (c *Consensus[T]) FinalizeBlock( ctx context.Context, req *abciproto.FinalizeBlockRequest, ) (*abciproto.FinalizeBlockResponse, error)
FinalizeBlock implements types.Application. It is called by cometbft to finalize a block.
func (*Consensus[T]) GetBlockRetentionHeight ¶
func (c *Consensus[T]) GetBlockRetentionHeight(cp *cmtproto.ConsensusParams, commitHeight int64) int64
func (*Consensus[T]) GetConsensusParams ¶
GetConsensusParams makes a query to the consensus module in order to get the latest consensus parameters from committed state
func (*Consensus[T]) Info ¶
func (c *Consensus[T]) Info(ctx context.Context, _ *abciproto.InfoRequest) (*abciproto.InfoResponse, error)
Info implements types.Application.
func (*Consensus[T]) InitChain ¶
func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRequest) (*abciproto.InitChainResponse, error)
InitChain implements types.Application.
func (*Consensus[T]) ListSnapshots ¶
func (c *Consensus[T]) ListSnapshots(_ context.Context, ctx *abci.ListSnapshotsRequest) (*abci.ListSnapshotsResponse, error)
ListSnapshots implements types.Application.
func (*Consensus[T]) LoadSnapshotChunk ¶
func (c *Consensus[T]) LoadSnapshotChunk(_ context.Context, req *abci.LoadSnapshotChunkRequest) (*abci.LoadSnapshotChunkResponse, error)
LoadSnapshotChunk implements types.Application.
func (*Consensus[T]) OfferSnapshot ¶
func (c *Consensus[T]) OfferSnapshot(_ context.Context, req *abci.OfferSnapshotRequest) (*abci.OfferSnapshotResponse, error)
OfferSnapshot implements types.Application.
func (*Consensus[T]) PrepareProposal ¶
func (c *Consensus[T]) PrepareProposal( ctx context.Context, req *abciproto.PrepareProposalRequest, ) (resp *abciproto.PrepareProposalResponse, err error)
PrepareProposal implements types.Application. It is called by cometbft to prepare a proposal block.
func (*Consensus[T]) ProcessProposal ¶
func (c *Consensus[T]) ProcessProposal( ctx context.Context, req *abciproto.ProcessProposalRequest, ) (*abciproto.ProcessProposalResponse, error)
ProcessProposal implements types.Application. It is called by cometbft to process/verify a proposal block.
func (*Consensus[T]) Query ¶
func (c *Consensus[T]) Query(ctx context.Context, req *abciproto.QueryRequest) (resp *abciproto.QueryResponse, err error)
Query implements types.Application. It is called by cometbft to query application state.
func (*Consensus[T]) RegisterSnapshotExtensions ¶
func (c *Consensus[T]) RegisterSnapshotExtensions(extensions ...snapshots.ExtensionSnapshotter) error
RegisterSnapshotExtensions registers the given extensions with the consensus module's snapshot manager. It allows additional snapshotter implementations to be used for creating and restoring snapshots.
func (*Consensus[T]) SetStreamingManager ¶
SetStreamingManager sets the streaming manager for the consensus module.
func (*Consensus[T]) VerifyVoteExtension ¶
func (c *Consensus[T]) VerifyVoteExtension( ctx context.Context, req *abciproto.VerifyVoteExtensionRequest, ) (*abciproto.VerifyVoteExtensionResponse, error)
VerifyVoteExtension implements types.Application.
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 Mempool func(cfg map[string]any) mempool.Mempool[T] SnapshotOptions func(cfg map[string]any) snapshots.SnapshotOptions 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. |