Skip to content

Commit

Permalink
BFT-496: Prune the external node instead of the main in the test
Browse files Browse the repository at this point in the history
  • Loading branch information
aakoshh committed Jul 31, 2024
1 parent 43390c3 commit 3c01e41
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/lib/dal/src/consensus_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ impl ConsensusDal<'_, '_> {
}
.await?
else {
tracing::info!(%genesis.first_block, "genesis block not found");
return Ok(None);
};
Ok(Some(AttestationStatus {
Expand Down
1 change: 1 addition & 0 deletions core/node/consensus/src/en.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ impl EN {
attester,
attestation_status,
};
tracing::info!("running the external node executor");
executor.run(ctx).await?;

Ok(())
Expand Down
2 changes: 2 additions & 0 deletions core/node/consensus/src/mn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ pub async fn run_main_node(
attester,
attestation_status,
};

tracing::info!("running the main node executor");
executor.run(ctx).await
})
.await
Expand Down
10 changes: 9 additions & 1 deletion core/node/consensus/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,16 @@ async fn test_with_pruning(version: ProtocolVersionId) {
.wait_for_batch(ctx, validator.last_sealed_batch())
.await?;

// The main node is not supposed to be pruned. In particular `ConsensusDal::attestation_status`
// does not look for where the last prune happened at, and thus if we prune the block genesis
// points at, we might never be able to start the Executor.
tracing::info!("Wait until the external node has all the batches we want to prune");
node_pool
.wait_for_batch(ctx, to_prune.next())
.await
.context("wait_for_batch()")?;
tracing::info!("Prune some blocks and sync more");
validator_pool
node_pool
.prune_batches(ctx, to_prune)
.await
.context("prune_batches")?;
Expand Down

0 comments on commit 3c01e41

Please sign in to comment.