mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 22:04:44 +00:00
Fix wrong columns getting processed on a CGC change (#7792)
This PR fixes a bug where wrong columns could get processed immediately after a CGC increase.
Scenario:
- The node's CGC increased due to additional validators attached to it (lets say from 10 to 11)
- The new CGC is advertised and new subnets are subscribed immediately, however the change won't be effective in the data availability check until the next epoch (See [this](ab0e8870b4/beacon_node/beacon_chain/src/validator_custody.rs (L93-L99))). Data availability checker still only require 10 columns for the current epoch.
- During this time, data columns for the additional custody column (lets say column 11) may arrive via gossip as we're already subscribed to the topic, and it may be incorrectly used to satisfy the existing data availability requirement (10 columns), and result in this additional column (instead of a required one) getting persisted, resulting in database inconsistency.
This commit is contained in:
@@ -1311,7 +1311,7 @@ async fn verify_and_process_gossip_data_sidecars(
|
||||
);
|
||||
harness.chain.verify_data_column_sidecar_for_gossip(
|
||||
column_sidecar.into_inner(),
|
||||
*subnet_id,
|
||||
subnet_id,
|
||||
)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::sync::Arc;
|
||||
use types::blob_sidecar::FixedBlobSidecarList;
|
||||
use types::test_utils::TestRandom;
|
||||
use types::{
|
||||
BlobSidecar, DataColumnSidecar, EthSpec, ForkName, MinimalEthSpec, RuntimeVariableList,
|
||||
BlobSidecar, DataColumnSidecar, EthSpec, ForkName, MinimalEthSpec, RuntimeVariableList, Slot,
|
||||
};
|
||||
|
||||
type E = MinimalEthSpec;
|
||||
@@ -64,8 +64,17 @@ async fn data_column_sidecar_event_on_process_gossip_data_column() {
|
||||
|
||||
// build and process a gossip verified data column
|
||||
let mut rng = StdRng::seed_from_u64(0xDEADBEEF0BAD5EEDu64);
|
||||
let sidecar = Arc::new(DataColumnSidecar::random_for_test(&mut rng));
|
||||
let gossip_verified_data_column = GossipVerifiedDataColumn::__new_for_testing(sidecar);
|
||||
let sidecar = {
|
||||
// DA checker only accepts sampling columns, so we need to create one with a sampling index.
|
||||
let mut random_sidecar = DataColumnSidecar::random_for_test(&mut rng);
|
||||
let slot = Slot::new(10);
|
||||
let epoch = slot.epoch(E::slots_per_epoch());
|
||||
random_sidecar.signed_block_header.message.slot = slot;
|
||||
random_sidecar.index = harness.chain.sampling_columns_for_epoch(epoch)[0];
|
||||
random_sidecar
|
||||
};
|
||||
let gossip_verified_data_column =
|
||||
GossipVerifiedDataColumn::__new_for_testing(Arc::new(sidecar));
|
||||
let expected_sse_data_column = SseDataColumnSidecar::from_data_column_sidecar(
|
||||
gossip_verified_data_column.as_data_column(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user