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

Fix/miner downloader autopause #596

Merged
merged 4 commits into from
Dec 6, 2023
Merged

Conversation

meowsbits
Copy link
Contributor

Read https://github.com/ethereum/devp2p/blob/master/caps/eth.md#block-propagation.

This patch infers "synced" status by the successful status of a BlockFetcher-directed chain insertion.

The BlockFetcher type exclusively handles the (optional) fetching and (always) importing of block(s) received via the following wire protocol messages.

If a block is successfully inserted into our local chain by these means, the miner infers that we are synced, and disables the autopause-for-downloader-events mechanism.

Resolves #586

…er imports ok

The BlockFetcher handles importing announced
and broadcasted blocks, which are block notifications
supposed by peers to be at or near the canonical
head.

If we successfully import a block by the fetcher
channel, then, we can suppose ourselves to be
synced, and therefore should not longer
handle downloader sync attempts as eligible
for pausing mining.

This design assumes that the fetcher's
parameters assure that we can only import
relevant and valid head blocks locally;
ie. -7<n<32 blocks from our local head,
and having valid headers with existing parents,
etc.

Date: 2023-11-28 08:24:14-07:00
Signed-off-by: meows <[email protected]>
Date: 2023-11-28 08:39:49-07:00
Signed-off-by: meows <[email protected]>
This point in the code is important.
Its where the txpool is permitted
to accept txes, which is pending
sync completion.
The miner also cares about sync
completion, which is why the fetcher
fires the event here.

This commit only moves the relevvant
comment to a location which is hopefully
harder to accidentally get removed in a merge.

Date: 2023-11-29 16:24:04-07:00
Signed-off-by: meows <[email protected]>
The inserterFn type interface
uses types.Blocks.
We should not arbitrarily vary
from this pattern.
So use 'Chain' and types.Blocks
instead of the singular block.

Date: 2023-11-30 06:14:47-07:00
Signed-off-by: meows <[email protected]>
@meowsbits meowsbits requested review from diega and ziogaschr December 6, 2023 17:38
@meowsbits meowsbits changed the title Fix/miner downloader pause alt3 Fix/miner downloader autopause Dec 6, 2023
Copy link
Member

@ziogaschr ziogaschr left a comment

Choose a reason for hiding this comment

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

LGTM

@meowsbits meowsbits merged commit 972a75f into master Dec 6, 2023
5 checks passed
@meowsbits meowsbits deleted the fix/miner-downloader-pause-alt3 branch December 6, 2023 18:11
@ziogaschr ziogaschr mentioned this pull request Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node does not commit new sealing work when it should
2 participants