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

Request: VC option to submit messages to all connected beacon nodes #4684

Closed
xrchz opened this issue Aug 30, 2023 · 12 comments
Closed

Request: VC option to submit messages to all connected beacon nodes #4684

xrchz opened this issue Aug 30, 2023 · 12 comments
Labels
enhancement New feature or request

Comments

@xrchz
Copy link
Contributor

xrchz commented Aug 30, 2023

Description

Sometimes to maximise the chance of timely inclusion a node operator may want to have their validator client submit duties (attestations and proposals) to all connected beacon nodes, for redundancy. (This should be safe since only one validator client is operating so all submitted attestations should be the same and compatible, even if they are seen by different parts of the network initially.)

Version

All versions so far (up to 4.3.0).

Present Behaviour

Currently Lighthouse does not support broadcasting to all connected beacon nodes, and instead seems to only submit to the first/best node it knows about.

This seems to be the behaviour despite the existence of the --disable-run-on-all option.

Expected Behaviour

When provided with an appropriate option (e.g. --broadcast-duties), submit duties to all connected beacon nodes.

@xrchz
Copy link
Contributor Author

xrchz commented Aug 30, 2023

Seems related to #3001

@xrchz
Copy link
Contributor Author

xrchz commented Oct 10, 2023

I'm guessing the place to edit for this would be validator_client/src/beacon_node_fallback.rs, in particular the first_success function could be changed (or another version added) that runs on all successes instead of stopping as soon as it finds one.

@michaelsproul
Copy link
Member

@xrchz There are functions in there called run, and run_on_all that have that behaviour. They don't support gathering data from all endpoints (e.g. forming attestations), but could be used for broadcasts

@michaelsproul
Copy link
Member

How it works at the moment is that subscriptions for duties are broadcast, but the messages themselves (blocks + attestations) are not. We could add a new flag to replace --disable-run-on-all called --broadcast-subscriptions (taking a bool) and a new flag/flags to control the broadcast of messages, e.g. --broadcast-attestations, --broadcast-blocks, etc

@xrchz
Copy link
Contributor Author

xrchz commented Oct 10, 2023

Yes I like those flag suggestions.

@xrchz xrchz changed the title Request: VC option to submit duties to all connected beacon nodes Request: VC option to submit messages to all connected beacon nodes Oct 26, 2023
@chong-he chong-he added the enhancement New feature or request label Oct 26, 2023
@uvizhe
Copy link
Contributor

uvizhe commented Nov 8, 2023

Hi, I'm ready to make a PR for this issue.

I've a few questions, however:

  1. Am I correct that broadcasting is only required for these API calls: publish_signed_block_contents and post_beacon_pool_attestations?
  2. Currently --disable-run-on-all flag affects these calls: post_validator_beacon_committee_subscriptions, post_validator_sync_committee_subscriptions, and post_validator_prepare_beacon_proposer. Is it right to attribute all three to --broadcast-subscriptions flag? I'm not sure about the latter one.

@michaelsproul
Copy link
Member

Hey @uvizhe thanks for working on this

  1. Those 2 are the main ones, but there's also post_beacon_pool_sync_committee_signatures
  2. Good point about post_validator_prepare_beacon_proposer. I think grouping it with the subscriptions is fine for now, we can always add a distinct flag for it later if that proves useful.

@uvizhe
Copy link
Contributor

uvizhe commented Nov 8, 2023

Thanks for a quick response, @michaelsproul!

So, to which of new flags post_beacon_pool_sync_committee_signatures is related? :)

Also, I'd like to have some integration tests for this, but I'm not familiar with your code base. Can you tell me if it's possible to quickly add such tests and where should I look for a reference, or should I abandon this idea (I don't really want to create new test harnesses, looks out of scope of this issue).

@michaelsproul
Copy link
Member

So, to which of new flags post_beacon_pool_sync_committee_signatures is related?

I think it would be best as its own flag: --broadcast-sync-committee-messages.

Also, I'd like to have some integration tests for this, but I'm not familiar with your code base.

The validator client tests are a bit weird at the moment. You could try adding something in testing/simulator, or we can leave it for a follow-up issue.

There are also CLI tests in lighthouse/tests that just confirm the CLI plumbing

@uvizhe
Copy link
Contributor

uvizhe commented Nov 8, 2023

Got it, thanks.

So we got:

  • --broadcast-attestations for post_beacon_pool_attestations
  • --broadcast-blocks for publish_signed_block_contents
  • --broadcast-sync-committee-messages for post_beacon_pool_sync_committee_signatures
  • --broadcast-subscriptions for post_validator_beacon_committee_subscriptions, post_validator_sync_committee_subscriptions, and post_validator_prepare_beacon_proposer

Maybe it would be more convenient to have a single --broadcast flag, which accepts multiple keywords like blocks, subscriptions? (This makes a code more complex however)

@michaelsproul
Copy link
Member

I like the single broadcast flag option actually! If you use strum on the enum it should be OK from a complexity PoV. Just splitting the commas might be a bit annoying.

michaelsproul pushed a commit that referenced this issue Nov 27, 2023
* multiple broadcast flags

* rewrite with single --broadcast option

* satisfy cargo fmt

* shorten sync-committee-messages

* fix a doc comment and a test

* use strum

* Add broadcast test to simulator

* bring --disable-run-on-all flag back with deprecation notice
@michaelsproul
Copy link
Member

Closed by #4920.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants