mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 06:14:38 +00:00
Reduce number of blobs used in tests to speed up CI (#8194)
`beacon-chain-tests` is now regularly taking 1h+ on CI since Fulu fork was added.
This PR attemtpts to reduce the test time by bringing down the number of blobs generated in tests - instead of generating 0..max_blobs, the generator now generates 0..1 blobs by default, and this can be modified by setting `harness.execution_block_generator.set_min_blob_count(n)`.
Note: The blobs are pre-generated and doesn't require too much CPU to generate however processing a larger number of them on the beacon chain does take a lot of time.
This PR also include a few other small improvements
- Our slowest test (`chain_segment_varying_chunk_size`) runs 3x faster in Fulu just by reusing chain segments
- Avoid re-running fork specific tests on all forks
- Fix a bunch of tests that depends on the harness's existing random blob generation, which is fragile
beacon chain test time on test machine is **~2x** faster:
### `unstable`
```
Summary [ 751.586s] 291 tests run: 291 passed (13 slow), 0 skipped
```
### this branch
```
Summary [ 373.792s] 291 tests run: 291 passed (2 slow), 0 skipped
```
The next set of tests to optimise is the ones that use [`get_chain_segment`](77a9af96de/beacon_node/beacon_chain/tests/block_verification.rs (L45)), as it by default build 320 blocks with supernode - an easy optimisation would be to build these blocks with cgc = 8 for tests that only require fullnodes.
Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
Co-Authored-By: Jimmy Chen <jimmy@sigmaprime.io>
This commit is contained in:
@@ -468,7 +468,7 @@ mod test {
|
||||
|
||||
#[track_caller]
|
||||
fn test_validate_data_columns(kzg: &Kzg, spec: &ChainSpec) {
|
||||
let num_of_blobs = 6;
|
||||
let num_of_blobs = 2;
|
||||
let (signed_block, blobs, proofs) =
|
||||
create_test_fulu_block_and_blobs::<E>(num_of_blobs, spec);
|
||||
let blob_refs = blobs.iter().collect::<Vec<_>>();
|
||||
@@ -494,7 +494,8 @@ mod test {
|
||||
|
||||
#[track_caller]
|
||||
fn test_build_data_columns(kzg: &Kzg, spec: &ChainSpec) {
|
||||
let num_of_blobs = 6;
|
||||
// Using at least 2 blobs to make sure we're arranging the data columns correctly.
|
||||
let num_of_blobs = 2;
|
||||
let (signed_block, blobs, proofs) =
|
||||
create_test_fulu_block_and_blobs::<E>(num_of_blobs, spec);
|
||||
|
||||
@@ -534,6 +535,7 @@ mod test {
|
||||
|
||||
#[track_caller]
|
||||
fn test_reconstruct_data_columns(kzg: &Kzg, spec: &ChainSpec) {
|
||||
// Using at least 2 blobs to make sure we're arranging the data columns correctly.
|
||||
let num_of_blobs = 2;
|
||||
let (signed_block, blobs, proofs) =
|
||||
create_test_fulu_block_and_blobs::<E>(num_of_blobs, spec);
|
||||
@@ -557,6 +559,7 @@ mod test {
|
||||
|
||||
#[track_caller]
|
||||
fn test_reconstruct_data_columns_unordered(kzg: &Kzg, spec: &ChainSpec) {
|
||||
// Using at least 2 blobs to make sure we're arranging the data columns correctly.
|
||||
let num_of_blobs = 2;
|
||||
let (signed_block, blobs, proofs) =
|
||||
create_test_fulu_block_and_blobs::<E>(num_of_blobs, spec);
|
||||
@@ -578,7 +581,7 @@ mod test {
|
||||
|
||||
#[track_caller]
|
||||
fn test_reconstruct_blobs_from_data_columns(kzg: &Kzg, spec: &ChainSpec) {
|
||||
let num_of_blobs = 6;
|
||||
let num_of_blobs = 3;
|
||||
let (signed_block, blobs, proofs) =
|
||||
create_test_fulu_block_and_blobs::<E>(num_of_blobs, spec);
|
||||
let blob_refs = blobs.iter().collect::<Vec<_>>();
|
||||
@@ -588,7 +591,8 @@ mod test {
|
||||
|
||||
// Now reconstruct
|
||||
let signed_blinded_block = signed_block.into();
|
||||
let blob_indices = vec![3, 4, 5];
|
||||
// Using at least 2 blobs to make sure we're arranging the data columns correctly.
|
||||
let blob_indices = vec![1, 2];
|
||||
let reconstructed_blobs = reconstruct_blobs(
|
||||
kzg,
|
||||
&column_sidecars.iter().as_slice()[0..column_sidecars.len() / 2],
|
||||
|
||||
Reference in New Issue
Block a user