Skip to content

Commit

Permalink
Rename PEER_DAS_EPOCH to EIP7594_FORK_EPOCH for client interop. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmygchen authored May 9, 2024
1 parent 42d97d3 commit fe9e5dd
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 21 deletions.
6 changes: 4 additions & 2 deletions beacon_node/beacon_chain/src/block_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,10 @@ impl<T: BeaconChainTypes> IntoGossipVerifiedBlockContents<T> for PublishBlockReq

let peer_das_enabled = chain
.spec
.peer_das_epoch
.map_or(false, |peer_das_epoch| block.epoch() >= peer_das_epoch);
.eip7594_fork_epoch
.map_or(false, |eip7594_fork_epoch| {
block.epoch() >= eip7594_fork_epoch
});

let gossip_verified_data_columns = if peer_das_enabled {
build_gossip_verified_data_columns(chain, &block, gossip_verified_blobs.as_ref())?
Expand Down
8 changes: 5 additions & 3 deletions beacon_node/beacon_chain/src/data_availability_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,13 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
block.num_expected_blobs() > 0 && self.data_columns_required_for_epoch(block.epoch())
}

/// Returns true if the given epoch is greater than or equal to the `PEER_DAS_EPOCH`.
/// Returns true if the given epoch is greater than or equal to the `EIP7594_FORK_EPOCH`.
fn is_peer_das_enabled_for_epoch(&self, block_epoch: Epoch) -> bool {
self.spec
.peer_das_epoch
.map_or(false, |peer_das_epoch| block_epoch >= peer_das_epoch)
.eip7594_fork_epoch
.map_or(false, |eip7594_fork_epoch| {
block_epoch >= eip7594_fork_epoch
})
}

/// The epoch at which we require a data availability check in block processing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,8 @@ impl<T: BeaconChainTypes> OverflowLRUCache<T> {

let peer_das_enabled = self
.spec
.peer_das_epoch
.map_or(false, |peer_das_epoch| epoch >= peer_das_epoch);
.eip7594_fork_epoch
.map_or(false, |eip7594_fork_epoch| epoch >= eip7594_fork_epoch);
if peer_das_enabled {
Ok(BlockImportRequirement::CustodyColumns(
self.custody_column_count,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1277,8 +1277,10 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
if self
.chain
.spec
.peer_das_epoch
.map_or(false, |peer_das_epoch| block.epoch() >= peer_das_epoch)
.eip7594_fork_epoch
.map_or(false, |eip7594_fork_epoch| {
block.epoch() >= eip7594_fork_epoch
})
{
self.send_sync_message(SyncMessage::SampleBlock(block_root, block.slot()));
}
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/network/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ impl<T: BeaconChainTypes> NetworkService<T> {
}
}
} else {
// TODO(das): subscribe after `PEER_DAS_EPOCH`
// TODO(das): subscribe after `EIP7594_FORK_EPOCH`
for column_subnet in DataColumnSubnetId::compute_custody_subnets::<T::EthSpec>(
self.network_globals.local_enr().node_id().raw().into(),
self.network_globals
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/network/src/sync/block_lookups/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl TestRig {

if let Some(config) = config {
if config.peer_das_enabled {
spec.peer_das_epoch = Some(Epoch::new(0));
spec.eip7594_fork_epoch = Some(Epoch::new(0));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ DENEB_FORK_EPOCH: 269568 # March 13, 2024, 01:55:35pm UTC
ELECTRA_FORK_VERSION: 0x05000000
ELECTRA_FORK_EPOCH: 18446744073709551615
# PeerDAS
PEER_DAS_EPOCH: 18446744073709551615
EIP7594_FORK_EPOCH: 18446744073709551615


# Time parameters
Expand Down
18 changes: 9 additions & 9 deletions consensus/types/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub struct ChainSpec {
/*
* DAS params
*/
pub peer_das_epoch: Option<Epoch>,
pub eip7594_fork_epoch: Option<Epoch>,
pub custody_requirement: u64,

/*
Expand Down Expand Up @@ -764,7 +764,7 @@ impl ChainSpec {
/*
* DAS params
*/
peer_das_epoch: None,
eip7594_fork_epoch: None,
custody_requirement: 1,

/*
Expand Down Expand Up @@ -872,7 +872,7 @@ impl ChainSpec {
max_pending_partials_per_withdrawals_sweep: u64::checked_pow(2, 0)
.expect("pow does not overflow"),
// PeerDAS
peer_das_epoch: None,
eip7594_fork_epoch: None,
// Other
network_id: 2, // lighthouse testnet network id
deposit_chain_id: 5,
Expand Down Expand Up @@ -1077,7 +1077,7 @@ impl ChainSpec {
/*
* DAS params
*/
peer_das_epoch: None,
eip7594_fork_epoch: None,
custody_requirement: 1,
/*
* Network specific
Expand Down Expand Up @@ -1216,7 +1216,7 @@ pub struct Config {
#[serde(default)]
#[serde(serialize_with = "serialize_fork_epoch")]
#[serde(deserialize_with = "deserialize_fork_epoch")]
pub peer_das_epoch: Option<MaybeQuoted<Epoch>>,
pub eip7594_fork_epoch: Option<MaybeQuoted<Epoch>>,

#[serde(with = "serde_utils::quoted_u64")]
seconds_per_slot: u64,
Expand Down Expand Up @@ -1608,8 +1608,8 @@ impl Config {
.electra_fork_epoch
.map(|epoch| MaybeQuoted { value: epoch }),

peer_das_epoch: spec
.peer_das_epoch
eip7594_fork_epoch: spec
.eip7594_fork_epoch
.map(|epoch| MaybeQuoted { value: epoch }),

seconds_per_slot: spec.seconds_per_slot,
Expand Down Expand Up @@ -1689,7 +1689,7 @@ impl Config {
deneb_fork_version,
electra_fork_epoch,
electra_fork_version,
peer_das_epoch,
eip7594_fork_epoch,
seconds_per_slot,
seconds_per_eth1_block,
min_validator_withdrawability_delay,
Expand Down Expand Up @@ -1751,7 +1751,7 @@ impl Config {
deneb_fork_version,
electra_fork_epoch: electra_fork_epoch.map(|q| q.value),
electra_fork_version,
peer_das_epoch: peer_das_epoch.map(|q| q.value),
eip7594_fork_epoch: eip7594_fork_epoch.map(|q| q.value),
seconds_per_slot,
seconds_per_eth1_block,
min_validator_withdrawability_delay,
Expand Down

0 comments on commit fe9e5dd

Please sign in to comment.