Skip to content

Commit

Permalink
log verifier ids for missing approvals (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Sep 22, 2021
1 parent 754530c commit 4342cd4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
7 changes: 3 additions & 4 deletions engine/consensus/approvals/tracker/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ func (r *SealingRecord) ApprovalsMissing(chunksWithMissingApprovals map[uint64]f
sufficientApprovals := len(chunksWithMissingApprovals) == 0
r.entries["sufficient_approvals_for_sealing"] = sufficientApprovals
if !sufficientApprovals {
indices := make([]uint64, 0, len(chunksWithMissingApprovals))
for i := range chunksWithMissingApprovals {
indices = append(indices, i)
indices := make([]string, 0, len(chunksWithMissingApprovals))
for i, list := range chunksWithMissingApprovals {
indices = append(indices, fmt.Sprintf("chunk_index: %v, verifier_ids: %v", i, list))
}
r.entries["chunks_with_insufficient_approvals"] = indices
}

}

func (r *SealingRecord) ApprovalsRequested(requestCount uint) {
Expand Down
20 changes: 19 additions & 1 deletion engine/consensus/approvals/tracker/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package tracker
import (
"encoding/hex"
"encoding/json"
"fmt"
"time"

"github.com/rs/zerolog"
Expand Down Expand Up @@ -170,7 +171,24 @@ func (st *SealingObservation) Complete() {

// dump observation to Logger
observation = observation.Int64("duration_ms", time.Since(st.startTime).Milliseconds())
observation.Msg("sealing observation")
reason := st.UnsealedReason()
observation.Msgf("sealing observation, unsealed reason: %v", reason)
}

func (st *SealingObservation) UnsealedReason() string {
if st.finalizedBlock == st.latestSealedBlock {
return "all finalized blocks have been sealed"
}

unsealedHeight := st.latestSealedBlock.Height + 1
if len(st.records) == 0 {
return fmt.Sprintf("no result found for next unsealed block at height: %v", unsealedHeight)
}

return fmt.Sprintf("unsealed block at height %v has been executed, the result has been incorporated on %v fork(s), "+
"but no result has received enough approvals, check the chunks_with_insufficient_approvals field for more details",
len(st.records),
unsealedHeight)
}

// latestFinalizedSealInfo returns a json string representation with the most
Expand Down

0 comments on commit 4342cd4

Please sign in to comment.