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

core, eth, ethstats: simplify chain head events #30601

Merged
merged 3 commits into from
Oct 16, 2024

Conversation

karalabe
Copy link
Member

@karalabe karalabe commented Oct 15, 2024

Chain events currently pass blocks everywhere. Which is funky, because the first thing all receivers do is extract out the headers and throw the block away :). This PR changes all the event content to only pass the headers around.

Open quetsions:

  • We don't use the ChainSideEvent for anything. Can we drop it? I dropped it in the second commit.

Reverted the below change until we figure it out:

  • We only use ChainEvent in the filter system, but why don't we use ChainHeadEvent instead? Can we drop it? I dropped it in the third commit.
    • The side effect here is that when importing a batch of blocks, there will be no head events emitted for individual ones, rather only one for the entire batch. This might be a breaking API change, though it is how we ourselves use Geth internally, so maybe it's better to have the same events on the outside too.
    • Even this needs maybe a thought, since batch imports of blocks via the downloader isn't a true chain head event as there was no ForkChoiceUpdate from the consensus client. Wouldn't it be better to only fire chain head events that we receive from consensus? Seems maybe saner?

This is the crux of the PR, the rest is just fixing up the fallout:

Screenshot 2024-10-15 at 13 40 46

@karalabe karalabe added this to the 1.14.12 milestone Oct 15, 2024
@MariusVanDerWijden
Copy link
Member

Are we emitting these chain events in the downloader on snap sync as well? If so I would vote to remove it, if it is only on full sync, I would kinda understand that it could be useful for someone, but still the usefulness is so marginal, that I would remove it

@holiman
Copy link
Contributor

holiman commented Oct 15, 2024

I agree about removing the heavy blocks, and reducing the subscription throughput. But then I'm not a consumer of these subscriptions, and can't really say whether this will break someone's usecase.

@holiman
Copy link
Contributor

holiman commented Oct 15, 2024

@fjl any thoughts?

@karalabe karalabe force-pushed the headers-in-chain-events branch from 8fd6c3d to bc315ff Compare October 16, 2024 06:41
@karalabe
Copy link
Member Author

I've reverted the last commit until we figure it out. The rest of the PR is essentially a noop cleanup. It is not observable from the outside in any way shape or form.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

@karalabe karalabe merged commit 368e16f into ethereum:master Oct 16, 2024
2 of 3 checks passed
zfy0701 pushed a commit to sentioxyz/go-ethereum that referenced this pull request Dec 3, 2024
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.

4 participants