@@ -3,6 +3,7 @@ package pkg
33import (
44 "context"
55 "encoding/hex"
6+ "errors"
67 "fmt"
78 "net/http"
89 "net/rpc"
@@ -48,6 +49,17 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
4849 "SenderAddress" , "0x" + hex .EncodeToString (signedTaskResponse .SenderAddress [:]),
4950 "BatchIdentifierHash" , "0x" + hex .EncodeToString (signedTaskResponse .BatchIdentifierHash [:]),
5051 "operatorId" , hex .EncodeToString (signedTaskResponse .OperatorId [:]))
52+
53+ if signedTaskResponse .BlsSignature .G1Point == nil {
54+ agg .logger .Warn ("invalid operator response with nil signature" ,
55+ "BatchMerkleRoot" , "0x" + hex .EncodeToString (signedTaskResponse .BatchMerkleRoot [:]),
56+ "SenderAddress" , "0x" + hex .EncodeToString (signedTaskResponse .SenderAddress [:]),
57+ "BatchIdentifierHash" , "0x" + hex .EncodeToString (signedTaskResponse .BatchIdentifierHash [:]),
58+ "operatorId" , hex .EncodeToString (signedTaskResponse .OperatorId [:]))
59+ * reply = 1
60+ return errors .New ("invalid response: nil signature" )
61+ }
62+
5163 taskIndex := uint32 (0 )
5264
5365 // The Aggregator may receive the Task Identifier after the operators.
@@ -69,7 +81,7 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
6981 defer cancel () // Ensure the cancel function is called to release resources
7082
7183 // Create a channel to signal when the task is done
72- done := make (chan struct {} )
84+ done := make (chan uint8 )
7385
7486 agg .logger .Info ("Starting bls signature process" )
7587 go func () {
@@ -80,9 +92,11 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
8092
8193 if err != nil {
8294 agg .logger .Warnf ("BLS aggregation service error: %s" , err )
95+ done <- 1
8396 // todo shouldn't we here close the channel with a reply = 1?
8497 } else {
8598 agg .logger .Info ("BLS process succeeded" )
99+ done <- 0
86100 }
87101
88102 close (done )
@@ -94,10 +108,10 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
94108 case <- ctx .Done ():
95109 // The context's deadline was exceeded or it was canceled
96110 agg .logger .Info ("Bls process timed out, operator signature will be lost. Batch may not reach quorum" )
97- case <- done :
111+ case res := <- done :
98112 // The task completed successfully
99- agg .logger .Info ("Bls context finished correctly " )
100- * reply = 0
113+ agg .logger .Info ("Bls context finished on time " )
114+ * reply = res
101115 }
102116
103117 return nil
0 commit comments