Skip to content

Commit

Permalink
hotfix: resolve ambiguity in signature result
Browse files Browse the repository at this point in the history
`ProcessOperatorSignedTaskResponseV2` would set `*reply` to `0` in all
non-timeout scenarios, regardless of errors. Use the `done` channel to
report actual result and use that instead.
  • Loading branch information
Oppen committed Jan 20, 2025
1 parent c0422f5 commit e6eeeb8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions aggregator/pkg/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
defer cancel() // Ensure the cancel function is called to release resources

// Create a channel to signal when the task is done
done := make(chan struct{})
done := make(chan uint8)

agg.logger.Info("Starting bls signature process")
go func() {
Expand All @@ -80,9 +80,11 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t

if err != nil {
agg.logger.Warnf("BLS aggregation service error: %s", err)
done<- 1
// todo shouldn't we here close the channel with a reply = 1?
} else {
agg.logger.Info("BLS process succeeded")
done<- 0
}

close(done)
Expand All @@ -94,10 +96,10 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
case <-ctx.Done():
// The context's deadline was exceeded or it was canceled
agg.logger.Info("Bls process timed out, operator signature will be lost. Batch may not reach quorum")
case <-done:
case res := <-done:
// The task completed successfully
agg.logger.Info("Bls context finished correctly")
*reply = 0
agg.logger.Info("Bls context finished on time")
*reply = res
}

return nil
Expand Down

0 comments on commit e6eeeb8

Please sign in to comment.