From 382baf601f153f237a29a3c148521902c65e0924 Mon Sep 17 00:00:00 2001 From: Bogdan Opanchuk Date: Wed, 12 Feb 2025 01:23:06 -0800 Subject: [PATCH] Merge communication info methods of Round into a single method --- CHANGELOG.md | 1 + examples/src/simple.rs | 20 +++------- manul/benches/async_session.rs | 14 +++---- manul/benches/empty_rounds.rs | 14 +++---- manul/src/combinators/chain.rs | 27 +++---------- manul/src/combinators/misbehave.rs | 19 ++------- manul/src/protocol.rs | 4 +- manul/src/protocol/object_safe.rs | 26 +++--------- manul/src/protocol/round.rs | 64 +++++++++++++++++++----------- manul/src/session/echo.rs | 23 ++++++----- manul/src/session/session.rs | 30 +++++++------- manul/src/tests/partial_echo.rs | 23 +++++------ 12 files changed, 112 insertions(+), 153 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b0be25..d92da09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed `Send + Sync` bound on `WireFormat`. ([#92]) - Removed `Send` bound on `ProtocolError`. ([#92]) - Merged `Round::id()`, `possible_next_rounds()` and `may_produce_result()` into `transition_info()`. ([#93]) +- Merged `Round::message_destinations()`, `expecting_messages_from()` and `echo_round_participation()` into `communication_info()`. ([#93]) ### Added diff --git a/examples/src/simple.rs b/examples/src/simple.rs index a56d8eb..ed52bfb 100644 --- a/examples/src/simple.rs +++ b/examples/src/simple.rs @@ -2,8 +2,8 @@ use alloc::collections::{BTreeMap, BTreeSet}; use core::fmt::Debug; use manul::protocol::{ - Artifact, BoxedRound, Deserializer, DirectMessage, EchoBroadcast, EntryPoint, FinalizeOutcome, LocalError, - MessageValidationError, NormalBroadcast, PartyId, Payload, Protocol, ProtocolError, ProtocolMessage, + Artifact, BoxedRound, CommunicationInfo, Deserializer, DirectMessage, EchoBroadcast, EntryPoint, FinalizeOutcome, + LocalError, MessageValidationError, NormalBroadcast, PartyId, Payload, Protocol, ProtocolError, ProtocolMessage, ProtocolMessagePart, ProtocolValidationError, ReceiveError, RequiredMessageParts, RequiredMessages, Round, RoundId, Serializer, TransitionInfo, }; @@ -199,8 +199,8 @@ impl Round for Round1 { TransitionInfo::new_linear(1) } - fn message_destinations(&self) -> &BTreeSet { - &self.context.other_ids + fn communication_info(&self) -> CommunicationInfo { + CommunicationInfo::regular(&self.context.other_ids) } fn make_normal_broadcast( @@ -294,10 +294,6 @@ impl Round for Round1 { }); Ok(FinalizeOutcome::AnotherRound(round2)) } - - fn expecting_messages_from(&self) -> &BTreeSet { - &self.context.other_ids - } } #[derive(Debug)] @@ -319,8 +315,8 @@ impl Round for Round2 { TransitionInfo::new_linear_terminating(2) } - fn message_destinations(&self) -> &BTreeSet { - &self.context.other_ids + fn communication_info(&self) -> CommunicationInfo { + CommunicationInfo::regular(&self.context.other_ids) } fn make_direct_message( @@ -382,10 +378,6 @@ impl Round for Round2 { Ok(FinalizeOutcome::Result(sum + self.round1_sum)) } - - fn expecting_messages_from(&self) -> &BTreeSet { - &self.context.other_ids - } } #[cfg(test)] diff --git a/manul/benches/async_session.rs b/manul/benches/async_session.rs index e7db900..e6d39a6 100644 --- a/manul/benches/async_session.rs +++ b/manul/benches/async_session.rs @@ -8,9 +8,9 @@ use criterion::{criterion_group, criterion_main, Criterion}; use manul::{ dev::{tokio::run_async, BinaryFormat, TestSessionParams, TestSigner}, protocol::{ - Artifact, BoxedRound, Deserializer, DirectMessage, EchoBroadcast, EntryPoint, FinalizeOutcome, LocalError, - MessageValidationError, NoProtocolErrors, NormalBroadcast, PartyId, Payload, Protocol, ProtocolMessage, - ProtocolMessagePart, ReceiveError, Round, RoundId, Serializer, TransitionInfo, + Artifact, BoxedRound, CommunicationInfo, Deserializer, DirectMessage, EchoBroadcast, EntryPoint, + FinalizeOutcome, LocalError, MessageValidationError, NoProtocolErrors, NormalBroadcast, PartyId, Payload, + Protocol, ProtocolMessage, ProtocolMessagePart, ReceiveError, Round, RoundId, Serializer, TransitionInfo, }, signature::Keypair, }; @@ -113,8 +113,8 @@ impl Round for EmptyRound { } } - fn message_destinations(&self) -> &BTreeSet { - &self.inputs.other_ids + fn communication_info(&self) -> CommunicationInfo { + CommunicationInfo::regular(&self.inputs.other_ids) } fn make_echo_broadcast( @@ -185,10 +185,6 @@ impl Round for EmptyRound { Ok(FinalizeOutcome::AnotherRound(round)) } } - - fn expecting_messages_from(&self) -> &BTreeSet { - &self.inputs.other_ids - } } fn bench_async_session(c: &mut Criterion) { diff --git a/manul/benches/empty_rounds.rs b/manul/benches/empty_rounds.rs index fba70fa..0703c26 100644 --- a/manul/benches/empty_rounds.rs +++ b/manul/benches/empty_rounds.rs @@ -7,9 +7,9 @@ use criterion::{criterion_group, criterion_main, Criterion}; use manul::{ dev::{run_sync, BinaryFormat, TestSessionParams, TestSigner}, protocol::{ - Artifact, BoxedRound, Deserializer, DirectMessage, EchoBroadcast, EntryPoint, FinalizeOutcome, LocalError, - MessageValidationError, NoProtocolErrors, NormalBroadcast, PartyId, Payload, Protocol, ProtocolMessage, - ProtocolMessagePart, ReceiveError, Round, RoundId, Serializer, TransitionInfo, + Artifact, BoxedRound, CommunicationInfo, Deserializer, DirectMessage, EchoBroadcast, EntryPoint, + FinalizeOutcome, LocalError, MessageValidationError, NoProtocolErrors, NormalBroadcast, PartyId, Payload, + Protocol, ProtocolMessage, ProtocolMessagePart, ReceiveError, Round, RoundId, Serializer, TransitionInfo, }, signature::Keypair, }; @@ -102,8 +102,8 @@ impl Round for EmptyRound { } } - fn message_destinations(&self) -> &BTreeSet { - &self.inputs.other_ids + fn communication_info(&self) -> CommunicationInfo { + CommunicationInfo::regular(&self.inputs.other_ids) } fn make_echo_broadcast( @@ -172,10 +172,6 @@ impl Round for EmptyRound { Ok(FinalizeOutcome::AnotherRound(round)) } } - - fn expecting_messages_from(&self) -> &BTreeSet { - &self.inputs.other_ids - } } fn bench_empty_rounds(c: &mut Criterion) { diff --git a/manul/src/combinators/chain.rs b/manul/src/combinators/chain.rs index 939fb61..d3ee435 100644 --- a/manul/src/combinators/chain.rs +++ b/manul/src/combinators/chain.rs @@ -49,17 +49,14 @@ Usage: when verifying evidence from the chained protocol. */ -use alloc::{ - boxed::Box, - collections::{BTreeMap, BTreeSet}, -}; +use alloc::{boxed::Box, collections::BTreeMap}; use core::fmt::{self, Debug}; use rand_core::CryptoRngCore; use serde::{Deserialize, Serialize}; use crate::protocol::{ - Artifact, BoxedRng, BoxedRound, Deserializer, DirectMessage, EchoBroadcast, EchoRoundParticipation, EntryPoint, + Artifact, BoxedRng, BoxedRound, CommunicationInfo, Deserializer, DirectMessage, EchoBroadcast, EntryPoint, FinalizeOutcome, LocalError, MessageValidationError, NormalBroadcast, ObjectSafeRound, PartyId, Payload, Protocol, ProtocolError, ProtocolMessage, ProtocolValidationError, ReceiveError, RequiredMessages, RoundId, Serializer, TransitionInfo, @@ -365,24 +362,10 @@ where } } - fn message_destinations(&self) -> &BTreeSet { - match &self.state { - ChainState::Protocol1 { round, .. } => round.as_ref().message_destinations(), - ChainState::Protocol2(round) => round.as_ref().message_destinations(), - } - } - - fn expecting_messages_from(&self) -> &BTreeSet { - match &self.state { - ChainState::Protocol1 { round, .. } => round.as_ref().expecting_messages_from(), - ChainState::Protocol2(round) => round.as_ref().expecting_messages_from(), - } - } - - fn echo_round_participation(&self) -> EchoRoundParticipation { + fn communication_info(&self) -> CommunicationInfo { match &self.state { - ChainState::Protocol1 { round, .. } => round.as_ref().echo_round_participation(), - ChainState::Protocol2(round) => round.as_ref().echo_round_participation(), + ChainState::Protocol1 { round, .. } => round.as_ref().communication_info(), + ChainState::Protocol2(round) => round.as_ref().communication_info(), } } diff --git a/manul/src/combinators/misbehave.rs b/manul/src/combinators/misbehave.rs index 3172698..5bfe276 100644 --- a/manul/src/combinators/misbehave.rs +++ b/manul/src/combinators/misbehave.rs @@ -23,16 +23,13 @@ Usage: as the entry point of the new protocol. */ -use alloc::{ - boxed::Box, - collections::{BTreeMap, BTreeSet}, -}; +use alloc::{boxed::Box, collections::BTreeMap}; use core::fmt::Debug; use rand_core::CryptoRngCore; use crate::protocol::{ - Artifact, BoxedRng, BoxedRound, Deserializer, DirectMessage, EchoBroadcast, EchoRoundParticipation, EntryPoint, + Artifact, BoxedRng, BoxedRound, CommunicationInfo, Deserializer, DirectMessage, EchoBroadcast, EntryPoint, FinalizeOutcome, LocalError, NormalBroadcast, ObjectSafeRound, PartyId, Payload, Protocol, ProtocolMessage, ReceiveError, RoundId, Serializer, TransitionInfo, }; @@ -237,16 +234,8 @@ where self.round.as_ref().transition_info() } - fn message_destinations(&self) -> &BTreeSet { - self.round.as_ref().message_destinations() - } - - fn expecting_messages_from(&self) -> &BTreeSet { - self.round.as_ref().expecting_messages_from() - } - - fn echo_round_participation(&self) -> EchoRoundParticipation { - self.round.as_ref().echo_round_participation() + fn communication_info(&self) -> CommunicationInfo { + self.round.as_ref().communication_info() } fn make_direct_message( diff --git a/manul/src/protocol.rs b/manul/src/protocol.rs index 5e77d55..48e2858 100644 --- a/manul/src/protocol.rs +++ b/manul/src/protocol.rs @@ -25,8 +25,8 @@ pub use errors::{ pub use message::{DirectMessage, EchoBroadcast, NormalBroadcast, ProtocolMessage, ProtocolMessagePart}; pub use object_safe::BoxedRound; pub use round::{ - Artifact, EchoRoundParticipation, EntryPoint, FinalizeOutcome, NoProtocolErrors, PartyId, Payload, Protocol, - ProtocolError, RequiredMessageParts, RequiredMessages, Round, + Artifact, CommunicationInfo, EchoRoundParticipation, EntryPoint, FinalizeOutcome, NoProtocolErrors, PartyId, + Payload, Protocol, ProtocolError, RequiredMessageParts, RequiredMessages, Round, }; pub use round_id::{RoundId, TransitionInfo}; pub use serialization::{Deserializer, Serializer}; diff --git a/manul/src/protocol/object_safe.rs b/manul/src/protocol/object_safe.rs index 0d3aeb3..9a7c384 100644 --- a/manul/src/protocol/object_safe.rs +++ b/manul/src/protocol/object_safe.rs @@ -1,8 +1,4 @@ -use alloc::{ - boxed::Box, - collections::{BTreeMap, BTreeSet}, - format, -}; +use alloc::{boxed::Box, collections::BTreeMap, format}; use core::{fmt::Debug, marker::PhantomData}; use rand_core::{CryptoRng, CryptoRngCore, RngCore}; @@ -10,7 +6,7 @@ use rand_core::{CryptoRng, CryptoRngCore, RngCore}; use super::{ errors::{LocalError, ReceiveError}, message::{DirectMessage, EchoBroadcast, NormalBroadcast, ProtocolMessage}, - round::{Artifact, EchoRoundParticipation, FinalizeOutcome, PartyId, Payload, Protocol, Round}, + round::{Artifact, CommunicationInfo, FinalizeOutcome, PartyId, Payload, Protocol, Round}, round_id::{RoundId, TransitionInfo}, serialization::{Deserializer, Serializer}, }; @@ -45,11 +41,7 @@ pub(crate) trait ObjectSafeRound: 'static + Debug + Send + Sync { fn transition_info(&self) -> TransitionInfo; - fn message_destinations(&self) -> &BTreeSet; - - fn expecting_messages_from(&self) -> &BTreeSet; - - fn echo_round_participation(&self) -> EchoRoundParticipation; + fn communication_info(&self) -> CommunicationInfo; fn make_direct_message( &self, @@ -124,16 +116,8 @@ where self.round.transition_info() } - fn message_destinations(&self) -> &BTreeSet { - self.round.message_destinations() - } - - fn expecting_messages_from(&self) -> &BTreeSet { - self.round.expecting_messages_from() - } - - fn echo_round_participation(&self) -> EchoRoundParticipation { - self.round.echo_round_participation() + fn communication_info(&self) -> CommunicationInfo { + self.round.communication_info() } fn make_direct_message( diff --git a/manul/src/protocol/round.rs b/manul/src/protocol/round.rs index a498b5b..e535136 100644 --- a/manul/src/protocol/round.rs +++ b/manul/src/protocol/round.rs @@ -19,6 +19,43 @@ use super::{ serialization::{Deserializer, Serializer}, }; +/// Describes what other parties this rounds sends messages to, and what other parties it expects messages from. +#[derive(Debug, Clone)] +pub struct CommunicationInfo { + /// The destinations of the messages to be sent out by this round. + /// + /// The way it is interpreted by the execution layer is + /// - An echo broadcast (if any) is sent to all of these destinations; + /// - A direct message is sent to each of these destinations, + /// which means [`make_direct_message`](`Round::make_direct_message`) may be called + /// for each element of the returned set. + pub message_destinations: BTreeSet, + + /// Returns the set of node IDs from which this round expects messages. + /// + /// The execution layer will not call [`finalize`](`Round::finalize`) until all these nodes have responded + /// (and the corresponding [`receive_message`](`Round::receive_message`) finished successfully). + pub expecting_messages_from: BTreeSet, + + /// Returns the specific way the node participates in the echo round following this round. + /// + /// Returns [`EchoRoundParticipation::Default`] by default; this works fine when every node + /// sends messages to every other one, or do not send or receive any echo broadcasts. + /// Otherwise, review the options in [`EchoRoundParticipation`] and pick the appropriate one. + pub echo_round_participation: EchoRoundParticipation, +} + +impl CommunicationInfo { + /// A regular round that sends messages to all `other_parties`, and expects messages back from them. + pub fn regular(other_parties: &BTreeSet) -> Self { + Self { + message_destinations: other_parties.clone(), + expecting_messages_from: other_parties.clone(), + echo_round_participation: EchoRoundParticipation::Default, + } + } +} + /// Possible successful outcomes of [`Round::finalize`]. #[derive(Debug)] pub enum FinalizeOutcome> { @@ -338,29 +375,10 @@ pub trait Round: 'static + Debug + Send + Sync { /// See [`TransitionInfo`] documentation for more details. fn transition_info(&self) -> TransitionInfo; - /// The destinations of the messages to be sent out by this round. + /// Returns the information about the communication this rounds engages in with other nodes. /// - /// The way it is interpreted by the execution layer is - /// - An echo broadcast (if any) is sent to all of these destinations; - /// - A direct message is sent to each of these destinations, - /// which means [`make_direct_message`](`Self::make_direct_message`) may be called - /// for each element of the returned set. - fn message_destinations(&self) -> &BTreeSet; - - /// Returns the set of node IDs from which this round expects messages. - /// - /// The execution layer will not call [`finalize`](`Self::finalize`) until all these nodes have responded - /// (and the corresponding [`receive_message`](`Self::receive_message`) finished successfully). - fn expecting_messages_from(&self) -> &BTreeSet; - - /// Returns the specific way the node participates in the echo round following this round. - /// - /// Returns [`EchoRoundParticipation::Default`] by default; this works fine when every node - /// sends messages to every other one, or do not send or receive any echo broadcasts. - /// Otherwise, review the options in [`EchoRoundParticipation`] and pick the appropriate one. - fn echo_round_participation(&self) -> EchoRoundParticipation { - EchoRoundParticipation::Default - } + /// See [`CommunicationInfo`] documentation for more details. + fn communication_info(&self) -> CommunicationInfo; /// Returns the direct message to the given destination and (maybe) an accompanying artifact. /// @@ -399,7 +417,7 @@ pub trait Round: 'static + Debug + Send + Sync { /// Return [`NormalBroadcast::none`] if this round does not send normal broadcast messages. /// This is also the blanket implementation. /// - /// Unlike the echo broadcasts, these will be just sent to every node from [`Self::message_destinations`] + /// Unlike the echo broadcasts, these will be just sent to every node defined in [`Self::communication_info`] /// without any confirmation required. fn make_normal_broadcast( &self, diff --git a/manul/src/session/echo.rs b/manul/src/session/echo.rs index 121ae72..568322d 100644 --- a/manul/src/session/echo.rs +++ b/manul/src/session/echo.rs @@ -17,9 +17,9 @@ use super::{ }; use crate::{ protocol::{ - Artifact, BoxedRound, Deserializer, DirectMessage, EchoBroadcast, FinalizeOutcome, MessageValidationError, - NormalBroadcast, Payload, Protocol, ProtocolMessage, ProtocolMessagePart, ReceiveError, Round, Serializer, - TransitionInfo, + Artifact, BoxedRound, CommunicationInfo, Deserializer, DirectMessage, EchoBroadcast, EchoRoundParticipation, + FinalizeOutcome, MessageValidationError, NormalBroadcast, Payload, Protocol, ProtocolMessage, + ProtocolMessagePart, ReceiveError, Round, Serializer, TransitionInfo, }, utils::SerializableMap, }; @@ -70,6 +70,7 @@ pub struct EchoRound, SP: SessionParameters> { verifier: SP::Verifier, echo_broadcasts: BTreeMap>, echo_round_info: EchoRoundInfo, + communication_info: CommunicationInfo, main_round: BoxedRound, payloads: BTreeMap, artifacts: BTreeMap, @@ -89,10 +90,18 @@ where artifacts: BTreeMap, ) -> Self { debug!("{:?}: initialized echo round with {:?}", verifier, echo_round_info); + + let communication_info = CommunicationInfo { + message_destinations: echo_round_info.message_destinations.clone(), + expecting_messages_from: echo_round_info.expecting_messages_from.clone(), + echo_round_participation: EchoRoundParticipation::Default, + }; + Self { verifier, echo_broadcasts, echo_round_info, + communication_info, main_round, payloads, artifacts, @@ -138,8 +147,8 @@ where .expect("the main round is not an echo round") } - fn message_destinations(&self) -> &BTreeSet { - &self.echo_round_info.message_destinations + fn communication_info(&self) -> CommunicationInfo { + self.communication_info.clone() } fn make_normal_broadcast( @@ -168,10 +177,6 @@ where NormalBroadcast::new(serializer, message) } - fn expecting_messages_from(&self) -> &BTreeSet { - &self.echo_round_info.expecting_messages_from - } - fn receive_message( &self, deserializer: &Deserializer, diff --git a/manul/src/session/session.rs b/manul/src/session/session.rs index ee22752..eec696b 100644 --- a/manul/src/session/session.rs +++ b/manul/src/session/session.rs @@ -23,9 +23,9 @@ use super::{ LocalError, RemoteError, }; use crate::protocol::{ - Artifact, BoxedRound, Deserializer, DirectMessage, EchoBroadcast, EchoRoundParticipation, EntryPoint, - FinalizeOutcome, NormalBroadcast, PartyId, Payload, Protocol, ProtocolMessage, ProtocolMessagePart, ReceiveError, - ReceiveErrorType, RoundId, Serializer, TransitionInfo, + Artifact, BoxedRound, CommunicationInfo, Deserializer, DirectMessage, EchoBroadcast, EchoRoundParticipation, + EntryPoint, FinalizeOutcome, NormalBroadcast, PartyId, Payload, Protocol, ProtocolMessage, ProtocolMessagePart, + ReceiveError, ReceiveErrorType, RoundId, Serializer, TransitionInfo, }; /// A set of types needed to execute a session. @@ -114,7 +114,7 @@ pub struct Session, SP: SessionParameters> { serializer: Serializer, deserializer: Deserializer, round: BoxedRound, - message_destinations: BTreeSet, + communication_info: CommunicationInfo, echo_round_info: Option>, echo_broadcast: SignedMessagePart, normal_broadcast: SignedMessagePart, @@ -184,20 +184,18 @@ where let normal = round.as_ref().make_normal_broadcast(rng, &serializer, &deserializer)?; let normal_broadcast = SignedMessagePart::new::(rng, &signer, &session_id, &transition_info.id(), normal)?; - let message_destinations = round.as_ref().message_destinations().clone(); - - let echo_round_participation = round.as_ref().echo_round_participation(); + let communication_info = round.as_ref().communication_info(); let round_sends_echo_broadcast = !echo_broadcast.payload().is_none(); - let echo_round_info = match echo_round_participation { + let echo_round_info = match &communication_info.echo_round_participation { EchoRoundParticipation::Default => { if round_sends_echo_broadcast { // Add our own echo message to the expected list because we expect it to be sent back from other nodes. - let mut expected_echos = round.as_ref().expecting_messages_from().clone(); + let mut expected_echos = communication_info.expecting_messages_from.clone(); expected_echos.insert(verifier.clone()); Some(EchoRoundInfo { - message_destinations: message_destinations.clone(), - expecting_messages_from: message_destinations.clone(), + message_destinations: communication_info.message_destinations.clone(), + expecting_messages_from: communication_info.message_destinations.clone(), expected_echos, }) } else { @@ -207,8 +205,8 @@ where EchoRoundParticipation::Send => None, EchoRoundParticipation::Receive { echo_targets } => Some(EchoRoundInfo { message_destinations: echo_targets.clone(), - expecting_messages_from: echo_targets, - expected_echos: round.as_ref().expecting_messages_from().clone(), + expecting_messages_from: echo_targets.clone(), + expected_echos: communication_info.expecting_messages_from.clone(), }), }; @@ -222,7 +220,7 @@ where echo_broadcast, normal_broadcast, transition_info, - message_destinations, + communication_info, echo_round_info, transcript, }) @@ -240,7 +238,7 @@ where /// Returns the set of message destinations for the current round. pub fn message_destinations(&self) -> &BTreeSet { - &self.message_destinations + &self.communication_info.message_destinations } /// Creates the message to be sent to the given destination. @@ -427,7 +425,7 @@ where /// Makes an accumulator for a new round. pub fn make_accumulator(&self) -> RoundAccumulator { - RoundAccumulator::new(self.round.as_ref().expecting_messages_from()) + RoundAccumulator::new(&self.communication_info.expecting_messages_from) } fn terminate_inner( diff --git a/manul/src/tests/partial_echo.rs b/manul/src/tests/partial_echo.rs index 19aacd7..b7e07f5 100644 --- a/manul/src/tests/partial_echo.rs +++ b/manul/src/tests/partial_echo.rs @@ -11,9 +11,10 @@ use serde::{Deserialize, Serialize}; use crate::{ dev::{run_sync, BinaryFormat, TestSessionParams, TestSigner, TestVerifier}, protocol::{ - Artifact, BoxedRound, Deserializer, DirectMessage, EchoBroadcast, EchoRoundParticipation, EntryPoint, - FinalizeOutcome, LocalError, MessageValidationError, NoProtocolErrors, NormalBroadcast, PartyId, Payload, - Protocol, ProtocolMessage, ProtocolMessagePart, ReceiveError, Round, RoundId, Serializer, TransitionInfo, + Artifact, BoxedRound, CommunicationInfo, Deserializer, DirectMessage, EchoBroadcast, EchoRoundParticipation, + EntryPoint, FinalizeOutcome, LocalError, MessageValidationError, NoProtocolErrors, NormalBroadcast, PartyId, + Payload, Protocol, ProtocolMessage, ProtocolMessagePart, ReceiveError, Round, RoundId, Serializer, + TransitionInfo, }, signature::Keypair, }; @@ -92,16 +93,12 @@ impl Deserialize<'de>> Round for Round1 &BTreeSet { - &self.inputs.message_destinations - } - - fn expecting_messages_from(&self) -> &BTreeSet { - &self.inputs.expecting_messages_from - } - - fn echo_round_participation(&self) -> EchoRoundParticipation { - self.inputs.echo_round_participation.clone() + fn communication_info(&self) -> CommunicationInfo { + CommunicationInfo { + message_destinations: self.inputs.message_destinations.clone(), + expecting_messages_from: self.inputs.expecting_messages_from.clone(), + echo_round_participation: self.inputs.echo_round_participation.clone(), + } } fn make_echo_broadcast(