mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-10 01:26:44 +00:00
Run network tests for gloas
This commit is contained in:
9
Makefile
9
Makefile
@@ -30,17 +30,15 @@ TEST_FEATURES ?=
|
|||||||
# Cargo profile for regular builds.
|
# Cargo profile for regular builds.
|
||||||
PROFILE ?= release
|
PROFILE ?= release
|
||||||
|
|
||||||
# List of all hard forks up to gloas. This list is used to set env variables for several tests so that
|
# List of recent hard forks before Gloas. Used by tests that do not support Gloas yet.
|
||||||
# they run for different forks.
|
|
||||||
# TODO(EIP-7732) Remove this once we extend network tests to support gloas and use RECENT_FORKS instead
|
|
||||||
RECENT_FORKS_BEFORE_GLOAS=fulu
|
RECENT_FORKS_BEFORE_GLOAS=fulu
|
||||||
|
|
||||||
# List of all recent hard forks. This list is used to set env variables for http_api tests
|
# List of all recent hard forks. This list is used to set env variables for several tests.
|
||||||
# Include phase0 to test the code paths in sync that are pre blobs
|
# Include phase0 to test the code paths in sync that are pre blobs
|
||||||
RECENT_FORKS=fulu gloas
|
RECENT_FORKS=fulu gloas
|
||||||
|
|
||||||
# For network tests include phase0 to cover genesis syncing (blocks without blobs or columns)
|
# For network tests include phase0 to cover genesis syncing (blocks without blobs or columns)
|
||||||
TEST_NETWORK_FORKS=phase0 $(RECENT_FORKS_BEFORE_GLOAS)
|
TEST_NETWORK_FORKS=phase0 $(RECENT_FORKS)
|
||||||
|
|
||||||
# Extra flags for Cargo
|
# Extra flags for Cargo
|
||||||
CARGO_INSTALL_EXTRA_FLAGS?=
|
CARGO_INSTALL_EXTRA_FLAGS?=
|
||||||
@@ -228,7 +226,6 @@ test-op-pool-%:
|
|||||||
-p operation_pool
|
-p operation_pool
|
||||||
|
|
||||||
# Run the tests in the `network` crate for all known forks.
|
# Run the tests in the `network` crate for all known forks.
|
||||||
# TODO(EIP-7732) Extend to support gloas by using RECENT_FORKS instead
|
|
||||||
test-network: $(patsubst %,test-network-%,$(TEST_NETWORK_FORKS))
|
test-network: $(patsubst %,test-network-%,$(TEST_NETWORK_FORKS))
|
||||||
|
|
||||||
test-network-%:
|
test-network-%:
|
||||||
|
|||||||
@@ -65,10 +65,8 @@ pub struct SimulateConfig {
|
|||||||
return_no_columns_on_indices: Vec<ColumnIndex>,
|
return_no_columns_on_indices: Vec<ColumnIndex>,
|
||||||
/// Only omit columns for this block root, if set.
|
/// Only omit columns for this block root, if set.
|
||||||
return_no_columns_for_block: Option<Hash256>,
|
return_no_columns_for_block: Option<Hash256>,
|
||||||
/// Empty `PayloadEnvelopesByRoot` responses remaining.
|
/// Leave matching envelope requests unanswered.
|
||||||
return_no_envelope_n_times: usize,
|
hold_envelope_for_block: Option<Hash256>,
|
||||||
/// Block whose payload envelope is withheld.
|
|
||||||
return_no_envelope_for_block: Option<Hash256>,
|
|
||||||
skip_by_range_routes: bool,
|
skip_by_range_routes: bool,
|
||||||
// Use a callable fn because BlockProcessingResult does not implement Clone
|
// Use a callable fn because BlockProcessingResult does not implement Clone
|
||||||
#[educe(Debug(ignore))]
|
#[educe(Debug(ignore))]
|
||||||
@@ -147,9 +145,8 @@ impl SimulateConfig {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn return_no_envelope_for_block(mut self, block_root: Hash256, times: usize) -> Self {
|
fn hold_envelope_for_block(mut self, block_root: Hash256) -> Self {
|
||||||
self.return_no_envelope_for_block = Some(block_root);
|
self.hold_envelope_for_block = Some(block_root);
|
||||||
self.return_no_envelope_n_times = times;
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,15 +666,10 @@ impl TestRig {
|
|||||||
.first()
|
.first()
|
||||||
.copied()
|
.copied()
|
||||||
.unwrap_or_else(|| panic!("empty envelope request: {req:?}"));
|
.unwrap_or_else(|| panic!("empty envelope request: {req:?}"));
|
||||||
let withhold = self.complete_strategy.return_no_envelope_for_block
|
if self.complete_strategy.hold_envelope_for_block == Some(block_root) {
|
||||||
== Some(block_root)
|
return;
|
||||||
&& self.complete_strategy.return_no_envelope_n_times > 0;
|
}
|
||||||
let envelope = if withhold {
|
let envelope = self.network_envelopes_by_root.get(&block_root).cloned();
|
||||||
self.complete_strategy.return_no_envelope_n_times -= 1;
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
self.network_envelopes_by_root.get(&block_root).cloned()
|
|
||||||
};
|
|
||||||
self.send_rpc_envelope_response(req_id, peer_id, envelope);
|
self.send_rpc_envelope_response(req_id, peer_id, envelope);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1079,7 +1071,7 @@ impl TestRig {
|
|||||||
let block = external_harness.get_full_block(&block_root);
|
let block = external_harness.get_full_block(&block_root);
|
||||||
let block_root = block.canonical_root();
|
let block_root = block.canonical_root();
|
||||||
let block_slot = block.slot();
|
let block_slot = block.slot();
|
||||||
let block_hash = block.payload_bid_block_hash().unwrap();
|
let block_hash = block.as_block().payload_bid_block_hash().unwrap();
|
||||||
self.network_blocks_by_root
|
self.network_blocks_by_root
|
||||||
.insert(block_root, block.clone());
|
.insert(block_root, block.clone());
|
||||||
self.network_blocks_by_slot.insert(block_slot, block);
|
self.network_blocks_by_slot.insert(block_slot, block);
|
||||||
@@ -2716,7 +2708,7 @@ async fn gloas_empty_child_continues_while_parent_payload_withheld() {
|
|||||||
|
|
||||||
r.trigger_full_empty_fork(&fork);
|
r.trigger_full_empty_fork(&fork);
|
||||||
|
|
||||||
r.simulate(SimulateConfig::happy_path().return_no_envelope_for_block(fork.a, usize::MAX))
|
r.simulate(SimulateConfig::happy_path().hold_envelope_for_block(fork.a))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
assert_eq!(r.head_root(), fork.c);
|
assert_eq!(r.head_root(), fork.c);
|
||||||
|
|||||||
Reference in New Issue
Block a user