mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Implement PeerDAS Fulu fork activation (#6795)
Addresses #6706 This PR activates PeerDAS at the Fulu fork epoch instead of `EIP_7594_FORK_EPOCH`. This means we no longer support testing PeerDAS with Deneb / Electrs, as it's now part of a hard fork.
This commit is contained in:
@@ -43,8 +43,8 @@ use types::ForkContext;
|
||||
use types::{
|
||||
data_column_sidecar::ColumnIndex,
|
||||
test_utils::{SeedableRng, TestRandom, XorShiftRng},
|
||||
BeaconState, BeaconStateBase, BlobSidecar, DataColumnSidecar, Epoch, EthSpec, ForkName,
|
||||
Hash256, MinimalEthSpec as E, SignedBeaconBlock, Slot,
|
||||
BeaconState, BeaconStateBase, BlobSidecar, DataColumnSidecar, EthSpec, ForkName, Hash256,
|
||||
MinimalEthSpec as E, SignedBeaconBlock, Slot,
|
||||
};
|
||||
|
||||
const D: Duration = Duration::new(0, 0);
|
||||
@@ -54,12 +54,8 @@ const SAMPLING_REQUIRED_SUCCESSES: usize = 2;
|
||||
type DCByRootIds = Vec<DCByRootId>;
|
||||
type DCByRootId = (SyncRequestId, Vec<ColumnIndex>);
|
||||
|
||||
struct TestRigConfig {
|
||||
peer_das_enabled: bool,
|
||||
}
|
||||
|
||||
impl TestRig {
|
||||
fn test_setup_with_config(config: Option<TestRigConfig>) -> Self {
|
||||
pub fn test_setup() -> Self {
|
||||
let logger_type = if cfg!(feature = "test_logger") {
|
||||
LoggerType::Test
|
||||
} else if cfg!(feature = "ci_logger") {
|
||||
@@ -70,13 +66,7 @@ impl TestRig {
|
||||
let log = build_log(slog::Level::Trace, logger_type);
|
||||
|
||||
// Use `fork_from_env` logic to set correct fork epochs
|
||||
let mut spec = test_spec::<E>();
|
||||
|
||||
if let Some(config) = config {
|
||||
if config.peer_das_enabled {
|
||||
spec.eip7594_fork_epoch = Some(Epoch::new(0));
|
||||
}
|
||||
}
|
||||
let spec = test_spec::<E>();
|
||||
|
||||
// Initialise a new beacon chain
|
||||
let harness = BeaconChainHarness::<EphemeralHarnessType<E>>::builder(E)
|
||||
@@ -155,24 +145,18 @@ impl TestRig {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn test_setup() -> Self {
|
||||
Self::test_setup_with_config(None)
|
||||
}
|
||||
|
||||
fn test_setup_after_deneb() -> Option<Self> {
|
||||
fn test_setup_after_deneb_before_fulu() -> Option<Self> {
|
||||
let r = Self::test_setup();
|
||||
if r.after_deneb() {
|
||||
if r.after_deneb() && !r.fork_name.fulu_enabled() {
|
||||
Some(r)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn test_setup_after_peerdas() -> Option<Self> {
|
||||
let r = Self::test_setup_with_config(Some(TestRigConfig {
|
||||
peer_das_enabled: true,
|
||||
}));
|
||||
if r.after_deneb() {
|
||||
fn test_setup_after_fulu() -> Option<Self> {
|
||||
let r = Self::test_setup();
|
||||
if r.fork_name.fulu_enabled() {
|
||||
Some(r)
|
||||
} else {
|
||||
None
|
||||
@@ -187,6 +171,10 @@ impl TestRig {
|
||||
self.fork_name.deneb_enabled()
|
||||
}
|
||||
|
||||
pub fn after_fulu(&self) -> bool {
|
||||
self.fork_name.fulu_enabled()
|
||||
}
|
||||
|
||||
fn trigger_unknown_parent_block(&mut self, peer_id: PeerId, block: Arc<SignedBeaconBlock<E>>) {
|
||||
let block_root = block.canonical_root();
|
||||
self.send_sync_message(SyncMessage::UnknownParentBlock(peer_id, block, block_root))
|
||||
@@ -387,7 +375,7 @@ impl TestRig {
|
||||
.__add_connected_peer_testing_only(false, &self.harness.spec)
|
||||
}
|
||||
|
||||
fn new_connected_supernode_peer(&mut self) -> PeerId {
|
||||
pub fn new_connected_supernode_peer(&mut self) -> PeerId {
|
||||
self.network_globals
|
||||
.peers
|
||||
.write()
|
||||
@@ -1945,7 +1933,7 @@ fn test_same_chain_race_condition() {
|
||||
|
||||
#[test]
|
||||
fn block_in_da_checker_skips_download() {
|
||||
let Some(mut r) = TestRig::test_setup_after_deneb() else {
|
||||
let Some(mut r) = TestRig::test_setup_after_deneb_before_fulu() else {
|
||||
return;
|
||||
};
|
||||
let (block, blobs) = r.rand_block_and_blobs(NumBlobs::Number(1));
|
||||
@@ -1963,7 +1951,7 @@ fn block_in_da_checker_skips_download() {
|
||||
|
||||
#[test]
|
||||
fn block_in_processing_cache_becomes_invalid() {
|
||||
let Some(mut r) = TestRig::test_setup_after_deneb() else {
|
||||
let Some(mut r) = TestRig::test_setup_after_deneb_before_fulu() else {
|
||||
return;
|
||||
};
|
||||
let (block, blobs) = r.rand_block_and_blobs(NumBlobs::Number(1));
|
||||
@@ -1989,7 +1977,7 @@ fn block_in_processing_cache_becomes_invalid() {
|
||||
|
||||
#[test]
|
||||
fn block_in_processing_cache_becomes_valid_imported() {
|
||||
let Some(mut r) = TestRig::test_setup_after_deneb() else {
|
||||
let Some(mut r) = TestRig::test_setup_after_deneb_before_fulu() else {
|
||||
return;
|
||||
};
|
||||
let (block, blobs) = r.rand_block_and_blobs(NumBlobs::Number(1));
|
||||
@@ -2014,7 +2002,7 @@ fn block_in_processing_cache_becomes_valid_imported() {
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn blobs_in_da_checker_skip_download() {
|
||||
let Some(mut r) = TestRig::test_setup_after_deneb() else {
|
||||
let Some(mut r) = TestRig::test_setup_after_deneb_before_fulu() else {
|
||||
return;
|
||||
};
|
||||
let (block, blobs) = r.rand_block_and_blobs(NumBlobs::Number(1));
|
||||
@@ -2033,7 +2021,7 @@ fn blobs_in_da_checker_skip_download() {
|
||||
|
||||
#[test]
|
||||
fn sampling_happy_path() {
|
||||
let Some(mut r) = TestRig::test_setup_after_peerdas() else {
|
||||
let Some(mut r) = TestRig::test_setup_after_fulu() else {
|
||||
return;
|
||||
};
|
||||
r.new_connected_peers_for_peerdas();
|
||||
@@ -2050,7 +2038,7 @@ fn sampling_happy_path() {
|
||||
|
||||
#[test]
|
||||
fn sampling_with_retries() {
|
||||
let Some(mut r) = TestRig::test_setup_after_peerdas() else {
|
||||
let Some(mut r) = TestRig::test_setup_after_fulu() else {
|
||||
return;
|
||||
};
|
||||
r.new_connected_peers_for_peerdas();
|
||||
@@ -2072,7 +2060,7 @@ fn sampling_with_retries() {
|
||||
|
||||
#[test]
|
||||
fn sampling_avoid_retrying_same_peer() {
|
||||
let Some(mut r) = TestRig::test_setup_after_peerdas() else {
|
||||
let Some(mut r) = TestRig::test_setup_after_fulu() else {
|
||||
return;
|
||||
};
|
||||
let peer_id_1 = r.new_connected_supernode_peer();
|
||||
@@ -2093,7 +2081,7 @@ fn sampling_avoid_retrying_same_peer() {
|
||||
|
||||
#[test]
|
||||
fn sampling_batch_requests() {
|
||||
let Some(mut r) = TestRig::test_setup_after_peerdas() else {
|
||||
let Some(mut r) = TestRig::test_setup_after_fulu() else {
|
||||
return;
|
||||
};
|
||||
let _supernode = r.new_connected_supernode_peer();
|
||||
@@ -2119,7 +2107,7 @@ fn sampling_batch_requests() {
|
||||
|
||||
#[test]
|
||||
fn sampling_batch_requests_not_enough_responses_returned() {
|
||||
let Some(mut r) = TestRig::test_setup_after_peerdas() else {
|
||||
let Some(mut r) = TestRig::test_setup_after_fulu() else {
|
||||
return;
|
||||
};
|
||||
let _supernode = r.new_connected_supernode_peer();
|
||||
@@ -2164,7 +2152,7 @@ fn sampling_batch_requests_not_enough_responses_returned() {
|
||||
|
||||
#[test]
|
||||
fn custody_lookup_happy_path() {
|
||||
let Some(mut r) = TestRig::test_setup_after_peerdas() else {
|
||||
let Some(mut r) = TestRig::test_setup_after_fulu() else {
|
||||
return;
|
||||
};
|
||||
let spec = E::default_spec();
|
||||
@@ -2238,7 +2226,7 @@ mod deneb_only {
|
||||
|
||||
impl DenebTester {
|
||||
fn new(request_trigger: RequestTrigger) -> Option<Self> {
|
||||
let Some(mut rig) = TestRig::test_setup_after_deneb() else {
|
||||
let Some(mut rig) = TestRig::test_setup_after_deneb_before_fulu() else {
|
||||
return None;
|
||||
};
|
||||
let (block, blobs) = rig.rand_block_and_blobs(NumBlobs::Random);
|
||||
@@ -2963,7 +2951,7 @@ mod deneb_only {
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn no_peer_penalty_when_rpc_response_already_known_from_gossip() {
|
||||
let Some(mut r) = TestRig::test_setup_after_deneb() else {
|
||||
let Some(mut r) = TestRig::test_setup_after_deneb_before_fulu() else {
|
||||
return;
|
||||
};
|
||||
let (block, blobs) = r.rand_block_and_blobs(NumBlobs::Number(2));
|
||||
|
||||
Reference in New Issue
Block a user