Fork choice modifications and cleanup (#3962)

## Issue Addressed

NA

## Proposed Changes

- Implements https://github.com/ethereum/consensus-specs/pull/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.
This commit is contained in:
Paul Hauner
2023-03-21 07:34:41 +00:00
parent 3ac5583cf9
commit 1f8c17b530
29 changed files with 217 additions and 414 deletions

View File

@@ -1,4 +1,4 @@
use beacon_node::{beacon_chain::CountUnrealizedFull, ClientConfig as Config};
use beacon_node::ClientConfig as Config;
use crate::exec::{CommandLineTestExec, CompletedTest};
use beacon_node::beacon_chain::chain_config::{
@@ -232,74 +232,58 @@ fn paranoid_block_proposal_on() {
.with_config(|config| assert!(config.chain.paranoid_block_proposal));
}
#[test]
fn count_unrealized_default() {
CommandLineTest::new()
.run_with_zero_port()
.with_config(|config| assert!(config.chain.count_unrealized));
}
#[test]
fn count_unrealized_no_arg() {
CommandLineTest::new()
.flag("count-unrealized", None)
.run_with_zero_port()
.with_config(|config| assert!(config.chain.count_unrealized));
// This flag should be ignored, so there's nothing to test but that the
// client starts with the flag present.
.run_with_zero_port();
}
#[test]
fn count_unrealized_false() {
CommandLineTest::new()
.flag("count-unrealized", Some("false"))
.run_with_zero_port()
.with_config(|config| assert!(!config.chain.count_unrealized));
// This flag should be ignored, so there's nothing to test but that the
// client starts with the flag present.
.run_with_zero_port();
}
#[test]
fn count_unrealized_true() {
CommandLineTest::new()
.flag("count-unrealized", Some("true"))
.run_with_zero_port()
.with_config(|config| assert!(config.chain.count_unrealized));
// This flag should be ignored, so there's nothing to test but that the
// client starts with the flag present.
.run_with_zero_port();
}
#[test]
fn count_unrealized_full_no_arg() {
CommandLineTest::new()
.flag("count-unrealized-full", None)
.run_with_zero_port()
.with_config(|config| {
assert_eq!(
config.chain.count_unrealized_full,
CountUnrealizedFull::False
)
});
// This flag should be ignored, so there's nothing to test but that the
// client starts with the flag present.
.run_with_zero_port();
}
#[test]
fn count_unrealized_full_false() {
CommandLineTest::new()
.flag("count-unrealized-full", Some("false"))
.run_with_zero_port()
.with_config(|config| {
assert_eq!(
config.chain.count_unrealized_full,
CountUnrealizedFull::False
)
});
// This flag should be ignored, so there's nothing to test but that the
// client starts with the flag present.
.run_with_zero_port();
}
#[test]
fn count_unrealized_full_true() {
CommandLineTest::new()
.flag("count-unrealized-full", Some("true"))
.run_with_zero_port()
.with_config(|config| {
assert_eq!(
config.chain.count_unrealized_full,
CountUnrealizedFull::True
)
});
// This flag should be ignored, so there's nothing to test but that the
// client starts with the flag present.
.run_with_zero_port();
}
#[test]