@@ -40,9 +40,10 @@ use std::time::Duration;
4040use store:: { Error as StoreError , HotColdDB , ItemStore , KeyValueStoreOp } ;
4141use task_executor:: { ShutdownReason , TaskExecutor } ;
4242use tracing:: { debug, error, info} ;
43+ use types:: data_column_custody_group:: CustodyIndex ;
4344use types:: {
44- BeaconBlock , BeaconState , BlobSidecarList , ChainSpec , DataColumnSidecarList , Epoch , EthSpec ,
45- FixedBytesExtended , Hash256 , Signature , SignedBeaconBlock , Slot ,
45+ BeaconBlock , BeaconState , BlobSidecarList , ChainSpec , ColumnIndex , DataColumnSidecarList ,
46+ Epoch , EthSpec , FixedBytesExtended , Hash256 , Signature , SignedBeaconBlock , Slot ,
4647} ;
4748
4849/// An empty struct used to "witness" all the `BeaconChainTypes` traits. It has no user-facing
@@ -102,6 +103,7 @@ pub struct BeaconChainBuilder<T: BeaconChainTypes> {
102103 task_executor : Option < TaskExecutor > ,
103104 validator_monitor_config : Option < ValidatorMonitorConfig > ,
104105 node_custody_type : NodeCustodyType ,
106+ ordered_custody_column_indices : Option < Vec < CustodyIndex > > ,
105107 rng : Option < Box < dyn RngCore + Send > > ,
106108}
107109
@@ -141,6 +143,7 @@ where
141143 task_executor : None ,
142144 validator_monitor_config : None ,
143145 node_custody_type : NodeCustodyType :: Fullnode ,
146+ ordered_custody_column_indices : None ,
144147 rng : None ,
145148 }
146149 }
@@ -647,6 +650,16 @@ where
647650 self
648651 }
649652
653+ /// Sets the ordered custody column indices for this node.
654+ /// This is used to determine the data columns the node is required to custody.
655+ pub fn ordered_custody_column_indices (
656+ mut self ,
657+ ordered_custody_column_indices : Vec < ColumnIndex > ,
658+ ) -> Self {
659+ self . ordered_custody_column_indices = Some ( ordered_custody_column_indices) ;
660+ self
661+ }
662+
650663 /// Sets the `BeaconChain` event handler backend.
651664 ///
652665 /// For example, provide `ServerSentEventHandler` as a `handler`.
@@ -740,6 +753,9 @@ where
740753 . genesis_state_root
741754 . ok_or ( "Cannot build without a genesis state root" ) ?;
742755 let validator_monitor_config = self . validator_monitor_config . unwrap_or_default ( ) ;
756+ let ordered_custody_column_indices = self
757+ . ordered_custody_column_indices
758+ . ok_or ( "Cannot build without ordered custody column indices" ) ?;
743759 let rng = self . rng . ok_or ( "Cannot build without an RNG" ) ?;
744760 let beacon_proposer_cache: Arc < Mutex < BeaconProposerCache > > = <_ >:: default ( ) ;
745761
@@ -942,11 +958,16 @@ where
942958 custody,
943959 self . node_custody_type ,
944960 head_epoch,
961+ ordered_custody_column_indices,
945962 & self . spec ,
946963 )
947964 } else {
948965 (
949- CustodyContext :: new ( self . node_custody_type , & self . spec ) ,
966+ CustodyContext :: new (
967+ self . node_custody_type ,
968+ ordered_custody_column_indices,
969+ & self . spec ,
970+ ) ,
950971 None ,
951972 )
952973 } ;
@@ -1220,7 +1241,9 @@ fn build_data_columns_from_blobs<E: EthSpec>(
12201241#[ cfg( test) ]
12211242mod test {
12221243 use super :: * ;
1223- use crate :: test_utils:: { EphemeralHarnessType , get_kzg} ;
1244+ use crate :: test_utils:: {
1245+ EphemeralHarnessType , generate_data_column_indices_rand_order, get_kzg,
1246+ } ;
12241247 use ethereum_hashing:: hash;
12251248 use genesis:: {
12261249 DEFAULT_ETH1_BLOCK_HASH , generate_deterministic_keypairs, interop_genesis_state,
@@ -1272,6 +1295,9 @@ mod test {
12721295 . expect ( "should configure testing slot clock" )
12731296 . shutdown_sender ( shutdown_tx)
12741297 . rng ( Box :: new ( StdRng :: seed_from_u64 ( 42 ) ) )
1298+ . ordered_custody_column_indices (
1299+ generate_data_column_indices_rand_order :: < MinimalEthSpec > ( ) ,
1300+ )
12751301 . build ( )
12761302 . expect ( "should build" ) ;
12771303
0 commit comments