@@ -6,7 +6,7 @@ use mosaic_cac_types::{
66 ChallengeResponseMsgChunk , ChallengeResponseMsgHeader , CommitMsgChunk , CommitMsgHeader ,
77 CompletedSignatures , DepositAdaptors , DepositId , GarblingTableCommitment , HeapArray , Index ,
88 OpenedGarblingTableCommitments , PubKey , ReservedSetupInputShares , Seed , SetupInputs ,
9- TableTransferReceiptMsg , TableTransferRequestMsg , WideLabelWirePolynomialCommitments ,
9+ TableTransferReceiptMsg , WideLabelWirePolynomialCommitments ,
1010 WideLabelZerothPolynomialCoefficients , WithdrawalAdaptors , WithdrawalAdaptorsChunk ,
1111 WithdrawalInputs , state_machine:: evaluator:: * ,
1212} ;
@@ -582,7 +582,7 @@ async fn handle_commit_msg_header<S: StateMut>(
582582 match & mut state. step {
583583 Step :: WaitingForCommit { header, chunks, .. } => {
584584 if * header {
585- warn ! ( "evaluator received duplicate commit header, ack and ignore" ) ;
585+ debug ! ( "evaluator received duplicate commit header, ack and ignore" ) ;
586586 return Ok ( ( ) ) ;
587587 }
588588
@@ -637,7 +637,7 @@ async fn handle_commit_msg_header<S: StateMut>(
637637 post_handle_commit_msg ( state, artifact_store, actions) . await
638638 }
639639 step if step. phase ( ) > StepPhase :: WaitingForCommit => {
640- warn ! ( "evaluator received commit header after completion, ack and ignore" ) ;
640+ debug ! ( "evaluator received commit header after completion, ack and ignore" ) ;
641641 Ok ( ( ) )
642642 }
643643 _ => Err ( SMError :: UnexpectedInput ) ,
@@ -659,7 +659,7 @@ async fn handle_commit_msg_chunk<S: StateMut>(
659659 }
660660 Some ( true ) => {
661661 // already seen chunk
662- warn ! ( %chunk_idx, "evaluator received duplicate commit chunk, ack and ignore" ) ;
662+ debug ! ( %chunk_idx, "evaluator received duplicate commit chunk, ack and ignore" ) ;
663663 return Ok ( ( ) ) ;
664664 }
665665 None => {
@@ -699,7 +699,7 @@ async fn handle_commit_msg_chunk<S: StateMut>(
699699 post_handle_commit_msg ( root_state, state, actions) . await
700700 }
701701 step if step. phase ( ) > StepPhase :: WaitingForCommit => {
702- warn ! ( "evaluator received commit chunk after completion, ack and ignore" ) ;
702+ debug ! ( "evaluator received commit chunk after completion, ack and ignore" ) ;
703703 Ok ( ( ) )
704704 }
705705 _ => Err ( SMError :: UnexpectedInput ) ,
@@ -744,7 +744,7 @@ async fn handle_recv_challenge_response_header<S: StateMut>(
744744 remaining_chunks,
745745 } => {
746746 if * header {
747- warn ! ( "evaluator received duplicate challenge response header, ack and ignore" ) ;
747+ debug ! ( "evaluator received duplicate challenge response header, ack and ignore" ) ;
748748 return Ok ( ( ) ) ;
749749 }
750750
@@ -789,7 +789,7 @@ async fn handle_recv_challenge_response_header<S: StateMut>(
789789 post_handle_challenge_response ( root_state, state, actions) . await
790790 }
791791 step if step. phase ( ) > StepPhase :: WaitingForChallengeResponse => {
792- warn ! ( "evaluator received challenge response header after completion, ack and ignore" ) ;
792+ debug ! ( "evaluator received challenge response header after completion, ack and ignore" ) ;
793793 Ok ( ( ) )
794794 }
795795 _ => Err ( SMError :: UnexpectedInput ) ,
@@ -807,6 +807,18 @@ async fn handle_recv_challenge_response_msg<S: StateMut>(
807807 header,
808808 remaining_chunks,
809809 } => {
810+ let challenge_idxs = state
811+ . get_challenge_indices ( )
812+ . await
813+ . require ( "expected challenge indices" ) ?;
814+
815+ if !challenge_idxs
816+ . iter ( )
817+ . any ( |idx| idx. get ( ) == response_msg_chunk. circuit_index as usize )
818+ {
819+ return Err ( SMError :: InvalidInputData ) ;
820+ }
821+
810822 let chunk_idx = ( response_msg_chunk. circuit_index as usize )
811823 . checked_sub ( 1 )
812824 . unwrap ( ) ;
@@ -815,8 +827,11 @@ async fn handle_recv_challenge_response_msg<S: StateMut>(
815827 // expected chunk
816828 }
817829 Some ( false ) => {
818- // already seen chunk
819- warn ! ( %chunk_idx, "evaluator received duplicate commit chunk, ack and ignore" ) ;
830+ // already seen expected chunk
831+ debug ! (
832+ %chunk_idx,
833+ "evaluator received duplicate challenge response chunk, ack and ignore"
834+ ) ;
820835 return Ok ( ( ) ) ;
821836 }
822837 None => {
@@ -847,7 +862,7 @@ async fn handle_recv_challenge_response_msg<S: StateMut>(
847862 post_handle_challenge_response ( root_state, state, actions) . await
848863 }
849864 step if step. phase ( ) > StepPhase :: WaitingForChallengeResponse => {
850- warn ! ( "evaluator received challenge response chunk after completion, ack and ignore" ) ;
865+ debug ! ( "evaluator received challenge response chunk after completion, ack and ignore" ) ;
851866 Ok ( ( ) )
852867 }
853868 _ => Err ( SMError :: UnexpectedInput ) ,
0 commit comments