-
Notifications
You must be signed in to change notification settings - Fork 473
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
Merge sync downloader optimisation #4044
Conversation
dd4f736
to
2a3dd1a
Compare
95bffdc
to
399f5ac
Compare
2dc263d
to
ae1de29
Compare
4a25ad4
to
9c7b7be
Compare
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 think we need more tests for BeaconHeaderSync.
We should discuss changes
src/Nethermind/Nethermind.Merge.Plugin/Synchronization/BeaconHeadersSyncFeed.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Merge.Plugin/Synchronization/BeaconHeadersSyncFeed.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Merge.Plugin/Synchronization/BeaconSync.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Merge.Plugin/Synchronization/ChainLevelHelper.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Merge.Plugin/Synchronization/ChainLevelHelper.cs
Outdated
Show resolved
Hide resolved
@avalonche @LukaszRozmej We need to think about the scenario when we're in archive mode and we've finished beacon headers sync. If we start adding to blockchain queue blocks, we could end up with the whole blockchain in the archive node queue. I know that we have a recovery queue. However, it might be a problem. So maybe we should limit adding to the blockchain queue (based on BlockchainProcessor.Count). WDYT? |
9c7b7be
to
77d16e0
Compare
@@ -100,45 +103,28 @@ public class ChainLevelHelper : IChainLevelHelper | |||
return headers.ToArray(); | |||
} | |||
|
|||
public Block[]? GetNextBlocks(int maxCount) | |||
public void SetNextBlocks(int maxCount, BlockDownloadContext context) |
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.
NP: Recommend the term "Populate" instead of "Set" here. Or put this method in BlockDownloadContext
instead i guess.
src/Nethermind/Nethermind.Merge.Plugin/Synchronization/MergeBlockDownloader.cs
Show resolved
Hide resolved
|
||
return blocks.ToArray(); | ||
public bool IsBeaconBlock(long blockNumber) |
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.
QQ: Why not put it inside block tree?
7579288
to
5aef836
Compare
src/Nethermind/Nethermind.Merge.Plugin/Synchronization/MergeBlockDownloader.cs
Outdated
Show resolved
Hide resolved
bestPeer.HeadNumber > _blockTree.BestKnownNumber; | ||
bestPeer.HeadNumber > currentNumber; | ||
|
||
bool foundBeaconBlocks = false; |
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.
Shouldn't we relay on chainLevelHelper instead of bool? I mean if we're calling GetNextHeaders we should get in response if we found beacon blocks. If true we should download blocks for this headers package
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 small comments
c381b14
to
1c525ac
Compare
1c525ac
to
718b05e
Compare
if (_logger.IsTrace) _logger.Trace($"ChainLevelHelper - block {startingPoint} not found"); | ||
continue; | ||
Block? block = _blockTree.FindBlock(hashesToRequest[i], BlockTreeLookupOptions.None); | ||
if (block == null) continue; |
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.
Shouldn't we return false here?
Fixes | Closes | Resolves #
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)
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...