-
Notifications
You must be signed in to change notification settings - Fork 178
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] Approval Processing Core -> Sealing Core #736
Conversation
…/5417-approval-processing-engine
…/5417-approval-processing-engine
• refactored matching.Engine to separate trusted inputs (finalized blocks) from untrusted inputs (Receipts)
…y in sealing.Engine • extended goDoc
…ously removed); • added and updated some more goDoc
…b.com/onflow/flow-go into yurii/5216-repopulate-assignment-collector-tree
…b.com/onflow/flow-go into yurii/5216-repopulate-assignment-collector-tree
Codecov Report
@@ Coverage Diff @@
## master #736 +/- ##
==========================================
- Coverage 56.64% 56.38% -0.26%
==========================================
Files 423 423
Lines 25072 24783 -289
==========================================
- Hits 14203 13975 -228
+ Misses 8963 8913 -50
+ Partials 1906 1895 -11
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
• renamed method `AggregatedSignatures.CollectChunksWithMissingApprovals` to `ChunksWithoutAggregatedSignature()` • shifted the location of a few lines of code
• renamed internal variable
…ve crypto verifications
…ls are required; • ApprovalCollector: using consistently uint64 to refer to chunk indices and related quantities; • sealing.Engine: separated logic for creating inbound queues for trusted inputs from message handler for untrusted inputs;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 This PR is finally ready to be merged 🥳 🍾
I provided some minor revisions in PR #774 targeting this branch. Mostly revisions of goDoc and and inline comments and a tiny bit of polishing. The only noteworthy algorithmic addition is the implementation of my comment below.
This really turned out nicely. Great work. Thanks
numberOfChunks: numberOfChunks, | ||
chunkCollectors: chunkCollectors, | ||
aggregatedSignatures: NewAggregatedSignatures(uint64(numberOfChunks)), | ||
seals: seals, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering how this code will behave, when requiredApprovalsForSealConstruction = 0
. In this case, sealing should proceed, even if all verifiers are offline.
My theory on how the current implementation will behave is:
-
the only code paths reaching
ApprovalCollector.SealResult()
are:- emergency sealing
flow-go/engine/consensus/approvals/assignment_collector.go
Lines 139 to 143 in 7e5f2ed
func (ac *AssignmentCollector) CheckEmergencySealing(finalizedBlockHeight uint64) error { for _, collector := range ac.allCollectors() { sealable := ac.emergencySealable(collector, finalizedBlockHeight) if sealable { err := collector.SealResult() - processing an approval
flow-go/engine/consensus/approvals/approval_collector.go
Lines 89 to 110 in 7e5f2ed
func (c *ApprovalCollector) ProcessApproval(approval *flow.ResultApproval) error { chunkIndex := approval.Body.ChunkIndex if chunkIndex >= uint64(len(c.chunkCollectors)) { return engine.NewInvalidInputErrorf("approval collector chunk index out of range: %v", chunkIndex) } // there is no need to process approval if we have already enough info for sealing if c.aggregatedSignatures.HasSignature(chunkIndex) { return nil } collector := c.chunkCollectors[chunkIndex] aggregatedSignature, collected := collector.ProcessApproval(approval) if !collected { return nil } approvedChunks := c.aggregatedSignatures.PutSignature(chunkIndex, aggregatedSignature) if approvedChunks < c.numberOfChunks { return nil // still missing approvals for some chunks } return c.SealResult()
- emergency sealing
-
Hence, if all verifiers are offline, we will not generate seals until the result is emergency sealed, even if
requiredApprovalsForSealConstruction = 0
.
I think the better behaviour would be produce a candidate seal right away, as soon as we construct the ApprovalCollector
This is already implemented in PR #774
…ine_-_suggestions_pt4 PR 736: suggestions pt4
…b.com/onflow/flow-go into yurii/5216-repopulate-assignment-collector-tree
…/5417-approval-processing-engine
…b.com/onflow/flow-go into yurii/5216-repopulate-assignment-collector-tree
…ing already fixes the problem
Integration test fix for PR 736
Co-authored-by: Alexander Hentschel <alex.hentschel@axiomzen.co>
…collector-tree [Consensus] Repopulating of assignment collectors tree
…/5417-approval-processing-engine
This PR implements next issues:
Main changes: