mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +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:
@@ -59,6 +59,18 @@ pub fn cli_app() -> Command {
|
||||
helps network resilience by serving all data columns to syncing peers.")
|
||||
.display_order(0)
|
||||
)
|
||||
.arg(
|
||||
Arg::new("semi-supernode")
|
||||
.long("semi-supernode")
|
||||
.action(ArgAction::SetTrue)
|
||||
.help_heading(FLAG_HEADER)
|
||||
.conflicts_with("supernode")
|
||||
.help("Run in minimal reconstruction mode. This node will subscribe to and custody \
|
||||
half of the data columns (enough for reconstruction), enabling efficient \
|
||||
data availability with lower bandwidth and storage requirements compared to \
|
||||
a supernode, while still supporting full blob reconstruction.")
|
||||
.display_order(0)
|
||||
)
|
||||
.arg(
|
||||
Arg::new("malicious-withhold-count")
|
||||
.long("malicious-withhold-count")
|
||||
|
||||
@@ -4,6 +4,7 @@ use beacon_chain::chain_config::{
|
||||
DEFAULT_RE_ORG_MAX_EPOCHS_SINCE_FINALIZATION, DEFAULT_RE_ORG_PARENT_THRESHOLD,
|
||||
DisallowedReOrgOffsets, INVALID_HOLESKY_BLOCK_ROOT, ReOrgThreshold,
|
||||
};
|
||||
use beacon_chain::custody_context::NodeCustodyType;
|
||||
use beacon_chain::graffiti_calculator::GraffitiOrigin;
|
||||
use clap::{ArgMatches, Id, parser::ValueSource};
|
||||
use clap_utils::flags::DISABLE_MALLOC_TUNING_FLAG;
|
||||
@@ -108,6 +109,19 @@ pub fn get_config<E: EthSpec>(
|
||||
|
||||
set_network_config(&mut client_config.network, cli_args, &data_dir_ref)?;
|
||||
|
||||
// Parse custody mode from CLI flags
|
||||
let is_supernode = parse_flag(cli_args, "supernode");
|
||||
let is_semi_supernode = parse_flag(cli_args, "semi-supernode");
|
||||
|
||||
client_config.chain.node_custody_type = if is_supernode {
|
||||
client_config.network.subscribe_all_data_column_subnets = true;
|
||||
NodeCustodyType::Supernode
|
||||
} else if is_semi_supernode {
|
||||
NodeCustodyType::SemiSupernode
|
||||
} else {
|
||||
NodeCustodyType::Fullnode
|
||||
};
|
||||
|
||||
/*
|
||||
* Staking flag
|
||||
* Note: the config values set here can be overwritten by other more specific cli params
|
||||
@@ -1136,10 +1150,6 @@ pub fn set_network_config(
|
||||
config.network_dir = data_dir.join(DEFAULT_NETWORK_DIR);
|
||||
};
|
||||
|
||||
if parse_flag(cli_args, "supernode") {
|
||||
config.subscribe_all_data_column_subnets = true;
|
||||
}
|
||||
|
||||
if parse_flag(cli_args, "subscribe-all-subnets") {
|
||||
config.subscribe_all_subnets = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user