mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 21:38:31 +00:00
Fix custody context initialization race condition that caused panic (#8391)
Take 2 of #8390. Fixes the race condition properly instead of propagating the error. I think this is a better alternative, and doesn't seem to look that bad. * Lift node id loading or generation from `NetworkService ` startup to the `ClientBuilder`, so that it can be used to compute custody columns for the beacon chain without waiting for Network bootstrap. I've considered and implemented a few alternatives: 1. passing `node_id` to beacon chain builder and compute columns when creating `CustodyContext`. This approach isn't good for separation of concerns and isn't great for testability 2. passing `ordered_custody_groups` to beacon chain. `CustodyContext` only uses this to compute ordered custody columns, so we might as well lift this logic out, so we don't have to do error handling in `CustodyContext` construction. Less tests to update;. Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -7,11 +7,11 @@ use beacon_chain::custody_context::CUSTODY_CHANGE_DA_EFFECTIVE_DELAY_SECONDS;
|
||||
use beacon_chain::data_availability_checker::AvailableBlock;
|
||||
use beacon_chain::historical_data_columns::HistoricalDataColumnError;
|
||||
use beacon_chain::schema_change::migrate_schema;
|
||||
use beacon_chain::test_utils::SyncCommitteeStrategy;
|
||||
use beacon_chain::test_utils::{
|
||||
AttestationStrategy, BeaconChainHarness, BlockStrategy, DiskHarnessType, get_kzg,
|
||||
mock_execution_layer_from_parts, test_spec,
|
||||
};
|
||||
use beacon_chain::test_utils::{SyncCommitteeStrategy, generate_data_column_indices_rand_order};
|
||||
use beacon_chain::{
|
||||
BeaconChain, BeaconChainError, BeaconChainTypes, BeaconSnapshot, BlockError, ChainConfig,
|
||||
NotifyExecutionLayer, ServerSentEventHandler, WhenSlotSkipped,
|
||||
@@ -2881,17 +2881,10 @@ async fn weak_subjectivity_sync_test(
|
||||
.shutdown_sender(shutdown_tx)
|
||||
.event_handler(Some(ServerSentEventHandler::new_with_capacity(1)))
|
||||
.execution_layer(Some(mock.el))
|
||||
.ordered_custody_column_indices(generate_data_column_indices_rand_order::<E>())
|
||||
.rng(Box::new(StdRng::seed_from_u64(42)))
|
||||
.build()
|
||||
.expect("should build");
|
||||
beacon_chain
|
||||
.data_availability_checker
|
||||
.custody_context()
|
||||
.init_ordered_data_columns_from_custody_groups(
|
||||
(0..spec.number_of_custody_groups).collect(),
|
||||
&spec,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let beacon_chain = Arc::new(beacon_chain);
|
||||
let wss_block_root = wss_block.canonical_root();
|
||||
|
||||
Reference in New Issue
Block a user