@@ -13,8 +13,8 @@ use crate::{
13
13
dev:: { run_sync, BinaryFormat , TestSessionParams , TestSigner , TestVerifier } ,
14
14
protocol:: {
15
15
Artifact , BoxedFormat , BoxedRound , CommunicationInfo , DirectMessage , EchoBroadcast , EchoRoundParticipation ,
16
- EntryPoint , FinalizeOutcome , LocalError , MessageValidationError , NoProtocolErrors , NormalBroadcast , PartyId ,
17
- Payload , Protocol , ProtocolMessage , ProtocolMessagePart , ReceiveError , Round , RoundId , TransitionInfo ,
16
+ EntryPoint , FinalizeOutcome , IdSet , LocalError , MessageValidationError , NoProtocolErrors , NormalBroadcast ,
17
+ PartyId , Payload , Protocol , ProtocolMessage , ProtocolMessagePart , ReceiveError , Round , RoundId , TransitionInfo ,
18
18
} ,
19
19
signature:: Keypair ,
20
20
} ;
@@ -55,7 +55,7 @@ impl<Id: PartyId> Protocol<Id> for PartialEchoProtocol<Id> {
55
55
struct Inputs < Id > {
56
56
id : Id ,
57
57
message_destinations : BTreeSet < Id > ,
58
- expecting_messages_from : BTreeSet < Id > ,
58
+ expecting_messages_from : IdSet < Id > ,
59
59
echo_round_participation : EchoRoundParticipation < Id > ,
60
60
}
61
61
@@ -127,12 +127,13 @@ impl<Id: PartyId + Serialize + for<'de> Deserialize<'de>> Round<Id> for Round1<I
127
127
message. normal_broadcast . assert_is_none ( ) ?;
128
128
message. direct_message . assert_is_none ( ) ?;
129
129
130
- if self . inputs . expecting_messages_from . is_empty ( ) {
130
+ // TODO: or use an Option<>?
131
+ if self . inputs . expecting_messages_from . all ( ) . is_empty ( ) {
131
132
message. echo_broadcast . assert_is_none ( ) ?;
132
133
} else {
133
134
let echo = message. echo_broadcast . deserialize :: < Round1Echo < Id > > ( format) ?;
134
135
assert_eq ! ( & echo. sender, from) ;
135
- assert ! ( self . inputs. expecting_messages_from. contains( from) ) ;
136
+ assert ! ( self . inputs. expecting_messages_from. all ( ) . contains( from) ) ;
136
137
}
137
138
138
139
Ok ( Payload :: new ( ( ) ) )
@@ -163,7 +164,7 @@ fn partial_echo() {
163
164
Inputs {
164
165
id : signers[ 0 ] . verifying_key ( ) ,
165
166
message_destinations : BTreeSet :: from ( [ ids[ 1 ] , ids[ 2 ] , ids[ 3 ] ] ) ,
166
- expecting_messages_from : BTreeSet :: new ( ) ,
167
+ expecting_messages_from : IdSet :: empty ( ) ,
167
168
echo_round_participation : EchoRoundParticipation :: Send ,
168
169
} ,
169
170
) ;
@@ -172,7 +173,7 @@ fn partial_echo() {
172
173
Inputs {
173
174
id : signers[ 1 ] . verifying_key ( ) ,
174
175
message_destinations : BTreeSet :: from ( [ ids[ 2 ] , ids[ 3 ] ] ) ,
175
- expecting_messages_from : BTreeSet :: from ( [ ids[ 0 ] ] ) ,
176
+ expecting_messages_from : IdSet :: new_non_threshold ( [ ids[ 0 ] ] . into ( ) ) ,
176
177
echo_round_participation : EchoRoundParticipation :: Default ,
177
178
} ,
178
179
) ;
@@ -181,7 +182,7 @@ fn partial_echo() {
181
182
Inputs {
182
183
id : signers[ 2 ] . verifying_key ( ) ,
183
184
message_destinations : BTreeSet :: new ( ) ,
184
- expecting_messages_from : BTreeSet :: from ( [ ids[ 0 ] , ids[ 1 ] ] ) ,
185
+ expecting_messages_from : IdSet :: new_non_threshold ( [ ids[ 0 ] , ids[ 1 ] ] . into ( ) ) ,
185
186
echo_round_participation : EchoRoundParticipation :: Receive {
186
187
echo_targets : BTreeSet :: from ( [ ids[ 1 ] , ids[ 3 ] ] ) ,
187
188
} ,
@@ -192,7 +193,7 @@ fn partial_echo() {
192
193
Inputs {
193
194
id : signers[ 3 ] . verifying_key ( ) ,
194
195
message_destinations : BTreeSet :: new ( ) ,
195
- expecting_messages_from : BTreeSet :: from ( [ ids[ 0 ] , ids[ 1 ] ] ) ,
196
+ expecting_messages_from : IdSet :: new_non_threshold ( [ ids[ 0 ] , ids[ 1 ] ] . into ( ) ) ,
196
197
echo_round_participation : EchoRoundParticipation :: Receive {
197
198
echo_targets : BTreeSet :: from ( [ ids[ 1 ] , ids[ 2 ] ] ) ,
198
199
} ,
@@ -203,7 +204,7 @@ fn partial_echo() {
203
204
Inputs {
204
205
id : signers[ 4 ] . verifying_key ( ) ,
205
206
message_destinations : BTreeSet :: new ( ) ,
206
- expecting_messages_from : BTreeSet :: new ( ) ,
207
+ expecting_messages_from : IdSet :: empty ( ) ,
207
208
echo_round_participation : EchoRoundParticipation :: < TestVerifier > :: Default ,
208
209
} ,
209
210
) ;
0 commit comments