Skip to content

Commit 259d900

Browse files
committed
move certain custody checks to custody context
1 parent 306ee28 commit 259d900

File tree

17 files changed

+416
-299
lines changed

17 files changed

+416
-299
lines changed

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7300,12 +7300,15 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
73007300
/// The epoch at which we require a data availability check in block processing.
73017301
/// `None` if the `Deneb` fork is disabled.
73027302
pub fn data_availability_boundary(&self) -> Option<Epoch> {
7303-
self.data_availability_checker.data_availability_boundary()
7303+
self.data_availability_checker
7304+
.custody_context()
7305+
.data_availability_boundary()
73047306
}
73057307

73067308
/// Returns true if epoch is within the data availability boundary
73077309
pub fn da_check_required_for_epoch(&self, epoch: Epoch) -> bool {
73087310
self.data_availability_checker
7311+
.custody_context()
73097312
.da_check_required_for_epoch(epoch)
73107313
}
73117314

beacon_node/beacon_chain/src/block_verification_types.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use crate::data_availability_checker::{AvailabilityCheckError, DataAvailabilityChecker};
1+
use crate::data_availability_checker::AvailabilityCheckError;
22
pub use crate::data_availability_checker::{
33
AvailableBlock, AvailableBlockData, MaybeAvailableBlock,
44
};
5-
use crate::{BeaconChainTypes, PayloadVerificationOutcome};
5+
use crate::{BeaconChainTypes, CustodyContext, PayloadVerificationOutcome};
66
use educe::Educe;
77
use state_processing::ConsensusContext;
88
use std::fmt::{Debug, Formatter};
@@ -93,15 +93,18 @@ impl<E: EthSpec> RpcBlock<E> {
9393
pub fn new<T>(
9494
block: Arc<SignedBeaconBlock<E>>,
9595
block_data: Option<AvailableBlockData<E>>,
96-
da_checker: &DataAvailabilityChecker<T>,
96+
custody_context: &CustodyContext<T>,
9797
spec: Arc<ChainSpec>,
9898
) -> Result<Self, AvailabilityCheckError>
9999
where
100100
T: BeaconChainTypes<EthSpec = E>,
101101
{
102102
match block_data {
103103
Some(block_data) => Ok(RpcBlock::FullyAvailable(AvailableBlock::new(
104-
block, block_data, da_checker, spec,
104+
block,
105+
block_data,
106+
custody_context,
107+
spec,
105108
)?)),
106109
None => Ok(RpcBlock::BlockOnly {
107110
block_root: block.canonical_root(),

beacon_node/beacon_chain/src/builder.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,6 @@ where
918918
let genesis_time = head_snapshot.beacon_state.genesis_time();
919919
let canonical_head = CanonicalHead::new(fork_choice, Arc::new(head_snapshot));
920920
let shuffling_cache_size = self.chain_config.shuffling_cache_size;
921-
let complete_blob_backfill = self.chain_config.complete_blob_backfill;
922921

923922
// Calculate the weak subjectivity point in which to backfill blocks to.
924923
let genesis_backfill_slot = if self.chain_config.genesis_backfill {
@@ -961,14 +960,18 @@ where
961960
self.node_custody_type,
962961
head_epoch,
963962
ordered_custody_column_indices,
964-
&self.spec,
963+
slot_clock.clone(),
964+
self.chain_config.complete_blob_backfill,
965+
self.spec.clone(),
965966
)
966967
} else {
967968
(
968969
CustodyContext::new(
969970
self.node_custody_type,
971+
slot_clock.clone(),
970972
ordered_custody_column_indices,
971-
&self.spec,
973+
self.chain_config.complete_blob_backfill,
974+
self.spec.clone(),
972975
),
973976
None,
974977
)
@@ -1045,7 +1048,6 @@ where
10451048
genesis_backfill_slot,
10461049
data_availability_checker: Arc::new(
10471050
DataAvailabilityChecker::new(
1048-
complete_blob_backfill,
10491051
slot_clock,
10501052
self.kzg.clone(),
10511053
store,

0 commit comments

Comments
 (0)