Skip to content

Commit

Permalink
traces the proposer
Browse files Browse the repository at this point in the history
  • Loading branch information
staheri14 committed Aug 21, 2024
1 parent f64fe43 commit 3a75988
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,8 @@ func (cs *State) enterPropose(height int64, round int32) {
}

if cs.isProposer(address) {
// trace if the node is the proposer
schema.WriteProposer(cs.traceClient, height, round, address.String())
logger.Debug("propose step; our turn to propose", "proposer", address)
cs.decideProposal(height, round)
} else {
Expand Down Expand Up @@ -1278,7 +1280,7 @@ func (cs *State) isReadyToPrevote() (bool, time.Duration) {
// Enter: `timeoutPropose` after entering Propose.
// Enter: proposal block and POL is ready.
// Prevote for LockedBlock if we're locked, or ProposalBlock if valid.
// Otherwise vote nil.
// Otherwise, vote nil.
func (cs *State) enterPrevote(height int64, round int32) {
logger := cs.Logger.With("height", height, "round", round)

Expand Down
18 changes: 18 additions & 0 deletions pkg/trace/schema/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func ConsensusTables() []string {
ProposalTable,
PrecommitTimeTable,
PrevoteDelayTable,
Proposer,
}
}

Expand Down Expand Up @@ -59,7 +60,24 @@ func (p PrevoteDelay) Table() string {

func WritePrevoteDelay(client trace.Tracer, height int64, round int32, delay float64) {
client.Write(PrevoteDelay{Height: height, Round: round, Delay: delay})
}

const Proposer = "consensus_proposer"

type ProposerInfo struct {
Height int64 `json:"height"`
Round int32 `json:"round"`
Address string `json:"address"`
}

func (p ProposerInfo) Table() string {
return Proposer

}

func WriteProposer(client trace.Tracer, height int64, round int32,
address string) {
client.Write(ProposerInfo{Height: height, Round: round, Address: address})
}

// Schema constants for the consensus round state tracing database.
Expand Down

0 comments on commit 3a75988

Please sign in to comment.