Remove CGC from data_availability checker (#7033)

- Part of https://github.com/sigp/lighthouse/issues/6767

Validator custody makes the CGC and set of sampling columns dynamic. Right now this information is stored twice:
- in the data availability checker
- in the network globals

If that state becomes dynamic we must make sure it is in sync updating it twice, or guarding it behind a mutex. However, I noted that we don't really have to keep the CGC inside the data availability checker. All consumers can actually read it from the network globals, and we can update `make_available` to read the expected count of data columns from the block.
This commit is contained in:
Lion - dapplion
2025-03-26 02:19:51 -03:00
committed by GitHub
parent 9dce729cb6
commit 6f31d44343
21 changed files with 298 additions and 215 deletions

View File

@@ -39,6 +39,9 @@ type E = MainnetEthSpec;
*
*/
// Default custody group count for tests
const CGC: usize = 8;
/// This test checks that a block that is **invalid** from a gossip perspective gets rejected when using `broadcast_validation=gossip`.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
pub async fn gossip_invalid() {
@@ -364,9 +367,9 @@ pub async fn consensus_partial_pass_only_consensus() {
);
assert_ne!(block_a.state_root(), block_b.state_root());
let gossip_block_b = block_b.into_gossip_verified_block(&tester.harness.chain);
let gossip_block_b = block_b.into_gossip_verified_block(&tester.harness.chain, CGC);
assert!(gossip_block_b.is_ok());
let gossip_block_a = block_a.into_gossip_verified_block(&tester.harness.chain);
let gossip_block_a = block_a.into_gossip_verified_block(&tester.harness.chain, CGC);
assert!(gossip_block_a.is_err());
/* submit `block_b` which should induce equivocation */
@@ -654,10 +657,10 @@ pub async fn equivocation_consensus_late_equivocation() {
);
assert_ne!(block_a.state_root(), block_b.state_root());
let gossip_block_b = block_b.into_gossip_verified_block(&tester.harness.chain);
let gossip_block_b = block_b.into_gossip_verified_block(&tester.harness.chain, CGC);
assert!(gossip_block_b.is_ok());
let gossip_block_a = block_a.into_gossip_verified_block(&tester.harness.chain);
let gossip_block_a = block_a.into_gossip_verified_block(&tester.harness.chain, CGC);
assert!(gossip_block_a.is_err());
let channel = tokio::sync::mpsc::unbounded_channel();
@@ -1291,9 +1294,9 @@ pub async fn blinded_equivocation_consensus_late_equivocation() {
ProvenancedBlock::Builder(b, _, _) => b,
};
let gossip_block_b = GossipVerifiedBlock::new(inner_block_b, &tester.harness.chain);
let gossip_block_b = GossipVerifiedBlock::new(inner_block_b, &tester.harness.chain, CGC);
assert!(gossip_block_b.is_ok());
let gossip_block_a = GossipVerifiedBlock::new(inner_block_a, &tester.harness.chain);
let gossip_block_a = GossipVerifiedBlock::new(inner_block_a, &tester.harness.chain, CGC);
assert!(gossip_block_a.is_err());
let channel = tokio::sync::mpsc::unbounded_channel();
@@ -1395,7 +1398,7 @@ pub async fn block_seen_on_gossip_without_blobs() {
// Simulate the block being seen on gossip.
block
.clone()
.into_gossip_verified_block(&tester.harness.chain)
.into_gossip_verified_block(&tester.harness.chain, CGC)
.unwrap();
// It should not yet be added to fork choice because blobs have not been seen.
@@ -1464,7 +1467,7 @@ pub async fn block_seen_on_gossip_with_some_blobs() {
// Simulate the block being seen on gossip.
block
.clone()
.into_gossip_verified_block(&tester.harness.chain)
.into_gossip_verified_block(&tester.harness.chain, CGC)
.unwrap();
// Simulate some of the blobs being seen on gossip.