Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cf23082

Browse files
authoredAug 7, 2023
Log proposer's address when correctly accepting a proposal (celestiaorg#1079)
* Log proposer when logging received proposal * Addressed review comments * Promote updates to validator to Info level
1 parent b976685 commit cf23082

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed
 

‎consensus/state.go

+11-4
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ func (cs *State) enterNewRound(height int64, round int32) {
10391039
logger.Debug("need to set a buffer and log message here for sanity", "start_time", cs.StartTime, "now", now)
10401040
}
10411041

1042-
logger.Debug("entering new round", "current", log.NewLazySprintf("%v/%v/%v", cs.Height, cs.Round, cs.Step))
1042+
prevHeight, prevRound, prevStep := cs.Height, cs.Round, cs.Step
10431043

10441044
// increment validators if necessary
10451045
validators := cs.Validators
@@ -1055,13 +1055,19 @@ func (cs *State) enterNewRound(height int64, round int32) {
10551055
cs.Validators = validators
10561056
// If round == 0, we've already reset these upon new height, and meanwhile
10571057
// we might have received a proposal for round 0.
1058+
propAddress := validators.GetProposer().PubKey.Address()
10581059
if round != 0 {
1059-
logger.Debug("resetting proposal info")
1060+
logger.Info("resetting proposal info", "proposer", propAddress)
10601061
cs.Proposal = nil
10611062
cs.ProposalBlock = nil
10621063
cs.ProposalBlockParts = nil
10631064
}
10641065

1066+
logger.Debug("entering new round",
1067+
"previous", log.NewLazySprintf("%v/%v/%v", prevHeight, prevRound, prevStep),
1068+
"proposer", propAddress,
1069+
)
1070+
10651071
cs.Votes.SetRound(cmtmath.SafeAddInt32(round, 1)) // also track next round (round+1) to allow round-skipping
10661072
cs.TriggeredTimeoutPrecommit = false
10671073

@@ -1864,7 +1870,8 @@ func (cs *State) defaultSetProposal(proposal *types.Proposal) error {
18641870

18651871
p := proposal.ToProto()
18661872
// Verify signature
1867-
if !cs.Validators.GetProposer().PubKey.VerifySignature(
1873+
pubKey := cs.Validators.GetProposer().PubKey
1874+
if !pubKey.VerifySignature(
18681875
types.ProposalSignBytes(cs.state.ChainID, p), proposal.Signature,
18691876
) {
18701877
return ErrInvalidProposalSignature
@@ -1879,7 +1886,7 @@ func (cs *State) defaultSetProposal(proposal *types.Proposal) error {
18791886
cs.ProposalBlockParts = types.NewPartSetFromHeader(proposal.BlockID.PartSetHeader)
18801887
}
18811888

1882-
cs.Logger.Info("received proposal", "proposal", proposal)
1889+
cs.Logger.Info("received proposal", "proposal", proposal, "proposer", pubKey.Address())
18831890
return nil
18841891
}
18851892

‎state/execution.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func (blockExec *BlockExecutor) ApplyBlock(
264264
return state, err
265265
}
266266
if len(validatorUpdates) > 0 {
267-
blockExec.logger.Debug("updates to validators", "updates", types.ValidatorListString(validatorUpdates))
267+
blockExec.logger.Info("updates to validators", "updates", types.ValidatorListString(validatorUpdates))
268268
blockExec.metrics.ValidatorSetUpdates.Add(1)
269269
}
270270
if abciResponse.ConsensusParamUpdates != nil {

0 commit comments

Comments
 (0)
Please sign in to comment.