Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Sep 16, 2024
1 parent 741842f commit 55edf6c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions server/v2/cometbft/config.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package cometbft

import (
"cosmossdk.io/server/v2/cometbft/mempool"

cmtcfg "github.com/cometbft/cometbft/config"

"cosmossdk.io/server/v2/cometbft/mempool"
)

// Config is the configuration for the CometBFT application
Expand Down
6 changes: 3 additions & 3 deletions server/v2/cometbft/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
)

// ServerOptions defines the options for the CometBFT server.
// Options are func that are able to take CometBFT app.toml section config and config.toml config.
// When an options takes a map[string]any, it is able to access the app.tom's cometbft section and the config.toml config.
type ServerOptions[T transaction.Tx] struct {
Mempool func(cfg map[string]any) mempool.Mempool[T]
PrepareProposalHandler handlers.PrepareHandler[T]
ProcessProposalHandler handlers.ProcessHandler[T]
VerifyVoteExtensionHandler handlers.VerifyVoteExtensionhandler
ExtendVoteHandler handlers.ExtendVoteHandler

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
Expand All @@ -27,11 +27,11 @@ type ServerOptions[T transaction.Tx] struct {
// It defaults to a NoOpMempool and NoOp handlers.
func DefaultServerOptions[T transaction.Tx]() ServerOptions[T] {
return ServerOptions[T]{
Mempool: func(cfg map[string]any) mempool.Mempool[T] { return mempool.NoOpMempool[T]{} },
PrepareProposalHandler: handlers.NoOpPrepareProposal[T](),
ProcessProposalHandler: handlers.NoOpProcessProposal[T](),
VerifyVoteExtensionHandler: handlers.NoOpVerifyVoteExtensionHandler(),
ExtendVoteHandler: handlers.NoOpExtendVote(),
Mempool: func(cfg map[string]any) mempool.Mempool[T] { return mempool.NoOpMempool[T]{} },
SnapshotOptions: func(cfg map[string]any) snapshots.SnapshotOptions { return snapshots.NewSnapshotOptions(0, 0) },
AddrPeerFilter: nil,
IdPeerFilter: nil,
Expand Down
14 changes: 9 additions & 5 deletions simapp/v2/simdv2/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,17 @@ func initCometConfig() cometbft.CfgOption {
func initCometOptions[T transaction.Tx]() cometbft.ServerOptions[T] {
serverOptions := cometbft.DefaultServerOptions[T]()

// TOOD mempool interface doesn't match!
// TODO mempool interface doesn't match!

// overwrite app mempool, using max-txs option
// if maxTxs := cast.ToInt(cfg.Get(cometbft.FlagMempoolMaxTxs)); maxTxs >= 0 {
// serverOptions.Mempool = mempool.NewSenderNonceMempool(
// mempool.SenderNonceMaxTxOpt(maxTxs),
// )
// serverOptions.Mempool = func(cfg map[string]any) mempool.Mempool[T] {
// if maxTxs := cast.ToInt(cfg[cometbft.FlagMempoolMaxTxs]); maxTxs >= 0 {
// return mempool.NewSenderNonceMempool(
// mempool.SenderNonceMaxTxOpt(maxTxs),
// )
// }

// return mempool.NoOpMempool[T]{}
// }

return serverOptions
Expand Down

0 comments on commit 55edf6c

Please sign in to comment.