mirror of
https://github.com/tendermint/tendermint.git
synced 2026-06-03 21:06:22 +00:00
improve debug output for action & step
This commit is contained in:
@@ -279,7 +279,7 @@ OUTER_LOOP:
|
||||
|
||||
// If height and round doesn't match, sleep.
|
||||
if rs.Height != prs.Height || rs.Round != prs.Round {
|
||||
log.Debug("Height or Round mismatch, sleeping", "peerHeight", prs.Height, "peerRound", prs.Round)
|
||||
log.Debug("Height or Round mismatch, sleeping", "peerHeight", prs.Height, "peerRound", prs.Round, "peer", peer)
|
||||
time.Sleep(peerGossipSleepDuration)
|
||||
continue OUTER_LOOP
|
||||
}
|
||||
@@ -696,7 +696,7 @@ type NewRoundStepMessage struct {
|
||||
func (m *NewRoundStepMessage) TypeByte() byte { return msgTypeNewRoundStep }
|
||||
|
||||
func (m *NewRoundStepMessage) String() string {
|
||||
return fmt.Sprintf("[NewRoundStep %v/%v/%X]", m.Height, m.Round, m.Step)
|
||||
return fmt.Sprintf("[NewRoundStep H:%v R:%v S:%v]", m.Height, m.Round, m.Step)
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
@@ -710,7 +710,7 @@ type CommitStepMessage struct {
|
||||
func (m *CommitStepMessage) TypeByte() byte { return msgTypeCommitStep }
|
||||
|
||||
func (m *CommitStepMessage) String() string {
|
||||
return fmt.Sprintf("[CommitStep %v %v %v]", m.Height, m.BlockParts, m.BlockBitArray)
|
||||
return fmt.Sprintf("[CommitStep H:%v BP:%v BA:%v]", m.Height, m.BlockParts, m.BlockBitArray)
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
@@ -730,7 +730,7 @@ type PartMessage struct {
|
||||
func (m *PartMessage) TypeByte() byte { return msgTypePart }
|
||||
|
||||
func (m *PartMessage) String() string {
|
||||
return fmt.Sprintf("[Part %v/%v T:%X %v]", m.Height, m.Round, m.Type, m.Part)
|
||||
return fmt.Sprintf("[Part H:%v R:%v T:%X P:%v]", m.Height, m.Round, m.Type, m.Part)
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
@@ -743,7 +743,7 @@ type VoteMessage struct {
|
||||
func (m *VoteMessage) TypeByte() byte { return msgTypeVote }
|
||||
|
||||
func (m *VoteMessage) String() string {
|
||||
return fmt.Sprintf("[Vote ValidatorIndex:%v Vote:%v]", m.ValidatorIndex, m.Vote)
|
||||
return fmt.Sprintf("[Vote VI:%v V:%v]", m.ValidatorIndex, m.Vote)
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
@@ -70,24 +70,7 @@ import (
|
||||
"github.com/tendermint/tendermint/state"
|
||||
)
|
||||
|
||||
type RoundStep uint8
|
||||
type RoundActionType uint8
|
||||
|
||||
const (
|
||||
RoundStepNewHeight = RoundStep(0x00) // Round0 for new height started, wait til CommitTime + Delta
|
||||
RoundStepNewRound = RoundStep(0x01) // Pseudostep, immediately goes to RoundStepPropose
|
||||
RoundStepPropose = RoundStep(0x10) // Did propose, gossip proposal
|
||||
RoundStepPrevote = RoundStep(0x11) // Did prevote, gossip prevotes
|
||||
RoundStepPrecommit = RoundStep(0x12) // Did precommit, gossip precommits
|
||||
RoundStepCommit = RoundStep(0x20) // Entered commit state machine
|
||||
|
||||
RoundActionPropose = RoundActionType(0xA0) // Propose and goto RoundStepPropose
|
||||
RoundActionPrevote = RoundActionType(0xA1) // Prevote and goto RoundStepPrevote
|
||||
RoundActionPrecommit = RoundActionType(0xA2) // Precommit and goto RoundStepPrecommit
|
||||
RoundActionTryCommit = RoundActionType(0xC0) // Goto RoundStepCommit, or RoundStepPropose for next round.
|
||||
RoundActionCommit = RoundActionType(0xC1) // Goto RoundStepCommit upon +2/3 commits
|
||||
RoundActionTryFinalize = RoundActionType(0xC2) // Maybe goto RoundStepPropose for next round.
|
||||
|
||||
roundDuration0 = 60 * time.Second // The first round is 60 seconds long.
|
||||
roundDurationDelta = 15 * time.Second // Each successive round lasts 15 seconds longer.
|
||||
roundDeadlinePrevote = float64(1.0 / 3.0) // When the prevote is due.
|
||||
@@ -99,6 +82,74 @@ var (
|
||||
ErrInvalidProposalSignature = errors.New("Error invalid proposal signature")
|
||||
)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// RoundStep enum type
|
||||
|
||||
type RoundStep uint8
|
||||
|
||||
const (
|
||||
RoundStepNewHeight = RoundStep(0x00) // Round0 for new height started, wait til CommitTime + Delta
|
||||
RoundStepNewRound = RoundStep(0x01) // Pseudostep, immediately goes to RoundStepPropose
|
||||
RoundStepPropose = RoundStep(0x10) // Did propose, gossip proposal
|
||||
RoundStepPrevote = RoundStep(0x11) // Did prevote, gossip prevotes
|
||||
RoundStepPrecommit = RoundStep(0x12) // Did precommit, gossip precommits
|
||||
RoundStepCommit = RoundStep(0x20) // Entered commit state machine
|
||||
)
|
||||
|
||||
func (rs RoundStep) String() string {
|
||||
switch rs {
|
||||
case RoundStepNewHeight:
|
||||
return "RoundStepNewHeight"
|
||||
case RoundStepNewRound:
|
||||
return "RoundStepNewRound"
|
||||
case RoundStepPropose:
|
||||
return "RoundStepPropose"
|
||||
case RoundStepPrevote:
|
||||
return "RoundStepPrevote"
|
||||
case RoundStepPrecommit:
|
||||
return "RoundStepPrecommit"
|
||||
case RoundStepCommit:
|
||||
return "RoundStepCommit"
|
||||
default:
|
||||
panic(Fmt("Unknown RoundStep %X", rs))
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// RoundAction enum type
|
||||
|
||||
type RoundActionType uint8
|
||||
|
||||
const (
|
||||
RoundActionPropose = RoundActionType(0xA0) // Propose and goto RoundStepPropose
|
||||
RoundActionPrevote = RoundActionType(0xA1) // Prevote and goto RoundStepPrevote
|
||||
RoundActionPrecommit = RoundActionType(0xA2) // Precommit and goto RoundStepPrecommit
|
||||
RoundActionTryCommit = RoundActionType(0xC0) // Goto RoundStepCommit, or RoundStepPropose for next round.
|
||||
RoundActionCommit = RoundActionType(0xC1) // Goto RoundStepCommit upon +2/3 commits
|
||||
RoundActionTryFinalize = RoundActionType(0xC2) // Maybe goto RoundStepPropose for next round.
|
||||
)
|
||||
|
||||
func (ra RoundActionType) String() string {
|
||||
switch ra {
|
||||
case RoundActionPropose:
|
||||
return "RoundActionPropose"
|
||||
case RoundActionPrevote:
|
||||
return "RoundActionPrevote"
|
||||
case RoundActionPrecommit:
|
||||
return "RoundActionPrecommit"
|
||||
case RoundActionTryCommit:
|
||||
return "RoundActionTryCommit"
|
||||
case RoundActionCommit:
|
||||
return "RoundActionCommit"
|
||||
case RoundActionTryFinalize:
|
||||
return "RoundActionTryFinalize"
|
||||
default:
|
||||
panic(Fmt("Unknown RoundAction %X", ra))
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
type RoundAction struct {
|
||||
Height uint // The block height for which consensus is reaching for.
|
||||
Round uint // The round number at given height.
|
||||
@@ -167,7 +218,7 @@ func (rs *RoundState) StringIndented(indent string) string {
|
||||
}
|
||||
|
||||
func (rs *RoundState) StringShort() string {
|
||||
return fmt.Sprintf(`RS{%v/%v/%X %v}`,
|
||||
return fmt.Sprintf(`RoundState{H:%v R:%v S:%v ST:%v}`,
|
||||
rs.Height, rs.Round, rs.Step, rs.StartTime)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user