Skip to content

Commit cdef1ff

Browse files
committed
reduce future sizes in tests
1 parent 5fd8d37 commit cdef1ff

File tree

5 files changed

+80
-48
lines changed

5 files changed

+80
-48
lines changed

beacon_node/beacon_chain/tests/bellatrix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async fn base_altair_bellatrix_with_terminal_block_after_fork() {
133133
* Do the Bellatrix fork, without a terminal PoW block.
134134
*/
135135

136-
harness.extend_to_slot(bellatrix_fork_slot).await;
136+
Box::pin(harness.extend_to_slot(bellatrix_fork_slot)).await;
137137

138138
let bellatrix_head = &harness.chain.head_snapshot().beacon_block;
139139
assert!(bellatrix_head.as_bellatrix().is_ok());

beacon_node/beacon_chain/tests/capella.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async fn base_altair_bellatrix_capella() {
5454
/*
5555
* Do the Altair fork.
5656
*/
57-
harness.extend_to_slot(altair_fork_slot).await;
57+
Box::pin(harness.extend_to_slot(altair_fork_slot)).await;
5858

5959
let altair_head = &harness.chain.head_snapshot().beacon_block;
6060
assert!(altair_head.as_altair().is_ok());
@@ -63,7 +63,7 @@ async fn base_altair_bellatrix_capella() {
6363
/*
6464
* Do the Bellatrix fork, without a terminal PoW block.
6565
*/
66-
harness.extend_to_slot(bellatrix_fork_slot).await;
66+
Box::pin(harness.extend_to_slot(bellatrix_fork_slot)).await;
6767

6868
let bellatrix_head = &harness.chain.head_snapshot().beacon_block;
6969
assert!(bellatrix_head.as_bellatrix().is_ok());
@@ -81,7 +81,7 @@ async fn base_altair_bellatrix_capella() {
8181
/*
8282
* Next Bellatrix block shouldn't include an exec payload.
8383
*/
84-
harness.extend_slots(1).await;
84+
Box::pin(harness.extend_slots(1)).await;
8585

8686
let one_after_bellatrix_head = &harness.chain.head_snapshot().beacon_block;
8787
assert!(
@@ -112,7 +112,7 @@ async fn base_altair_bellatrix_capella() {
112112
terminal_block.timestamp = timestamp;
113113
}
114114
});
115-
harness.extend_slots(1).await;
115+
Box::pin(harness.extend_slots(1)).await;
116116

117117
let two_after_bellatrix_head = &harness.chain.head_snapshot().beacon_block;
118118
assert!(

beacon_node/beacon_chain/tests/store_tests.rs

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,14 +1554,13 @@ async fn prunes_fork_growing_past_youngest_finalized_checkpoint() {
15541554
.map(Into::into)
15551555
.collect();
15561556
let canonical_state_root = canonical_state.update_tree_hash_cache().unwrap();
1557-
let (canonical_blocks, _, _, _) = rig
1558-
.add_attested_blocks_at_slots(
1559-
canonical_state,
1560-
canonical_state_root,
1561-
&canonical_slots,
1562-
&honest_validators,
1563-
)
1564-
.await;
1557+
let (canonical_blocks, _, _, _) = Box::pin(rig.add_attested_blocks_at_slots(
1558+
canonical_state,
1559+
canonical_state_root,
1560+
&canonical_slots,
1561+
&honest_validators,
1562+
))
1563+
.await;
15651564

15661565
// Postconditions
15671566
let canonical_blocks: HashMap<Slot, SignedBeaconBlockHash> = canonical_blocks_zeroth_epoch
@@ -1956,31 +1955,45 @@ async fn prune_shared_skip_states_mid_epoch() {
19561955
#[tokio::test]
19571956
async fn prune_shared_skip_states_epoch_boundaries() {
19581957
let slots_per_epoch = E::slots_per_epoch();
1959-
pruning_test(slots_per_epoch - 1, 1, slots_per_epoch, 2, slots_per_epoch).await;
1960-
pruning_test(slots_per_epoch - 1, 2, slots_per_epoch, 1, slots_per_epoch).await;
1961-
pruning_test(
1958+
Box::pin(pruning_test(
1959+
slots_per_epoch - 1,
1960+
1,
1961+
slots_per_epoch,
1962+
2,
1963+
slots_per_epoch,
1964+
))
1965+
.await;
1966+
Box::pin(pruning_test(
1967+
slots_per_epoch - 1,
1968+
2,
1969+
slots_per_epoch,
1970+
1,
1971+
slots_per_epoch,
1972+
))
1973+
.await;
1974+
Box::pin(pruning_test(
19621975
2 * slots_per_epoch + slots_per_epoch / 2,
19631976
slots_per_epoch / 2,
19641977
slots_per_epoch,
19651978
slots_per_epoch / 2 + 1,
19661979
slots_per_epoch,
1967-
)
1980+
))
19681981
.await;
1969-
pruning_test(
1982+
Box::pin(pruning_test(
19701983
2 * slots_per_epoch + slots_per_epoch / 2,
19711984
slots_per_epoch / 2,
19721985
slots_per_epoch,
19731986
slots_per_epoch / 2 + 1,
19741987
slots_per_epoch,
1975-
)
1988+
))
19761989
.await;
1977-
pruning_test(
1990+
Box::pin(pruning_test(
19781991
2 * slots_per_epoch - 1,
19791992
slots_per_epoch,
19801993
1,
19811994
0,
19821995
2 * slots_per_epoch,
1983-
)
1996+
))
19841997
.await;
19851998
}
19861999

@@ -2608,8 +2621,7 @@ async fn process_blocks_and_attestations_for_unaligned_checkpoint() {
26082621
harness.advance_slot();
26092622
}
26102623
harness.extend_to_slot(finalizing_slot - 1).await;
2611-
harness
2612-
.add_block_at_slot(finalizing_slot, harness.get_current_state())
2624+
Box::pin(harness.add_block_at_slot(finalizing_slot, harness.get_current_state()))
26132625
.await
26142626
.unwrap();
26152627

beacon_node/http_api/tests/tests.rs

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,7 +3508,7 @@ impl ApiTester {
35083508
self
35093509
}
35103510

3511-
#[allow(clippy::await_holding_lock)] // This is a test, so it should be fine.
3511+
#[allow(clippy::await_holding_lock)] // This is a test, so it should be fine.
35123512
pub async fn test_get_validator_aggregate_attestation(self) -> Self {
35133513
if self
35143514
.chain
@@ -6053,31 +6053,31 @@ async fn test_unsupported_media_response() {
60536053
}
60546054

60556055
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
6056-
async fn beacon_get() {
6056+
async fn beacon_get_state_hashes() {
60576057
ApiTester::new()
6058-
.await
6059-
.test_beacon_genesis()
60606058
.await
60616059
.test_beacon_states_root_finalized()
60626060
.await
6063-
.test_beacon_states_fork_finalized()
6064-
.await
60656061
.test_beacon_states_finality_checkpoints_finalized()
60666062
.await
6067-
.test_beacon_headers_block_id_finalized()
6063+
.test_beacon_states_root()
60686064
.await
6069-
.test_beacon_blocks_finalized()
6065+
.test_beacon_states_finality_checkpoints()
6066+
.await;
6067+
}
6068+
6069+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
6070+
async fn beacon_get_state_info() {
6071+
ApiTester::new()
60706072
.await
6071-
.test_beacon_blinded_blocks_finalized()
6073+
.test_beacon_genesis()
60726074
.await
6073-
.test_debug_beacon_states_finalized()
6075+
.test_beacon_states_fork_finalized()
60746076
.await
6075-
.test_beacon_states_root()
6077+
.test_debug_beacon_states_finalized()
60766078
.await
60776079
.test_beacon_states_fork()
60786080
.await
6079-
.test_beacon_states_finality_checkpoints()
6080-
.await
60816081
.test_beacon_states_validators()
60826082
.await
60836083
.test_beacon_states_validator_balances()
@@ -6087,6 +6087,18 @@ async fn beacon_get() {
60876087
.test_beacon_states_validator_id()
60886088
.await
60896089
.test_beacon_states_randao()
6090+
.await;
6091+
}
6092+
6093+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
6094+
async fn beacon_get_blocks() {
6095+
ApiTester::new()
6096+
.await
6097+
.test_beacon_headers_block_id_finalized()
6098+
.await
6099+
.test_beacon_blocks_finalized()
6100+
.await
6101+
.test_beacon_blinded_blocks_finalized()
60906102
.await
60916103
.test_beacon_headers_all_slots()
60926104
.await
@@ -6101,6 +6113,12 @@ async fn beacon_get() {
61016113
.test_beacon_blocks_attestations()
61026114
.await
61036115
.test_beacon_blocks_root()
6116+
.await;
6117+
}
6118+
6119+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
6120+
async fn beacon_get_pools() {
6121+
ApiTester::new()
61046122
.await
61056123
.test_get_beacon_pool_attestations()
61066124
.await

consensus/fork_choice/tests/tests.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,18 +1156,20 @@ async fn weak_subjectivity_check_epoch_boundary_is_skip_slot() {
11561156
};
11571157

11581158
// recreate the chain exactly
1159-
ForkChoiceTest::new_with_chain_config(chain_config.clone())
1160-
.apply_blocks_while(|_, state| state.finalized_checkpoint().epoch == 0)
1161-
.await
1162-
.unwrap()
1163-
.skip_slots(E::slots_per_epoch() as usize)
1164-
.apply_blocks_while(|_, state| state.finalized_checkpoint().epoch < 5)
1165-
.await
1166-
.unwrap()
1167-
.apply_blocks(1)
1168-
.await
1169-
.assert_finalized_epoch(5)
1170-
.assert_shutdown_signal_not_sent();
1159+
Box::pin(
1160+
ForkChoiceTest::new_with_chain_config(chain_config.clone())
1161+
.apply_blocks_while(|_, state| state.finalized_checkpoint().epoch == 0)
1162+
.await
1163+
.unwrap()
1164+
.skip_slots(E::slots_per_epoch() as usize)
1165+
.apply_blocks_while(|_, state| state.finalized_checkpoint().epoch < 5)
1166+
.await
1167+
.unwrap()
1168+
.apply_blocks(1),
1169+
)
1170+
.await
1171+
.assert_finalized_epoch(5)
1172+
.assert_shutdown_signal_not_sent();
11711173
}
11721174

11731175
#[tokio::test]

0 commit comments

Comments
 (0)