Skip to content

Commit

Permalink
fix: comment out expensive debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddyMc committed Aug 20, 2024
1 parent f2748e9 commit bda03b3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
12 changes: 6 additions & 6 deletions consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1395,12 +1395,12 @@ func (ps *PeerState) SetHasVoteFromPeer(vote *types.Vote, csHeight int64, valSiz
}

func (ps *PeerState) setHasVote(height int64, round int32, voteType cmtproto.SignedMsgType, index int32) {
ps.logger.Debug("setHasVote",
"peerH/R",
log.NewLazySprintf("%d/%d", ps.PRS.Height, ps.PRS.Round),
"H/R",
log.NewLazySprintf("%d/%d", height, round),
"type", voteType, "index", index)
// ps.logger.Debug("setHasVote",
// "peerH/R",
// log.NewLazySprintf("%d/%d", ps.PRS.Height, ps.PRS.Round),
// "H/R",
// log.NewLazySprintf("%d/%d", height, round),
// "type", voteType, "index", index)

// NOTE: some may be nil BitArrays -> no side effects.
psVotes := ps.getVoteBitArray(height, round, voteType)
Expand Down
14 changes: 7 additions & 7 deletions consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,7 @@ func (cs *State) addVote(vote *types.Vote, peerID p2p.ID) (added bool, err error
return added, err
}

cs.Logger.Debug("added vote to last precommits", "last_commit", cs.LastCommit.StringShort())
// cs.Logger.Debug("added vote to last precommits", "last_commit", cs.LastCommit.StringShort())
if err := cs.eventBus.PublishEventVote(types.EventDataVote{Vote: vote}); err != nil {
return added, err
}
Expand Down Expand Up @@ -2303,7 +2303,7 @@ func (cs *State) addVote(vote *types.Vote, peerID p2p.ID) (added bool, err error
switch vote.Type {
case cmtproto.PrevoteType:
prevotes := cs.Votes.Prevotes(vote.Round)
cs.Logger.Debug("added vote to prevote", "vote", vote, "prevotes", prevotes.StringShort())
// cs.Logger.Debug("added vote to prevote", "vote", vote, "prevotes", prevotes.StringShort())

// If +2/3 prevotes for a block or nil for *any* round:
if blockID, ok := prevotes.TwoThirdsMajority(); ok {
Expand Down Expand Up @@ -2338,11 +2338,11 @@ func (cs *State) addVote(vote *types.Vote, peerID p2p.ID) (added bool, err error
cs.ValidBlock = cs.ProposalBlock
cs.ValidBlockParts = cs.ProposalBlockParts
} else {
cs.Logger.Debug(
"valid block we do not know about; set ProposalBlock=nil",
"proposal", log.NewLazyBlockHash(cs.ProposalBlock),
"block_id", blockID.Hash,
)
// cs.Logger.Debug(
// "valid block we do not know about; set ProposalBlock=nil",
// "proposal", log.NewLazyBlockHash(cs.ProposalBlock),
// "block_id", blockID.Hash,
// )

// we're getting the wrong block
cs.ProposalBlock = nil
Expand Down
6 changes: 3 additions & 3 deletions p2p/conn/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func (c *MConnection) Send(chID byte, msgBytes []byte) bool {
return false
}

c.Logger.Debug("Send", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))
// c.Logger.Debug("Send", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))

// Send message to channel.
channel, ok := c.channelsIdx[chID]
Expand All @@ -377,7 +377,7 @@ func (c *MConnection) Send(chID byte, msgBytes []byte) bool {
default:
}
} else {

Check failure on line 379 in p2p/conn/connection.go

View workflow job for this annotation

GitHub Actions / golangci-lint

SA9003: empty branch (staticcheck)
c.Logger.Debug("Send failed", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))
// c.Logger.Debug("Send failed", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))
}
return success
}
Expand All @@ -389,7 +389,7 @@ func (c *MConnection) TrySend(chID byte, msgBytes []byte) bool {
return false
}

c.Logger.Debug("TrySend", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))
// c.Logger.Debug("TrySend", "channel", chID, "conn", c, "msgBytes", log.NewLazySprintf("%X", msgBytes))

// Send message to channel.
channel, ok := c.channelsIdx[chID]
Expand Down
14 changes: 7 additions & 7 deletions p2p/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,13 @@ func (p *peer) HasChannel(chID byte) bool {
}
// NOTE: probably will want to remove this
// but could be helpful while the feature is new
p.Logger.Debug(
"Unknown channel for peer",
"channel",
chID,
"channels",
p.channels,
)
// p.Logger.Debug(
// "Unknown channel for peer",
// "channel",
// chID,
// "channels",
// p.channels,
// )
return false
}

Expand Down

0 comments on commit bda03b3

Please sign in to comment.