Process atts and update head before proposing - #10653
Merged
Merged
Conversation
terencechain
commented
May 6, 2022
Comment on lines
+148
to
+150
| // Only one process can process attestations and update head at a time. | ||
| s.processAttestationsLock.Lock() | ||
| defer s.processAttestationsLock.Unlock() |
Collaborator
Author
There was a problem hiding this comment.
This is the only addition from the refactor above
terencechain
commented
May 6, 2022
| } | ||
|
|
||
| if err := vs.HeadUpdater.ProcessAttestationsAndUpdateHead(ctx); err != nil { | ||
| log.WithError(err).Error("Could not process attestations and update head") |
Collaborator
Author
There was a problem hiding this comment.
Opt it to log an error instead of return error. Error from this call should not prevent block proposal
terencechain
marked this pull request as ready for review
May 6, 2022 15:16
terencechain
marked this pull request as draft
May 6, 2022 15:16
terencechain
marked this pull request as ready for review
May 6, 2022 17:50
rauljordan
reviewed
May 9, 2022
| // HeadUpdater defines a common interface for methods in blockchain service | ||
| // which allow to update the head info | ||
| type HeadUpdater interface { | ||
| ProcessAttestationsAndUpdateHead(context.Context) error |
Contributor
There was a problem hiding this comment.
Is there no way to separate this? Can head updater have two functions?
rauljordan
reviewed
May 9, 2022
| } | ||
|
|
||
| // ProcessAttestationsAndUpdateHead processes fork choice attestations from the pool and updates the head. | ||
| func (s *Service) ProcessAttestationsAndUpdateHead(ctx context.Context) error { |
Contributor
There was a problem hiding this comment.
We're combining multiple concerns here. It feels a lot cleaner to have the caller do update head after forkchoice attestations are processed
rauljordan
reviewed
May 9, 2022
| }() | ||
| } | ||
|
|
||
| // UpdateHead processes fork choice attestations from the pool and updates the head. |
Contributor
There was a problem hiding this comment.
We should say that it updates the canonical head of the chain based on information from fork-choice attestations and votes. It requires no external inputs.
rauljordan
approved these changes
May 9, 2022
rkapka
pushed a commit
that referenced
this pull request
May 11, 2022
* Process atts and updeate head * Fix ctx * New test and old tests * Update validator_test.go * Update validator_test.go * Update service.go * Rename to UpdateHead * Update receive_attestation.go * Update receive_attestation.go Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
prylabs-bulldozer Bot
added a commit
that referenced
this pull request
May 16, 2022
* SubmitBlockSSZ grpc * SubmitBlockSSZ middleware * test fixes * use VersionedUnmarshaller * use VersionedUnmarshaller (cherry picked from commit 7388eeb) * tests * fuzz: Add fuzz tests for sparse merkle trie (#10662) * Add fuzz tests for sparse merkle trie and change HTR signature to return an error * fix capitalization of error message * Add engine timeout values (#10645) * Add timeout values * Update engine_client.go * Update engine_client.go * Update beacon-chain/powchain/engine_client.go Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Update beacon-chain/powchain/engine_client.go Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Update beacon-chain/powchain/engine_client.go Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Update engine_client.go Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Cleanup of `stategen` package (#10607) * powchain and stategen * revert powchain changes * rename field to blockRootsOfSavedStates * rename params to blockRoot * review feedback * fix loop Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> * Process atts and update head before proposing (#10653) * Process atts and updeate head * Fix ctx * New test and old tests * Update validator_test.go * Update validator_test.go * Update service.go * Rename to UpdateHead * Update receive_attestation.go * Update receive_attestation.go Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> * Add link to e2e docs in `README` (#10672) * Improve `ReceiveBlock`'s comment (#10671) Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> * Call fcu on invalid payload (#10565) * Starting * remove finalized root * Just call fcu * Review feedbacks * fix one test * Fix conflicts * Update execution_engine_test.go * Add a test for invalid recursive call * Add comprehensive recursive test * dissallow override empty hash Co-authored-by: Potuz <potuz@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> * Cache and use justified and finalized payload block hash (#10657) * Cache and use justified and finalized payload block hash * Fix tests * Use real byte * Fix conflicts Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> * do not export slotFromBlock * simplify tests * grpc * middleware * extract package-level consts * Simplify SSZ handling * fix tests * test fixes * test hack Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> Co-authored-by: terencechain <terence@prysmaticlabs.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Potuz <potuz@prysmaticlabs.com>
|
Do not merge this account |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implements ethereum/consensus-specs#2878
Joined work with @potuz
This PR refactors out
ProcessAttestationsAndUpdateHeadwith a lock to only allow one caller at a time to avoid race between: