mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-17 03:42:46 +00:00
Add --semi-supernode support (#8254)
Addresses #8218
A simplified version of #8241 for the initial release.
I've tried to minimise the logic change in this PR, although introducing the `NodeCustodyType` enum still result in quite a bit a of diff, but the actual logic change in `CustodyContext` is quite small.
The main changes are in the `CustdoyContext` struct
* ~~combining `validator_custody_count` and `current_is_supernode` fields into a single `custody_group_count_at_head` field. We persist the cgc of the initial cli values into the `custody_group_count_at_head` field and only allow for increase (same behaviour as before).~~
* I noticed the above approach caused a backward compatibility issue, I've [made a fix](15569bc085) and changed the approach slightly (which was actually what I had originally in mind):
* when initialising, only override the `validator_custody_count` value if either flag `--supernode` or `--semi-supernode` is used; otherwise leave it as the existing default `0`. Most other logic remains unchanged.
All existing validator custody unit tests are still all passing, and I've added additional tests to cover semi-supernode, and restoring `CustodyContext` from disk.
Note: I've added a `WARN` if the user attempts to switch to a `--semi-supernode` or `--supernode` - this currently has no effect, but once @eserilev column backfill is merged, we should be able to support this quite easily.
Things to test
- [x] cgc in metadata / enr
- [x] cgc in metrics
- [x] subscribed subnets
- [x] getBlobs endpoint
Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::blob_verification::GossipVerifiedBlob;
|
||||
use crate::block_verification_types::{AsBlock, RpcBlock};
|
||||
use crate::custody_context::NodeCustodyType;
|
||||
use crate::data_column_verification::CustodyDataColumn;
|
||||
use crate::kzg_utils::build_data_column_sidecars;
|
||||
use crate::observed_operations::ObservationOutcome;
|
||||
@@ -210,7 +211,7 @@ pub struct Builder<T: BeaconChainTypes> {
|
||||
testing_slot_clock: Option<TestingSlotClock>,
|
||||
validator_monitor_config: Option<ValidatorMonitorConfig>,
|
||||
genesis_state_builder: Option<InteropGenesisBuilder<T::EthSpec>>,
|
||||
import_all_data_columns: bool,
|
||||
node_custody_type: NodeCustodyType,
|
||||
runtime: TestRuntime,
|
||||
}
|
||||
|
||||
@@ -356,7 +357,7 @@ where
|
||||
testing_slot_clock: None,
|
||||
validator_monitor_config: None,
|
||||
genesis_state_builder: None,
|
||||
import_all_data_columns: false,
|
||||
node_custody_type: NodeCustodyType::Fullnode,
|
||||
runtime,
|
||||
}
|
||||
}
|
||||
@@ -442,8 +443,8 @@ where
|
||||
self
|
||||
}
|
||||
|
||||
pub fn import_all_data_columns(mut self, import_all_data_columns: bool) -> Self {
|
||||
self.import_all_data_columns = import_all_data_columns;
|
||||
pub fn node_custody_type(mut self, node_custody_type: NodeCustodyType) -> Self {
|
||||
self.node_custody_type = node_custody_type;
|
||||
self
|
||||
}
|
||||
|
||||
@@ -565,7 +566,7 @@ where
|
||||
.execution_layer(self.execution_layer)
|
||||
.shutdown_sender(shutdown_tx)
|
||||
.chain_config(chain_config)
|
||||
.import_all_data_columns(self.import_all_data_columns)
|
||||
.node_custody_type(self.node_custody_type)
|
||||
.event_handler(Some(ServerSentEventHandler::new_with_capacity(5)))
|
||||
.validator_monitor_config(validator_monitor_config)
|
||||
.rng(Box::new(StdRng::seed_from_u64(42)));
|
||||
|
||||
Reference in New Issue
Block a user