Skip to content

Commit a68dd77

Browse files
committed
Add --semi-supernode support (#8254)
Squashed commit of the following: commit 45a4315 Author: Jimmy Chen <[email protected]> Date: Tue Oct 21 23:15:58 2025 +1100 Add tests for flags commit 15569bc Author: Jimmy Chen <[email protected]> Date: Tue Oct 21 22:40:49 2025 +1100 Revert some changes to preserve existing behaviour. Full node with no validator should have `validator_custody_at_head` set to 0. commit 7767a2e Author: Jimmy Chen <[email protected]> Date: Tue Oct 21 16:47:40 2025 +1100 More test fixes and update help text. commit 0932f36 Author: Jimmy Chen <[email protected]> Date: Tue Oct 21 16:14:46 2025 +1100 Add tests for restoring custody context from persisted. commit 5cc3186 Author: Jimmy Chen <[email protected]> Date: Tue Oct 21 16:07:47 2025 +1100 Implement semi-supernode. Co-authored-by: pawanjay176 <[email protected]>
1 parent 22926a7 commit a68dd77

File tree

20 files changed

+409
-108
lines changed

20 files changed

+409
-108
lines changed

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::block_verification_types::{
2121
};
2222
pub use crate::canonical_head::CanonicalHead;
2323
use crate::chain_config::ChainConfig;
24+
use crate::custody_context::CustodyContextSsz;
2425
use crate::data_availability_checker::{
2526
Availability, AvailabilityCheckError, AvailableBlock, AvailableBlockData,
2627
DataAvailabilityChecker, DataColumnReconstructionResult,
@@ -64,7 +65,6 @@ use crate::shuffling_cache::{BlockShufflingIds, ShufflingCache};
6465
use crate::sync_committee_verification::{
6566
Error as SyncCommitteeError, VerifiedSyncCommitteeMessage, VerifiedSyncContribution,
6667
};
67-
use crate::validator_custody::CustodyContextSsz;
6868
use crate::validator_monitor::{
6969
HISTORIC_EPOCHS as VALIDATOR_MONITOR_HISTORIC_EPOCHS, ValidatorMonitor, get_slot_delay_ms,
7070
timestamp_now,

beacon_node/beacon_chain/src/builder.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::beacon_chain::{
44
BEACON_CHAIN_DB_KEY, CanonicalHead, LightClientProducerEvent, OP_POOL_DB_KEY,
55
};
66
use crate::beacon_proposer_cache::BeaconProposerCache;
7+
use crate::custody_context::NodeCustodyType;
78
use crate::data_availability_checker::DataAvailabilityChecker;
89
use crate::fork_choice_signal::ForkChoiceSignalTx;
910
use crate::fork_revert::{reset_fork_choice_to_finalization, revert_to_fork_boundary};
@@ -100,7 +101,7 @@ pub struct BeaconChainBuilder<T: BeaconChainTypes> {
100101
kzg: Arc<Kzg>,
101102
task_executor: Option<TaskExecutor>,
102103
validator_monitor_config: Option<ValidatorMonitorConfig>,
103-
import_all_data_columns: bool,
104+
node_custody_type: NodeCustodyType,
104105
rng: Option<Box<dyn RngCore + Send>>,
105106
}
106107

@@ -139,7 +140,7 @@ where
139140
kzg,
140141
task_executor: None,
141142
validator_monitor_config: None,
142-
import_all_data_columns: false,
143+
node_custody_type: NodeCustodyType::Fullnode,
143144
rng: None,
144145
}
145146
}
@@ -640,9 +641,9 @@ where
640641
self
641642
}
642643

643-
/// Sets whether to require and import all data columns when importing block.
644-
pub fn import_all_data_columns(mut self, import_all_data_columns: bool) -> Self {
645-
self.import_all_data_columns = import_all_data_columns;
644+
/// Sets the node custody type for data column import.
645+
pub fn node_custody_type(mut self, node_custody_type: NodeCustodyType) -> Self {
646+
self.node_custody_type = node_custody_type;
646647
self
647648
}
648649

@@ -935,10 +936,11 @@ where
935936
{
936937
Arc::new(CustodyContext::new_from_persisted_custody_context(
937938
custody,
938-
self.import_all_data_columns,
939+
self.node_custody_type,
940+
&self.spec,
939941
))
940942
} else {
941-
Arc::new(CustodyContext::new(self.import_all_data_columns))
943+
Arc::new(CustodyContext::new(self.node_custody_type, &self.spec))
942944
};
943945
debug!(?custody_context, "Loading persisted custody context");
944946

beacon_node/beacon_chain/src/chain_config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::custody_context::NodeCustodyType;
12
pub use proto_array::{DisallowedReOrgOffsets, ReOrgThreshold};
23
use serde::{Deserialize, Serialize};
34
use std::str::FromStr;
@@ -118,6 +119,8 @@ pub struct ChainConfig {
118119
pub invalid_block_roots: HashSet<Hash256>,
119120
/// Disable the getBlobs optimisation to fetch blobs from the EL mempool.
120121
pub disable_get_blobs: bool,
122+
/// The node's custody type, determining how many data columns to custody and sample.
123+
pub node_custody_type: NodeCustodyType,
121124
}
122125

123126
impl Default for ChainConfig {
@@ -158,6 +161,7 @@ impl Default for ChainConfig {
158161
data_column_publishing_delay: None,
159162
invalid_block_roots: HashSet::new(),
160163
disable_get_blobs: false,
164+
node_custody_type: NodeCustodyType::Fullnode,
161165
}
162166
}
163167
}

0 commit comments

Comments
 (0)