-
Notifications
You must be signed in to change notification settings - Fork 437
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
Fix MergeBlockDownloader keep repeating last block #4390
Fix MergeBlockDownloader keep repeating last block #4390
Conversation
# Conflicts: # src/Nethermind/Nethermind.Merge.Plugin.Test/EngineModuleTests.Setup.cs # src/Nethermind/Nethermind.Merge.Plugin.Test/Synchronization/BeaconHeadersSyncTests.cs # src/Nethermind/Nethermind.Merge.Plugin/Handlers/V1/NewPayloadV1Handler.cs # src/Nethermind/Nethermind.Merge.Plugin/Synchronization/BeaconHeadersSyncFeed.cs
# Conflicts: # src/Nethermind/Nethermind.Merge.Plugin/Synchronization/ChainLevelHelper.cs
# Conflicts: # src/Nethermind/Nethermind.JsonRpc/JsonRpcUrl.cs # src/Nethermind/Nethermind.JsonRpc/JsonRpcUrlCollection.cs # src/Nethermind/Nethermind.Merge.Plugin/Synchronization/ChainLevelHelper.cs # src/Nethermind/Nethermind.Runner/configs/catalyst.cfg # src/Nethermind/Nethermind.Runner/configs/goerli_shadowfork.cfg # src/Nethermind/Nethermind.Runner/configs/mainnet_shadowfork.cfg
if (_logger.IsDebug) | ||
_logger.Debug($"Parent of block not available. Starting new beacon header. sync."); | ||
|
||
StartNewBeaconHeaderSync(forkchoiceState, newHeadBlock!, requestStr); |
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.
Is it possible scenario?
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'm guessing this could trigger it. https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Nethermind.Merge.Plugin/Handlers/V1/NewPayloadV1Handler.cs#L130
BlockHeader? blockParent = _blockTree.FindHeader(newHeadBlock.ParentHash!); | ||
if (blockParent == null) | ||
{ | ||
if (_logger.IsDebug) |
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.
maybe Logger.IsInfo to be able to distinguish situations for now
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.
Ok
@@ -169,10 +169,10 @@ public async Task<ResultWrapper<PayloadStatusV1>> HandleAsync(ExecutionPayloadV1 | |||
|
|||
BlockTreeInsertOptions insertOptions = BlockTreeInsertOptions.BeaconBlockInsert; | |||
|
|||
if (_blockCacheService.ProcessDestination != null && _blockCacheService.ProcessDestination.Hash == block.ParentHash) | |||
if (_beaconPivot.ProcessDestination != null && _beaconPivot.ProcessDestination.Hash == block.ParentHash) |
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.
What if we don't have BeaconPivot here? It could be in two cases:
- We're doing sync from PoW chain and we have parent (no need to start beacon header sync), but we haven't processed blocks yet.
- We have a timeout in newPayload(x) and we have next newPayload(x+1) in this case we don't have beacon pivot at all.
So I think if we shouldn't EnsurePivot in this if. WDYT?
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.
Ah great... well I'm gonna put that as out of scope.
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.
but it could introduce regression in such cases
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.
Why? This is a rename.
@@ -91,6 +93,10 @@ public void EnsurePivot(BlockHeader? blockHeader) | |||
return; | |||
} | |||
|
|||
// BeaconHeaderSync actually starts from the parent of the pivot. So we need to to manually insert | |||
// the pivot itself here. | |||
_blockTree.Insert(blockHeader, |
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 thought that we're adding it in TryInsertDanglingBlock. Aren't we?
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.
Not if beacon header sync is not started yet.
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.
Added a few comments
return ForkchoiceUpdatedV1Result.Syncing; | ||
} | ||
|
||
BlockInfo blockInfo = _blockTree.GetInfo(newHeadBlock.Number, newHeadBlock.GetOrCalculateHash()).Info; | ||
if (!blockInfo.WasProcessed) | ||
{ | ||
BlockHeader? blockParent = _blockTree.FindHeader(newHeadBlock.ParentHash!); |
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.
do we have any unit tests for this if?
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.
Not sure.
# Conflicts: # src/Nethermind/Nethermind.Merge.Plugin.Test/EngineModuleTests.Synchronization.cs # src/Nethermind/Nethermind.Merge.Plugin/Handlers/V1/NewPayloadV1Handler.cs
…oader-keep-suggesting-block
…oader-keep-suggesting-block
Changes:
Types of changes
What types of changes does your code introduce?
Put an
x
in the boxes that applyTesting
Requires testing
In case you checked yes, did you write tests??
Comments about testing , should you have some (optional)
Incremental Sync
hive test passes on previous test version if test is modified to not check synched via head.Sync Client Post Merge
hive test passed.Only 4 test from
engine-transition
hive test failed, which is a known regression on master.Still state-syncing ropsten.
Further comments (optional)
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...