Fixes/improvements for disputes (#3753)

* More debugging output.

* Fix chain selection in case of disputes.

* Fix flaky test.
This commit is contained in:
Robert Klotzner
2021-09-01 21:25:56 +02:00
committed by GitHub
parent bff0ed532f
commit ffcde1e5e7
7 changed files with 60 additions and 31 deletions
@@ -434,7 +434,7 @@ where
overseer
.send_msg(
DisputeCoordinatorMessage::DetermineUndisputedChain {
base_number: target_number,
base: (target_number, target_hash),
block_descriptions: subchain_block_descriptions,
tx,
},
@@ -444,8 +444,7 @@ where
let (subchain_number, subchain_head) = rx
.await
.map_err(Error::OverseerDisconnected)
.map_err(|e| ConsensusError::Other(Box::new(e)))?
.unwrap_or_else(|| (subchain_number, subchain_head));
.map_err(|e| ConsensusError::Other(Box::new(e)))?;
// The the total lag accounting for disputes.
let lag_disputes = initial_leaf_number.saturating_sub(subchain_number);
+4 -2
View File
@@ -383,18 +383,20 @@ async fn test_skeleton(
);
tracing::trace!("determine undisputed chain response: {:?}", undisputed_chain);
let target_block_number = chain.number(target_block_hash).unwrap().unwrap();
assert_matches!(
overseer_recv(
virtual_overseer
).await,
AllMessages::DisputeCoordinator(
DisputeCoordinatorMessage::DetermineUndisputedChain {
base_number: _,
base: _,
block_descriptions: _,
tx,
}
) => {
tx.send(undisputed_chain).unwrap();
tx.send(undisputed_chain.unwrap_or((target_block_number, target_block_hash))).unwrap();
});
}