Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Consensus] Revert unsealed reason #1332

Merged
merged 7 commits into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions engine/consensus/approvals/tracker/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tracker

import (
"encoding/hex"
"encoding/json"
"fmt"

"github.com/onflow/flow-go/model/flow"
Expand Down Expand Up @@ -32,11 +33,18 @@ func (r *SealingRecord) ApprovalsMissing(chunksWithMissingApprovals map[uint64]f
sufficientApprovals := len(chunksWithMissingApprovals) == 0
r.entries["sufficient_approvals_for_sealing"] = sufficientApprovals
if !sufficientApprovals {
indices := make([]string, 0, len(chunksWithMissingApprovals))
chunksInfo := make([]map[string]interface{}, 0, len(chunksWithMissingApprovals))
for i, list := range chunksWithMissingApprovals {
indices = append(indices, fmt.Sprintf("chunk_index: %v, verifier_ids: %v", i, list))
chunk := make(map[string]interface{})
chunk["chunk_index"] = i
chunk["missing_approvals_from_verifiers"] = list
chunksInfo = append(chunksInfo, chunk)
}
r.entries["chunks_with_insufficient_approvals"] = indices
bytes, err := json.Marshal(chunksInfo)
if err != nil {
bytes = []byte("failed to marshal data about chunks with missing approvals")
}
r.entries["chunks_with_insufficient_approvals"] = string(bytes)
}
}

Expand Down
20 changes: 1 addition & 19 deletions engine/consensus/approvals/tracker/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package tracker
import (
"encoding/hex"
"encoding/json"
"fmt"
"time"

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

// dump observation to Logger
observation = observation.Int64("duration_ms", time.Since(st.startTime).Milliseconds())
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)
observation.Msg("sealing observation")
}

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