message: [consensus] fix the flaky reconfiguration test
  Closes:
  Approved by: davidiw
diff: @@ -28,7 +28,8 @@ use libra_config::config::{
  use libra_crypto::hash::CryptoHash;
  use libra_types::{
  crypto_proxies::{
  - random_validator_verifier, LedgerInfoWithSignatures, ValidatorSigner, ValidatorVerifier,
  + random_validator_verifier, LedgerInfoWithSignatures, ValidatorChangeEventWithProof,
  + ValidatorSigner, ValidatorVerifier,
  },
  validator_set::ValidatorSet,
  };
  @@ -882,23 +883,19 @@ fn reconfiguration_test() {
  // This quorum size needs to be 2f+1 because we derive the ValidatorVerifier from ValidatorSet at network.rs
  // which doesn't support specializing quorum power
  let _nodes = SMRNode::start_num_nodes(4, &mut playground, MultipleOrderedProposers, true);
  + let target_epoch = 10;
  block_on(async move {
  // Test we can survive a few epochs
  - for _ in 0..10 {
  - // The first proposal would result in a reconfiguration and it takes two more rounds
  - // to commit it.
  - for _ in 0..3 {
  - playground
  - .wait_for_messages(2, NetworkPlayground::proposals_only)
  - .await;
  - playground
  - .wait_for_messages(2, NetworkPlayground::votes_only)
  + loop {
  + let mut msg = playground
  + .wait_for_messages(1, NetworkPlayground::take_all)
  .await;
  + if let Some(ConsensusMsg_oneof::EpochChange(proof)) = msg.pop().unwrap().1.message {
  + let proof = ValidatorChangeEventWithProof::try_from(proof).unwrap();
  + if proof.epoch().unwrap() == target_epoch {
  + break;
  + }
  }
  - // Once the reconfiguration committed, we'll see epoch change messages.
  - playground
  - .wait_for_messages(2, NetworkPlayground::epoch_change_only)
  - .await;
  }
  });
  }
  