@@ -50,7 +50,11 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
5050 "operatorId" , hex .EncodeToString (signedTaskResponse .OperatorId [:]))
5151 taskIndex := uint32 (0 )
5252
53- taskIndex , err := agg .GetTaskIndex (signedTaskResponse .BatchIdentifierHash )
53+ // The Aggregator may receive the Task Identifier after the operators.
54+ // If that's the case, we won't know about the task at this point
55+ // so we make GetTaskIndex retryable, waiting for some seconds,
56+ // before trying to fetch the task again from the map.
57+ taskIndex , err := agg .GetTaskIndexRetryable (signedTaskResponse .BatchIdentifierHash )
5458
5559 if err != nil {
5660 agg .logger .Warn ("Task not found in the internal map, operator signature will be lost. Batch may not reach quorum" )
@@ -106,7 +110,14 @@ func (agg *Aggregator) ServerRunning(_ *struct{}, reply *int64) error {
106110 return nil
107111}
108112
109- func (agg * Aggregator ) GetTaskIndex (batchIdentifierHash [32 ]byte ) (uint32 , error ) {
113+ /*
114+ Checks Internal mapping for Signed Task Response, returns its TaskIndex.
115+ - All errors are considered Transient Errors
116+ - Retry times (3 retries): 1 sec, 2 sec, 4 sec
117+
118+ TODO: We should refactor the retry duration considering extending it to a larger time or number of retries, at least somewhere between 1 and 2 blocks
119+ */
120+ func (agg * Aggregator ) GetTaskIndexRetryable (batchIdentifierHash [32 ]byte ) (uint32 , error ) {
110121 getTaskIndex_func := func () (uint32 , error ) {
111122 agg .taskMutex .Lock ()
112123 taskIndex , ok := agg .batchesIdxByIdentifierHash [batchIdentifierHash ]
0 commit comments