mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-18 20:32:45 +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:
@@ -6,6 +6,7 @@ use beacon_chain::BeaconChainTypes;
|
||||
use beacon_chain::test_utils::BeaconChainHarness;
|
||||
use beacon_processor::{BeaconProcessorChannels, BeaconProcessorConfig};
|
||||
use futures::StreamExt;
|
||||
use lighthouse_network::identity::secp256k1;
|
||||
use lighthouse_network::types::{GossipEncoding, GossipKind};
|
||||
use lighthouse_network::{Enr, GossipTopic};
|
||||
use std::str::FromStr;
|
||||
@@ -66,6 +67,7 @@ fn test_dht_persistence() {
|
||||
executor,
|
||||
None,
|
||||
beacon_processor_tx,
|
||||
secp256k1::Keypair::generate().into(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -134,6 +136,7 @@ fn test_removing_topic_weight_on_old_topics() {
|
||||
executor.clone(),
|
||||
None,
|
||||
beacon_processor_channels.beacon_processor_tx,
|
||||
secp256k1::Keypair::generate().into(),
|
||||
)
|
||||
.await
|
||||
.unwrap()
|
||||
|
||||
Reference in New Issue
Block a user