Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters committed Oct 28, 2024
1 parent f170aad commit a31a8fe
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 30 deletions.
2 changes: 1 addition & 1 deletion consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ OUTER_LOOP:
ProposalPolRound: rs.Proposal.POLRound,
ProposalPol: *rs.Votes.Prevotes(rs.Proposal.POLRound).BitArray().ToProto(),
},
}, logger) {
}, logger) {
logger.Debug("Sent POL", "height", prs.Height, "round", prs.Round)
ps.SetHasBlock(rs.Height, rs.Round)
schema.WriteConsensusState(
Expand Down
2 changes: 1 addition & 1 deletion consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -2060,7 +2060,7 @@ func (cs *State) addCompactBlock(msg *CompactBlockMessage, peerID p2p.ID) error
}

// we start this as a goroutine so as to not block the reactor
// from recieving other messages or timeouts while the mempool
// from receiving other messages or timeouts while the mempool
// attempts to fetch any missing transactions. If the block is
// correctly reconstructed, the handleCompleteProposal function
// will be called to process the block and move to the next step.
Expand Down
6 changes: 3 additions & 3 deletions mempool/cat/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (memR *Reactor) broadcastTxsRoutine() {
default:
}

// if there are no current transctions to broadcast, check if there are any new ones to add to the queue
// if there are no current transactions to broadcast, check if there are any new ones to add to the queue
if memR.mempool.priorityBroadcastQueue.queue.Len() == 0 {
select {
case <-memR.Quit():
Expand Down Expand Up @@ -356,8 +356,8 @@ func (memR *Reactor) ReceiveEnvelope(e p2p.Envelope) {
return
}
// if !memR.opts.ListenOnly {
// We broadcast only transactions that we deem valid and actually have in our mempool.
memR.broadcastSeenTx(key)
// We broadcast only transactions that we deem valid and actually have in our mempool.
memR.broadcastSeenTx(key)
// }
}

Expand Down
2 changes: 1 addition & 1 deletion mempool/cat/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestReactorSendWantTxAfterReceiveingSeenTx(t *testing.T) {
func TestReactorSendsTxAfterReceivingWantTx(t *testing.T) {
reactor, pool := setupReactor(t)
require.NoError(t, reactor.Start())
defer reactor.Stop()
defer func() { _ = reactor.Stop() }()

tx := newDefaultTx("hello")
key := tx.Key()
Expand Down
26 changes: 13 additions & 13 deletions mempool/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,19 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
// NopMetrics returns no-op Metrics.
func NopMetrics() *Metrics {
return &Metrics{
Size: discard.NewGauge(),
SizeBytes: discard.NewGauge(),
TxSizeBytes: discard.NewHistogram(),
FailedTxs: discard.NewCounter(),
EvictedTxs: discard.NewCounter(),
ExpiredTxs: discard.NewCounter(),
SuccessfulTxs: discard.NewCounter(),
RecheckTimes: discard.NewCounter(),
AlreadySeenTxs: discard.NewCounter(),
RequestedTxs: discard.NewCounter(),
RerequestedTxs: discard.NewCounter(),
MissingTxs: discard.NewCounter(),
RecoveryRate: discard.NewHistogram(),
Size: discard.NewGauge(),
SizeBytes: discard.NewGauge(),
TxSizeBytes: discard.NewHistogram(),
FailedTxs: discard.NewCounter(),
EvictedTxs: discard.NewCounter(),
ExpiredTxs: discard.NewCounter(),
SuccessfulTxs: discard.NewCounter(),
RecheckTimes: discard.NewCounter(),
AlreadySeenTxs: discard.NewCounter(),
RequestedTxs: discard.NewCounter(),
RerequestedTxs: discard.NewCounter(),
MissingTxs: discard.NewCounter(),
RecoveryRate: discard.NewHistogram(),
ActiveOutboundConnections: discard.NewGauge(),
}
}
Expand Down
21 changes: 10 additions & 11 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
cmtpubsub "github.com/tendermint/tendermint/libs/pubsub"
"github.com/tendermint/tendermint/libs/service"
"github.com/tendermint/tendermint/light"
mempl "github.com/tendermint/tendermint/mempool"
"github.com/tendermint/tendermint/mempool/cat"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/p2p/pex"
Expand Down Expand Up @@ -118,19 +117,19 @@ func DefaultNewNode(config *cfg.Config, logger log.Logger) (*Node, error) {
}

// MetricsProvider returns a consensus, p2p and mempool Metrics.
type MetricsProvider func(chainID, softwareVersion string) (*cs.Metrics, *p2p.Metrics, *mempl.Metrics, *sm.Metrics)
type MetricsProvider func(chainID, softwareVersion string) (*cs.Metrics, *p2p.Metrics, *mempool.Metrics, *sm.Metrics)

// DefaultMetricsProvider returns Metrics build using Prometheus client library
// if Prometheus is enabled. Otherwise, it returns no-op Metrics.
func DefaultMetricsProvider(config *cfg.InstrumentationConfig) MetricsProvider {
return func(chainID, softwareVersion string) (*cs.Metrics, *p2p.Metrics, *mempl.Metrics, *sm.Metrics) {
return func(chainID, softwareVersion string) (*cs.Metrics, *p2p.Metrics, *mempool.Metrics, *sm.Metrics) {
if config.Prometheus {
return cs.PrometheusMetrics(config.Namespace, "chain_id", chainID, "version", softwareVersion),
p2p.PrometheusMetrics(config.Namespace, "chain_id", chainID, "version", softwareVersion),
mempl.PrometheusMetrics(config.Namespace, "chain_id", chainID, "version", softwareVersion),
mempool.PrometheusMetrics(config.Namespace, "chain_id", chainID, "version", softwareVersion),
sm.PrometheusMetrics(config.Namespace, "chain_id", chainID, "version", softwareVersion)
}
return cs.NopMetrics(), p2p.NopMetrics(), mempl.NopMetrics(), sm.NopMetrics()
return cs.NopMetrics(), p2p.NopMetrics(), mempool.NopMetrics(), sm.NopMetrics()
}
}

Expand Down Expand Up @@ -218,7 +217,7 @@ type Node struct {
blockStore *store.BlockStore // store the blockchain to disk
bcReactor p2p.Reactor // for fast-syncing
mempoolReactor p2p.Reactor // for gossipping transactions
mempool mempl.Mempool
mempool mempool.Mempool
stateSync bool // whether the node should state sync on startup
stateSyncReactor *statesync.Reactor // for hosting and restoring state sync snapshots
stateSyncProvider statesync.StateProvider // provides state data for bootstrapping a node
Expand Down Expand Up @@ -375,16 +374,16 @@ func createMempoolAndMempoolReactor(
config *cfg.Config,
proxyApp proxy.AppConns,
state sm.State,
memplMetrics *mempl.Metrics,
mempoolMetrics *mempool.Metrics,
logger log.Logger,
traceClient trace.Tracer,
) (mempl.Mempool, *cat.Reactor) {
) (mempool.Mempool, *cat.Reactor) {
mp := cat.NewTxPool(
logger,
config.Mempool,
proxyApp.Mempool(),
state.LastBlockHeight,
cat.WithMetrics(memplMetrics),
cat.WithMetrics(mempoolMetrics),
cat.WithPreCheck(sm.TxPreCheck(state)),
cat.WithPostCheck(sm.TxPostCheck(state)),
)
Expand Down Expand Up @@ -1347,7 +1346,7 @@ func (n *Node) MempoolReactor() p2p.Reactor {
}

// Mempool returns the Node's mempool.
func (n *Node) Mempool() mempl.Mempool {
func (n *Node) Mempool() mempool.Mempool {
return n.mempool
}

Expand Down Expand Up @@ -1441,7 +1440,7 @@ func makeNodeInfo(
Channels: []byte{
bcChannel,
cs.StateChannel, cs.DataChannel, cs.VoteChannel, cs.VoteSetBitsChannel,
mempl.MempoolChannel,
mempool.MempoolChannel,
evidence.EvidenceChannel,
statesync.SnapshotChannel, statesync.ChunkChannel,
},
Expand Down

0 comments on commit a31a8fe

Please sign in to comment.