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

Fork choice upgrade #3290

Merged
merged 4 commits into from
Mar 15, 2023
Merged

Fork choice upgrade #3290

merged 4 commits into from
Mar 15, 2023

Conversation

adiasg
Copy link
Contributor

@adiasg adiasg commented Mar 13, 2023

This PR proposes a large fork choice upgrade, including:

  • Multiple improvements for resilience of the protocol
  • Clean-up:
    • Removing bouncing attack fix: Mitigations to the bouncing attack still allow for an attacker to split views around the SAFE_SLOTS_TO_UPDATE_JUSTIFIED mark. A detailed explanation of the issue by @fradamt is attached here. We remove the earlier fix, i.e., Store.best_justified_checkpoint and SAFE_SLOTS_TO_UPDATE_JUSTIFIED, leading to a massive simplification of the fork choice spec.
    • Strengthening equivocation discarding: Equivocation discarding only censored those validators for whom an AttesterSlashing is received. We strengthen this by also censoring validators who are slashed in the state of the Store.justified_checkpoint.

Fork choice test vectors:

Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

very nice! I mainly had some minor input on style and comments

specs/phase0/fork-choice.md Show resolved Hide resolved
specs/phase0/fork-choice.md Outdated Show resolved Hide resolved
specs/phase0/fork-choice.md Outdated Show resolved Hide resolved
specs/phase0/fork-choice.md Outdated Show resolved Hide resolved
specs/phase0/fork-choice.md Show resolved Hide resolved
specs/phase0/fork-choice.md Outdated Show resolved Hide resolved
specs/phase0/fork-choice.md Outdated Show resolved Hide resolved
specs/phase0/fork-choice.md Outdated Show resolved Hide resolved
specs/phase0/fork-choice.md Outdated Show resolved Hide resolved
specs/phase0/fork-choice.md Outdated Show resolved Hide resolved
adiasg and others added 2 commits March 14, 2023 13:54
Co-authored-by: Danny Ryan <dannyjryan@gmail.com>
Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

awesome! great work

@djrtwo djrtwo merged commit a0eb23f into dev Mar 15, 2023
@djrtwo djrtwo deleted the fork-choice-upgrade branch March 15, 2023 16:51
bors bot pushed a commit to sigp/lighthouse that referenced this pull request Mar 21, 2023
## Issue Addressed

NA

## Proposed Changes

- Implements ethereum/consensus-specs#3290
- Bumps `ef-tests` to [v1.3.0-rc.4](https://github.com/ethereum/consensus-spec-tests/releases/tag/v1.3.0-rc.4).

The `CountRealizedFull` concept has been removed and the `--count-unrealized-full` and `--count-unrealized` BN flags now do nothing but log a `WARN` when used.

## Database Migration Debt

This PR removes the `best_justified_checkpoint` from fork choice. This field is persisted on-disk and the correct way to go about this would be to make a DB migration to remove the field. However, in this PR I've simply stubbed out the value with a junk value. I've taken this approach because if we're going to do a DB migration I'd love to remove the `Option`s around the justified and finalized checkpoints on `ProtoNode` whilst we're at it. Those options were added in #2822 which was included in Lighthouse v2.1.0. The options were only put there to handle the migration and they've been set to `Some` ever since v2.1.0. There's no reason to keep them as options anymore.

I started adding the DB migration to this branch but I started to feel like I was bloating this rather critical PR with nice-to-haves. I've kept the partially-complete migration [over in my repo](https://github.com/paulhauner/lighthouse/tree/fc-pr-18-migration) so we can pick it up after this PR is merged.
etan-status added a commit to status-im/nimbus-eth2 that referenced this pull request May 5, 2023
The `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` constant is no longer used as the
bouncing attack fix was removed:
ethereum/consensus-specs#3290

Note: Some test networks still define the constant, ignoring the config
constant for now until it is no longer used.
etan-status added a commit to status-im/nimbus-eth2 that referenced this pull request May 5, 2023
The `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` constant is no longer used as the
bouncing attack fix was removed:
ethereum/consensus-specs#3290

Note: Some test networks still define the constant, ignoring the config
constant for now until it is no longer used.
etan-status added a commit to etan-status/eth2-networks that referenced this pull request May 5, 2023
The `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` constant is no longer used as the
bouncing attack fix was removed:
ethereum/consensus-specs#3290
etan-status added a commit to status-im/nimbus-eth2 that referenced this pull request May 5, 2023
The `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` constant is no longer used as the
bouncing attack fix was removed:
ethereum/consensus-specs#3290

Note: Some test networks still define the constant, ignoring the config
constant for now until it is no longer used.
@adiasg adiasg added the scope:security General protocol security-related items label May 11, 2023
dapplion pushed a commit to gnosischain/configs that referenced this pull request May 14, 2023
The `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` constant is no longer used as the
bouncing attack fix was removed:
ethereum/consensus-specs#3290
tersec pushed a commit to eth-clients/eth2-networks that referenced this pull request Jun 14, 2023
The `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` constant is no longer used as the
bouncing attack fix was removed:
ethereum/consensus-specs#3290
)

# If the previous epoch is justified, the block should be pulled-up. In this case, check that unrealized
# justification is higher than the store and that the voting source is not more than two epochs ago
Copy link
Member

Choose a reason for hiding this comment

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

Can you help explain this a bit more? I'm curious about the intuition behind it.

It seems to me that this contradict to the HLMD-GHOST in https://arxiv.org/pdf/2003.03052.pdf

L′ ← set of leaf blocks Bl in G such that (Bj , j) ∈ J(ffgview(Bl))

Woodpile37 pushed a commit to Woodpile37/lighthouse that referenced this pull request Jan 6, 2024
NA

- Implements ethereum/consensus-specs#3290
- Bumps `ef-tests` to [v1.3.0-rc.4](https://github.com/ethereum/consensus-spec-tests/releases/tag/v1.3.0-rc.4).

The `CountRealizedFull` concept has been removed and the `--count-unrealized-full` and `--count-unrealized` BN flags now do nothing but log a `WARN` when used.

This PR removes the `best_justified_checkpoint` from fork choice. This field is persisted on-disk and the correct way to go about this would be to make a DB migration to remove the field. However, in this PR I've simply stubbed out the value with a junk value. I've taken this approach because if we're going to do a DB migration I'd love to remove the `Option`s around the justified and finalized checkpoints on `ProtoNode` whilst we're at it. Those options were added in sigp#2822 which was included in Lighthouse v2.1.0. The options were only put there to handle the migration and they've been set to `Some` ever since v2.1.0. There's no reason to keep them as options anymore.

I started adding the DB migration to this branch but I started to feel like I was bloating this rather critical PR with nice-to-haves. I've kept the partially-complete migration [over in my repo](https://github.com/paulhauner/lighthouse/tree/fc-pr-18-migration) so we can pick it up after this PR is merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:fork-choice scope:security General protocol security-related items
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants