message: [consensus] impl conversions from/to prost proto and Proposal
  Closes:
  Approved by: delegate
diff: @@ -8,6 +8,7 @@ use crate::chained_bft::{
  use failure::prelude::*;
  use network::proto::Proposal as ProtoProposal;
  use proto_conv::{FromProto, IntoProto};
  +use std::convert::{TryFrom, TryInto};
  use std::fmt;
  use types::crypto_proxies::ValidatorVerifier;
  @@ -35,6 +36,26 @@ impl<T: Payload> FromProto for ProposalUncheckedSignatures<T> {
  }
  }
  +impl<T: Payload> TryFrom<network::proto::consensus_prost::Proposal>
  + for ProposalUncheckedSignatures<T>
  +{
  + type Error = failure::Error;
  +
  + fn try_from(proto: network::proto::consensus_prost::Proposal) -> failure::Result<Self> {
  + let proposal = proto
  + .proposed_block
  + .ok_or_else(|| format_err!("Missing proposed_block"))?
  + .try_into()?;
  + let sync_info = proto
  + .sync_info
  + .ok_or_else(|| format_err!("Missing sync_info"))?
  + .try_into()?;
  + Ok(ProposalUncheckedSignatures(ProposalMsg::new(
  + proposal, sync_info,
  + )))
  + }
  +}
  +
  #[cfg(any(test, feature = "fuzzing"))]
  impl<T: Payload> From<ProposalUncheckedSignatures<T>> for ProposalMsg<T> {
  fn from(proposal: ProposalUncheckedSignatures<T>) -> Self {
  @@ -169,3 +190,12 @@ impl<T: Payload> IntoProto for ProposalMsg<T> {
  proto
  }
  }
  +
  +impl<T: Payload> From<ProposalMsg<T>> for network::proto::consensus_prost::Proposal {
  + fn from(proposal: ProposalMsg<T>) -> Self {
  + Self {
  + proposed_block: Some(proposal.proposal.into()),
  + sync_info: Some(proposal.sync_info.into()),
  + }
  + }
  +}
  