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

Restrict sync committee messages to optimistic blocks #3151

Closed
paulhauner opened this issue Apr 8, 2022 · 3 comments
Closed

Restrict sync committee messages to optimistic blocks #3151

paulhauner opened this issue Apr 8, 2022 · 3 comments
Assignees
Labels
bellatrix Required to support the Bellatrix Upgrade v2.5.0 Required for Goerli merge release

Comments

@paulhauner
Copy link
Member

Description

The optimistic sync spec declares:

An optimistic validator MUST NOT participate in sync committees (i.e., sign across the DOMAIN_SYNC_COMMITTEE, DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF or DOMAIN_CONTRIBUTION_AND_PROOF domains).

We need to ensure that a Lighthouse BN/VC pair will not sign sync committee messages that reference an optimistic beacon_block_root.

Steps to resolve

The first change is to return an error in BeaconChain::get_aggregated_sync_committee_contribution whenever the sync_contribution being return references an optimistic beacon_block_root (see #3140 to see how this was done for attestations).

The second, more complicated change is to stop the VC from producing a SyncCommitteeMessage whenever that block references an optimistic head:

match self
.validator_store
.produce_sync_committee_signature(
slot,
beacon_block_root,
duty.validator_index,
&duty.pubkey,
)
.await

We can't just refuse to accept the already-signed SyncCommitteeMessage at the BN HTTP API for two reasons:

  • The message is dangerous and should never be signed, we need to prevent it being signed before it is submitted to the BN.
  • We don't want to restrict already signed messages, since we assume that the VC must have good advice from some other BN that the beacon_block_root is valid (e.g. when using multiple BNs).

I can see two options, both are blocked on #3070:

  1. Pass the execution_optimistic values around with the sync duties in the VC
    • Pros: doesn't require extra calls to the BN.
    • Cons: it's hard to ensure the execution_optimistic are up-to-date without frequent polling.
  2. Call /eth/v1/beacon/headers before producing the SyncCommitteeMessage and checking the execution_optimistic value before signing
    • Pros: always gets the latest info.
    • Cons: requires an extra call.

I'm leaning towards (2), since it's the easiest to implement and gives us the most up-to-date info. The call to beacon/headers should be nice and fast, so I don't think it's too much of a bottleneck.

@paulhauner paulhauner added the bellatrix Required to support the Bellatrix Upgrade label Apr 8, 2022
@macladson macladson self-assigned this Apr 13, 2022
@paulhauner
Copy link
Member Author

@michaelsproul I know you've done a lot of work on sync committees, so I'd be interested to know if what I've written makes sense and if you have a better suggestion? 🙏 ☺️

@michaelsproul
Copy link
Member

Looks good, and I favour option (2) as well. I don't even think we need an extra request because I think we could read the optimistic status when we fetch the block root here:

// Fetch block root for `SyncCommitteeContribution`.
let block_root = self
.beacon_nodes
.first_success(RequireSynced::Yes, |beacon_node| async move {
beacon_node.get_beacon_blocks_root(BlockId::Head).await
})
.await
.map_err(|e| e.to_string())?
.ok_or_else(|| format!("No block root found for slot {}", slot))?
.data
.root;

paulhauner pushed a commit to paulhauner/lighthouse that referenced this issue Jun 30, 2022
Update HTTP API to include `execution_optimistic` flag in responses

Add `execution_optimistic` to server-sent events

Fix formatting

Fix tests

Fix endpoint comment

Remove redundent calls to `get_block`

Fix route

Return correct `execution_optimistic` values for api queries by state

Updated api client functions

Refactor HTTP API tests

Return 404 when requested root is 0x000..000

Tidy up

Avoid recomputing head

More improvements

Use head when computing status for slot

Rebase on unstable

Add tests

Fix conflicts
@paulhauner paulhauner added the v2.5.0 Required for Goerli merge release label Jul 20, 2022
bors bot pushed a commit that referenced this issue Jul 26, 2022
## Issue Addressed

Resolves #3151 

## Proposed Changes

When fetching duties for sync committee contributions, check the value of `execution_optimistic` of the head block from the BN and refuse to sign any sync committee messages `if execution_optimistic == true`.

## Additional Info
- Is backwards compatible with older BNs
- Finding a way to add test coverage for this would be prudent. Open to suggestions.
bors bot pushed a commit that referenced this issue Jul 26, 2022
## Issue Addressed

Resolves #3151 

## Proposed Changes

When fetching duties for sync committee contributions, check the value of `execution_optimistic` of the head block from the BN and refuse to sign any sync committee messages `if execution_optimistic == true`.

## Additional Info
- Is backwards compatible with older BNs
- Finding a way to add test coverage for this would be prudent. Open to suggestions.
bors bot pushed a commit that referenced this issue Jul 27, 2022
## Issue Addressed

Resolves #3151 

## Proposed Changes

When fetching duties for sync committee contributions, check the value of `execution_optimistic` of the head block from the BN and refuse to sign any sync committee messages `if execution_optimistic == true`.

## Additional Info
- Is backwards compatible with older BNs
- Finding a way to add test coverage for this would be prudent. Open to suggestions.
@macladson
Copy link
Member

Implemented in #3191

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bellatrix Required to support the Bellatrix Upgrade v2.5.0 Required for Goerli merge release
Projects
None yet
Development

No branches or pull requests

3 participants