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

Gsf5 fixes #4312

Merged
merged 10 commits into from
Jul 26, 2022
Merged

Gsf5 fixes #4312

merged 10 commits into from
Jul 26, 2022

Conversation

MarekM25
Copy link
Contributor

@MarekM25 MarekM25 commented Jul 25, 2022

Fix issues that we noticed during transition on GSF5

@MarekM25 MarekM25 requested a review from asdacap July 25, 2022 20:58
@MarekM25 MarekM25 marked this pull request as ready for review July 26, 2022 07:06

// edge-case detected on GSF5 - during the transition we want to try process all transition blocks from CL client
// The last condition: !parentBlockInfo.IsBeaconBody will be true for terminal blocks. Checking _posSwitcher.IsTerminal might not be the best, because we're loading parentHeader with DoNotCalculateTotalDifficulty option
bool forceProcessing = !_poSSwitcher.TransitionFinished && (_blockTree.Head?.Number ?? 0) + 8 >= block.Number && !parentBlockInfo.IsBeaconBody;
Copy link
Contributor

Choose a reason for hiding this comment

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

8?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're using 8 here too: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Nethermind.Facade/Eth/EthSyncingInfo.cs#L37

I should change this condition bool weAreCloseToHead = (_blockTree.Head?.Number ?? 0) + 8 >= block.Number;

public bool ValidateSeal(BlockHeader header, bool force) =>
_poSSwitcher.IsPostMerge(header) || _preMergeSealValidator.ValidateSeal(header, force);
public bool ValidateSeal(BlockHeader header, bool force) =>
_poSSwitcher.GetBlockConsensusInfo(header, true).IsPostMerge || _preMergeSealValidator.ValidateSeal(header, force);
Copy link
Contributor

Choose a reason for hiding this comment

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

qq: why we don't check the seal if it is post merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is PoW specific thing, so we don't have it post merge

Copy link
Contributor

Choose a reason for hiding this comment

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

Isnt seal mean the hash?

Copy link
Contributor

Choose a reason for hiding this comment

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

Isnt seal mean the hash?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -180,7 +180,8 @@ public void AddNewBlock(Block block, ISyncPeer nodeWhoSentTheBlock)

bool isBlockBeforeTheSyncPivot = block.Number < _pivotNumber;
bool isBlockOlderThanMaxReorgAllows = block.Number < (_blockTree.Head?.Number ?? 0) - Sync.MaxReorgLength;
bool isBlockTotalDifficultyLow = block.TotalDifficulty < _blockTree.BestSuggestedHeader.TotalDifficulty;
bool isBlockTotalDifficultyLow = block.TotalDifficulty < _blockTree.BestSuggestedHeader.TotalDifficulty
&& (_specProvider.TerminalTotalDifficulty == null || block.TotalDifficulty < _specProvider.TerminalTotalDifficulty); // terminal blocks with lower TTD might be useful for smooth merge transition
Copy link
Contributor

Choose a reason for hiding this comment

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

What if there are two terminal block and the lower one appear later? I assume it must go through NP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If terminal block appears later that shouldn't be block choosen by CL clients to build chain on top of it. However, in this case we will get NP(childOfTerminalBlock) we will return SYNCING and we should be able to catch up with MergeBlockDownloader

@MarekM25 MarekM25 requested a review from asdacap July 26, 2022 08:18
@MarekM25
Copy link
Contributor Author

The workflow is not starting the tests, but I run them locally.

@MarekM25 MarekM25 merged commit b1080ef into master Jul 26, 2022
@MarekM25 MarekM25 deleted the gsf5_fixes branch July 26, 2022 09:39
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.

2 participants