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

[Merged by Bors] - Fixed Gossip Topics on Fork Boundary #2619

Closed
wants to merge 4 commits into from

Conversation

ethDreamer
Copy link
Member

Issue Addressed

The p2p-interface section of the altair spec says you should subscribe to the topics for a fork "In advance of the fork" and unsubscribe from old topics 2 Epochs after the new fork is activated. We've chosen to subscribe to new fork topics 2 slots before the fork is initiated.

This function is supposed to return the required fork digests at any given time but as it was currently written, it doesn't return the fork digest for a previous fork if you've switched to the current fork less than 2 epoch's ago. Also this function required modification for every new fork we add.

Proposed Changes

Make this function fork-agnostic and correctly handle the previous fork topic digests when you've only just switched to the new fork.

@ethDreamer ethDreamer force-pushed the fix_gossip_fork_digests branch from 0c57ee3 to df8be87 Compare September 24, 2021 01:01
@AgeManning
Copy link
Member

@pawanjay176 and I had a chat about this internally: see #2532 .

There are modifications we should do (as you've pointed out) to the logic as its currently written. However, the current concern is that the current code has been tested across a number of testnet forks. Mainnet is the next in line to fork and we are hesitant to change any fork-switching logic and go into a mainnet fork with untested code.

I think we want this PR (and some of the other things we've discussed internally) but we probably should wait until after the mainnet fork.

@pawanjay176
Copy link
Member

To add to what Age said, I don't think we should complicate our logic to subscribe to previous fork topics if we start our node between fork_epoch to fork_epoch + 2.

In my understanding, the unsubscribe after 2 epochs is to ensure that we unsubscribe only after lagging gossip messages on pre-fork topics are received by all nodes. The restarted node could potentially loose out on useful pre-fork attestations and aggregates, but that would only be 1-2 slots worth which is okay imo. Also most nodes would not restart during the fork transition so I'm not totally convinced we should handle this case.

Re not making the function fork agnostic, I only realised that it's ugly after the prater fork, so that's totally on me 😅
But as Age pointed out, what we have worked for the prater fork and I would be hesitant to go into the mainnet fork with fork switching logic that's untested on public testnets.

@ethDreamer ethDreamer force-pushed the fix_gossip_fork_digests branch from a6f2f96 to 6aa61b6 Compare September 24, 2021 18:59
@ethDreamer
Copy link
Member Author

most nodes would not restart during the fork transition

Ah - It wasn't obvious to me from the context that this code would only be called during startup and that this deviation from the spec would only cause minor problems in that limited context

Originally I thought this wasn't complicated but yeah I suppose in the context of node startup it would mean we'd have to be careful about setting the next_unsubscribe delay because currently we only set it after crossing a fork boundary.

I've removed subscribing to previous fork topics.

@AgeManning @pawanjay176
Does it look good to you guys now? I just want to get this PR to a place where it's ready to be merged into unstable - we don't have to do it until after the mainnet altair fork but having it ready allows me to merge it into the merge-f2f branch and will make the diff easier to read when it is eventually merged into unstable

Copy link
Member

@pawanjay176 pawanjay176 left a comment

Choose a reason for hiding this comment

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

LGTM. Just a minor nit.

beacon_node/network/src/service.rs Outdated Show resolved Hide resolved
@pawanjay176
Copy link
Member

I think this can be unblocked now that the altair fork is done.

@michaelsproul michaelsproul added ready-for-review The code is ready for review and removed blocked labels Oct 28, 2021
Copy link
Member

@AgeManning AgeManning left a comment

Choose a reason for hiding this comment

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

LGTM! Nice

@AgeManning
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Oct 29, 2021
## Issue Addressed

The [p2p-interface section of the `altair` spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/p2p-interface.md#transitioning-the-gossip) says you should subscribe to the topics for a fork "In advance of the fork" and unsubscribe from old topics `2 Epochs` after the new fork is activated. We've chosen to subscribe to new fork topics `2 slots` before the fork is initiated.

This function is supposed to return the required fork digests at any given time but as it was currently written, it doesn't return the fork digest for a previous fork if you've switched to the current fork less than 2 epoch's ago. Also this function required modification for every new fork we add.

## Proposed Changes

Make this function fork-agnostic and correctly handle the previous fork topic digests when you've only just switched to the new fork.
@bors bors bot changed the title Fixed Gossip Topics on Fork Boundary [Merged by Bors] - Fixed Gossip Topics on Fork Boundary Oct 29, 2021
@bors bors bot closed this Oct 29, 2021
@ethDreamer ethDreamer deleted the fix_gossip_fork_digests branch December 19, 2022 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-review The code is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants