Skip to content

Commit 6bfbddd

Browse files
fix(retries): rm retry from InitializeNewTask (#1462)
Co-authored-by: MauroFab <[email protected]>
1 parent e9091c9 commit 6bfbddd

File tree

2 files changed

+1
-72
lines changed

2 files changed

+1
-72
lines changed

aggregator/pkg/aggregator.go

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -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,30 +407,6 @@ func (agg *Aggregator) AddNewTask(batchMerkleRoot [32]byte, senderAddress [20]by
409407

410408
// |---RETRYABLE---|
411409

412-
/*
413-
InitializeNewTaskRetryable
414-
Initialize a new task in the BLS Aggregation service
415-
- Errors:
416-
Permanent:
417-
- 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).
418-
Transient:
419-
- All others.
420-
- Retry times (3 retries): 1 sec, 2 sec, 4 sec
421-
*/
422-
func (agg *Aggregator) InitializeNewTaskRetryable(batchIndex uint32, taskCreatedBlock uint32, quorumNums eigentypes.QuorumNums, quorumThresholdPercentages eigentypes.QuorumThresholdPercentages, timeToExpiry time.Duration) error {
423-
initializeNewTask_func := func() error {
424-
err := agg.blsAggregationService.InitializeNewTask(batchIndex, taskCreatedBlock, quorumNums, quorumThresholdPercentages, timeToExpiry)
425-
if err != nil {
426-
// Task is already initialized
427-
if strings.Contains(err.Error(), "already initialized") {
428-
err = retry.PermanentError{Inner: err}
429-
}
430-
}
431-
return err
432-
}
433-
return retry.Retry(initializeNewTask_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
434-
}
435-
436410
// Long-lived goroutine that periodically checks and removes old Tasks from stored Maps
437411
// It runs every GarbageCollectorPeriod and removes all tasks older than GarbageCollectorTasksAge
438412
// This was added because each task occupies memory in the maps, and we need to free it to avoid a memory leak

core/retry_test.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -197,51 +197,6 @@ func TestWaitForTransactionReceipt(t *testing.T) {
197197
// NOTE: The following tests involving starting the aggregator panic after the connection to anvil is cut crashing the test runner.
198198
// The originates within the eigen-sdk and as of 8/11/24 is currently working to be fixed.
199199

200-
/*
201-
func TestInitializeNewTask(t *testing.T) {
202-
203-
_, _, err := SetupAnvil(8545)
204-
if err != nil {
205-
t.Errorf("Error setting up Anvil: %s\n", err)
206-
}
207-
208-
aggregatorConfig := config.NewAggregatorConfig("../config-files/config-aggregator-test.yaml")
209-
agg, err := aggregator.NewAggregator(*aggregatorConfig)
210-
if err != nil {
211-
aggregatorConfig.BaseConfig.Logger.Error("Cannot create aggregator", "err", err)
212-
return
213-
}
214-
quorumNums := eigentypes.QuorumNums{eigentypes.QuorumNum(byte(0))}
215-
quorumThresholdPercentages := eigentypes.QuorumThresholdPercentages{eigentypes.QuorumThresholdPercentage(byte(57))}
216-
217-
err = agg.InitializeNewTask(0, 1, quorumNums, quorumThresholdPercentages, 1*time.Second)
218-
assert.Nil(t, err)
219-
220-
if err := cmd.Process.Kill(); err != nil {
221-
t.Errorf("error killing process: %v\n", err)
222-
return
223-
}
224-
225-
err = agg.InitializeNewTask(0, 1, quorumNums, quorumThresholdPercentages, 1*time.Second)
226-
assert.NotNil(t, err)
227-
t.Errorf("Error setting Avs Subscriber: %s\n", err)
228-
229-
_, _, err = SetupAnvil(8545)
230-
if err != nil {
231-
t.Errorf("Error setting up Anvil: %s\n", err)
232-
}
233-
234-
err = agg.InitializeNewTask(0, 1, quorumNums, quorumThresholdPercentages, 1*time.Second)
235-
assert.Nil(t, err)
236-
t.Errorf("Error setting Avs Subscriber: %s\n", err)
237-
238-
if err := cmd.Process.Kill(); err != nil {
239-
t.Errorf("error killing process: %v\n", err)
240-
return
241-
}
242-
}
243-
*/
244-
245200
/*
246201
func TestGetTaskIndex(t *testing.T) {
247202

0 commit comments

Comments
 (0)