@@ -5,14 +5,12 @@ import (
55 "encoding/hex"
66 "fmt"
77 "math/big"
8- "strings"
98 "sync"
109 "time"
1110
1211 gethtypes "github.com/ethereum/go-ethereum/core/types"
1312
1413 "github.com/prometheus/client_golang/prometheus"
15- retry "github.com/yetanotherco/aligned_layer/core"
1614 "github.com/yetanotherco/aligned_layer/metrics"
1715
1816 sdkclients "github.com/Layr-Labs/eigensdk-go/chainio/clients"
@@ -396,7 +394,7 @@ func (agg *Aggregator) AddNewTask(batchMerkleRoot [32]byte, senderAddress [20]by
396394 quorumNums := eigentypes.QuorumNums {eigentypes .QuorumNum (QUORUM_NUMBER )}
397395 quorumThresholdPercentages := eigentypes.QuorumThresholdPercentages {eigentypes .QuorumThresholdPercentage (QUORUM_THRESHOLD )}
398396
399- err := agg .InitializeNewTaskRetryable (batchIndex , taskCreatedBlock , quorumNums , quorumThresholdPercentages , agg .AggregatorConfig .Aggregator .BlsServiceTaskTimeout )
397+ err := agg .blsAggregationService . InitializeNewTask (batchIndex , taskCreatedBlock , quorumNums , quorumThresholdPercentages , agg .AggregatorConfig .Aggregator .BlsServiceTaskTimeout )
400398 if err != nil {
401399 agg .logger .Fatalf ("BLS aggregation service error when initializing new task: %s" , err )
402400 }
@@ -409,34 +407,6 @@ func (agg *Aggregator) AddNewTask(batchMerkleRoot [32]byte, senderAddress [20]by
409407
410408// |---RETRYABLE---|
411409
412- func InitializeNewTaskFunc (agg * Aggregator , batchIndex uint32 , taskCreatedBlock uint32 , quorumNums eigentypes.QuorumNums , quorumThresholdPercentages eigentypes.QuorumThresholdPercentages , timeToExpiry time.Duration ) func () error {
413- initializeNewTask_func := func () error {
414- err := agg .blsAggregationService .InitializeNewTask (batchIndex , taskCreatedBlock , quorumNums , quorumThresholdPercentages , timeToExpiry )
415- if err != nil {
416- // Task is already initialized
417- if strings .Contains (err .Error (), "already initialized" ) {
418- err = retry.PermanentError {Inner : err }
419- }
420- }
421- return err
422- }
423- return initializeNewTask_func
424- }
425-
426- /*
427- InitializeNewTask
428- Initialize a new task in the BLS Aggregation service
429- - Errors:
430- Permanent:
431- - TaskAlreadyInitializedError (Permanent): Task is already intialized in the BLS Aggregation service (https://github.com/Layr-Labs/eigensdk-go/blob/dev/services/bls_aggregation/blsagg.go#L27).
432- Transient:
433- - All others.
434- - Retry times (3 retries): 1 sec, 2 sec, 4 sec
435- */
436- func (agg * Aggregator ) InitializeNewTaskRetryable (batchIndex uint32 , taskCreatedBlock uint32 , quorumNums eigentypes.QuorumNums , quorumThresholdPercentages eigentypes.QuorumThresholdPercentages , timeToExpiry time.Duration ) error {
437- return retry .Retry (InitializeNewTaskFunc (agg , batchIndex , taskCreatedBlock , quorumNums , quorumThresholdPercentages , timeToExpiry ), retry .EthCallRetryConfig ())
438- }
439-
440410// Long-lived goroutine that periodically checks and removes old Tasks from stored Maps
441411// It runs every GarbageCollectorPeriod and removes all tasks older than GarbageCollectorTasksAge
442412// This was added because each task occupies memory in the maps, and we need to free it to avoid a memory leak
0 commit comments