Skip to content

Commit

Permalink
minor logging updates
Browse files Browse the repository at this point in the history
  • Loading branch information
charithabandi authored and jchappelow committed Feb 27, 2025
1 parent 43a348a commit 623f519
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion node/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (n *Node) blkAnnStreamHandler(s network.Stream) {
peerID := s.Conn().RemotePeer()

n.log.Info("Accept commit?", "height", height, "blockID", blkid, "appHash", ci.AppHash,
"from_peer", peers.PeerIDStringer(peerID))
"from_peer", peers.PeerIDStringer(peerID)) // maybe debug level

// If we are a validator and this is the commit ann for a proposed block
// that we already started executing, consensus engine will handle it.
Expand Down
6 changes: 3 additions & 3 deletions node/block_processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@ func (bp *BlockProcessor) nextAppHash(sh stateHashes) types.Hash {
hasher.Write(sh.paramUpdates[:])

bp.log.Info("AppState updates: ",
"prevAppHash", sh.prevApp, "changesetsHash", sh.changeset,
"valUpdatesHash", sh.valUpdates, "accountsHash", sh.accounts,
"txResultsHash", sh.txResults, "paramUpdatesHash", sh.paramUpdates)
"prevAppHash", sh.prevApp[:8], "changesets", sh.changeset[:8],
"validatorset", sh.valUpdates[:8], "accounts", sh.accounts[:8],
"txResults", sh.txResults[:8], "params", sh.paramUpdates[:8])

return hasher.Sum(nil)
}
Expand Down
2 changes: 1 addition & 1 deletion node/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (n *Node) blkPropStreamHandler(s network.Stream) {

from := s.Conn().RemotePeer()
n.log.Info("Accept proposal?", "height", height, "blockID", prop.Hash, "prevHash", prop.PrevHash,
"from_peer", peers.PeerIDStringer(from))
"from_peer", peers.PeerIDStringer(from)) // maybe debug level?

if !n.ce.AcceptProposal(height, prop.Hash, prop.PrevHash, prop.LeaderSig, prop.Stamp) {
// NOTE: if this is ahead of our last commit height, we have to try to catch up
Expand Down
2 changes: 1 addition & 1 deletion node/consensus/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (ce *ConsensusEngine) executeBlock(ctx context.Context, blkProp *blockPropo
// reset the catchup timer as we have successfully processed a new block proposal
ce.catchupTicker.Reset(ce.catchupTimeout)

ce.log.Info("Executed block", "height", blkProp.height, "blockID", blkProp.blkHash, "numTxs", blkProp.blk.Header.NumTxns, "appHash", results.AppHash.String())
ce.log.Info("Executed block", "height", blkProp.height, "blockID", blkProp.blkHash, "appHash", results.AppHash.String(), "numTxs", blkProp.blk.Header.NumTxns)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion node/consensus/follower.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (ce *ConsensusEngine) processBlockProposal(ctx context.Context, blkPropMsg
}
}

ce.log.Info("Processing block proposal", "height", blkPropMsg.blk.Header.Height, "header", blkPropMsg.blk.Header)
ce.log.Debug("Processing block proposal", "height", blkPropMsg.blk.Header.Height, "blkID", blkPropMsg.blkHash, "numTxs", blkPropMsg.blk.Header.NumTxns)

if err := ce.validateBlock(blkPropMsg.blk); err != nil {
sig, err := types.SignVote(blkPropMsg.blkHash, false, nil, ce.privKey)
Expand Down
9 changes: 6 additions & 3 deletions node/consensus/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (ce *ConsensusEngine) proposeBlock(ctx context.Context) error {
return fmt.Errorf("error creating block proposal: %w", err)
}

ce.log.Info("Created a new block proposal", "height", blkProp.height, "hash", blkProp.blkHash)
ce.log.Info("Created block proposal", "height", blkProp.height, "hash", blkProp.blkHash)

// Validate the block proposal before announcing it to the network
if err := ce.validateBlock(blkProp.blk); err != nil {
Expand Down Expand Up @@ -204,6 +204,10 @@ func (ce *ConsensusEngine) proposeBlock(ctx context.Context) error {
// We may be ready to commit if we're the only validator.
ce.processVotes(ctx)

if len(ce.validatorSet) > 1 { // or can check if the proposal is committed: ce.blkProp == nil
ce.log.Info("Waiting for votes from the validators", "height", blkProp.height, "hash", blkProp.blkHash)
}

return nil
}

Expand Down Expand Up @@ -408,7 +412,6 @@ func (ce *ConsensusEngine) processVotes(ctx context.Context) {

if !ce.hasMajorityCeil(acks) {
// No majority yet, wait for more votes
ce.log.Info("Waiting for votes from the validators", "height", blkProp.height, "hash", blkProp.blkHash)
return
}

Expand Down Expand Up @@ -446,7 +449,7 @@ func (ce *ConsensusEngine) processVotes(ctx context.Context) {
return
}

ce.log.Infoln("Announce committed block", blkProp.blk.Header.Height, blkProp.blkHash, blkRes.paramUpdates)
ce.log.Debugln("Announce committed block", blkProp.blk.Header.Height, blkProp.blkHash, blkRes.paramUpdates)

// Broadcast the blockAnn message
go ce.blkAnnouncer(ctx, blkProp.blk, ce.state.lc.commitInfo)
Expand Down

0 comments on commit 623f519

Please sign in to comment.