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

Beacon reorgs during the sync #4243

Merged
merged 87 commits into from
Jul 22, 2022
Merged

Beacon reorgs during the sync #4243

merged 87 commits into from
Jul 22, 2022

Conversation

MarekM25
Copy link
Contributor

@MarekM25 MarekM25 commented Jul 5, 2022

Draft for discussion with @LukaszRozmej

@MarekM25 MarekM25 changed the base branch from master to merge/testing July 5, 2022 10:47
# Conflicts:
#	src/Nethermind/Nethermind.Merge.Plugin/Synchronization/MergeBlockDownloader.cs
#	src/Nethermind/Nethermind.Runner/configs/ropsten.cfg
#	src/Nethermind/Nethermind.Runner/configs/sepolia.cfg
Base automatically changed from merge/testing to master July 17, 2022 23:12
limit:
description: 'Limit for hive tests'
required: false
type: string
hive:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NP: Why move?

bool fillBeaconBlock = options.ContainsFlag(BlockTreeSuggestOptions.FillBeaconBlock);
bool setAsMain = options.ContainsFlag(BlockTreeSuggestOptions.ForceSetAsMain) ||
!options.ContainsFlag(BlockTreeSuggestOptions.ForceDontSetAsMain) && !shouldProcess;

if (_logger.IsTrace) _logger.Trace($"Suggesting a new block. BestSuggestedBlock {BestSuggestedBody}, BestSuggestedBlock TD {BestSuggestedBody?.TotalDifficulty}, Block TD {block?.TotalDifficulty}, Head: {Head}, Head TD: {Head?.TotalDifficulty}, Block {block?.ToString(Block.Format.FullHashAndNumber)}. ShouldProcess: {shouldProcess}, TryProcessKnownBlock: {fillBeaconBlock}, SetAsMain {setAsMain}");
if (_logger.IsTrace)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You and @LukaszRozmej seems to keep switching style. Can you sync your IDE or try not to change.

MoveToBeaconMainChain = 32,

BeaconBlockInsert = TotalDifficultyNotNeeded | BeaconInsert | MoveToBeaconMainChain | NotOnMainChain
BeaconHeaderMetadata = 2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np: Can you use a verb for this, like MarkBeaconHeaderMetadata

{
int processingQueueCount = _processingQueue.Count;
if (!blockInfo.IsBeaconMainChain && blockInfo.IsBeaconInfo)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, this mean it have blocks from NP that is not marked as main? What does this mean? Can you add comment?

}
BlockInfo predecessorInfo = _blockTree.GetInfo(predecessor.Number, predecessor.GetOrCalculateHash()).Info;
predecessorInfo.BlockNumber = predecessor.Number;
if (predecessorInfo.IsBeaconMainChain) break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference from IsBeaconMainChain then just main chain?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BeaconMainChain wasn't validated. It just new payloads from CL clients.

@MarekM25 MarekM25 marked this pull request as ready for review July 22, 2022 11:47
@MarekM25 MarekM25 merged commit 7116a82 into master Jul 22, 2022
@MarekM25 MarekM25 deleted the merge/beacon_chain_reorg_sync branch July 22, 2022 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants