Improve single-node testnet support and Arc NetworkConfig/ChainSpec (#6396)

* Arc ChainSpec and NetworkConfig

* Fix release tests

* Fix lint

* Merge remote-tracking branch 'origin/unstable' into single-node-testnet
This commit is contained in:
Michael Sproul
2024-09-24 10:16:18 +10:00
committed by GitHub
parent d84df5799c
commit 1447eeb40b
66 changed files with 340 additions and 250 deletions

View File

@@ -347,7 +347,7 @@ pub struct BeaconNodeFallback<T, E> {
candidates: Vec<CandidateBeaconNode<E>>,
slot_clock: Option<T>,
broadcast_topics: Vec<ApiTopic>,
spec: ChainSpec,
spec: Arc<ChainSpec>,
log: Logger,
}
@@ -355,7 +355,7 @@ impl<T: SlotClock, E: EthSpec> BeaconNodeFallback<T, E> {
pub fn new(
candidates: Vec<CandidateBeaconNode<E>>,
broadcast_topics: Vec<ApiTopic>,
spec: ChainSpec,
spec: Arc<ChainSpec>,
log: Logger,
) -> Self {
Self {

View File

@@ -229,7 +229,7 @@ pub struct DutiesService<T, E: EthSpec> {
/// The runtime for spawning tasks.
pub context: RuntimeContext<E>,
/// The current chain spec.
pub spec: ChainSpec,
pub spec: Arc<ChainSpec>,
//// Whether we permit large validator counts in the metrics.
pub enable_high_validator_count_metrics: bool,
/// If this validator is running in distributed mode.

View File

@@ -77,7 +77,7 @@ pub struct Context<T: SlotClock, E: EthSpec> {
pub secrets_dir: Option<PathBuf>,
pub graffiti_file: Option<GraffitiFile>,
pub graffiti_flag: Option<Graffiti>,
pub spec: ChainSpec,
pub spec: Arc<ChainSpec>,
pub config: Config,
pub log: Logger,
pub sse_logging_components: Option<SSELoggingComponents>,
@@ -217,7 +217,7 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
let inner_slot_clock = ctx.slot_clock.clone();
let slot_clock_filter = warp::any().map(move || inner_slot_clock.clone());
let inner_spec = Arc::new(ctx.spec.clone());
let inner_spec = ctx.spec.clone();
let spec_filter = warp::any().map(move || inner_spec.clone());
let api_token_path_inner = api_token_path.clone();

View File

@@ -96,7 +96,7 @@ impl ApiTester {
..Default::default()
};
let spec = E::default_spec();
let spec = Arc::new(E::default_spec());
let slashing_db_path = config.validator_dir.join(SLASHING_PROTECTION_FILENAME);
let slashing_protection = SlashingDatabase::open_or_create(&slashing_db_path).unwrap();
@@ -110,7 +110,7 @@ impl ApiTester {
initialized_validators,
slashing_protection,
Hash256::repeat_byte(42),
spec,
spec.clone(),
Some(Arc::new(DoppelgangerService::new(log.clone()))),
slot_clock.clone(),
&config,
@@ -132,7 +132,7 @@ impl ApiTester {
validator_store: Some(validator_store.clone()),
graffiti_file: None,
graffiti_flag: Some(Graffiti::default()),
spec: E::default_spec(),
spec,
config: http_config,
log,
sse_logging_components: None,

View File

@@ -80,7 +80,7 @@ impl ApiTester {
config.validator_dir = validator_dir.path().into();
config.secrets_dir = secrets_dir.path().into();
let spec = E::default_spec();
let spec = Arc::new(E::default_spec());
let slashing_db_path = config.validator_dir.join(SLASHING_PROTECTION_FILENAME);
let slashing_protection = SlashingDatabase::open_or_create(&slashing_db_path).unwrap();
@@ -120,7 +120,7 @@ impl ApiTester {
validator_store: Some(validator_store.clone()),
graffiti_file: None,
graffiti_flag: Some(Graffiti::default()),
spec: E::default_spec(),
spec: E::default_spec().into(),
config: HttpConfig {
enabled: true,
listen_addr: IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)),

View File

@@ -85,7 +85,7 @@ impl<T: SlotClock + 'static, E: EthSpec> ValidatorStore<T, E> {
validators: InitializedValidators,
slashing_protection: SlashingDatabase,
genesis_validators_root: Hash256,
spec: ChainSpec,
spec: Arc<ChainSpec>,
doppelganger_service: Option<Arc<DoppelgangerService>>,
slot_clock: T,
config: &Config,
@@ -97,7 +97,7 @@ impl<T: SlotClock + 'static, E: EthSpec> ValidatorStore<T, E> {
slashing_protection,
slashing_protection_last_prune: Arc::new(Mutex::new(Epoch::new(0))),
genesis_validators_root,
spec: Arc::new(spec),
spec,
log,
doppelganger_service,
slot_clock,