Skip to content

Commit 3ae2fc0

Browse files
committed
pass in config file
1 parent 4f2daf2 commit 3ae2fc0

File tree

6 files changed

+26
-21
lines changed

6 files changed

+26
-21
lines changed

aggregator/pkg/aggregator.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ func (agg *Aggregator) AddNewTask(batchMerkleRoot [32]byte, senderAddress [20]by
392392

393393
// |---RETRYABLE---|
394394

395+
// TODO: Add Retryable Label
395396
/*
396397
InitializeNewTask
397398
Initialize a new task in the BLS Aggregation service
@@ -413,7 +414,7 @@ func (agg *Aggregator) InitializeNewTask(batchIndex uint32, taskCreatedBlock uin
413414
}
414415
return err
415416
}
416-
return retry.Retry(initializeNewTask_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
417+
return retry.Retry(initializeNewTask_func, retry.DefaultRetryConfig())
417418
}
418419

419420
// Long-lived goroutine that periodically checks and removes old Tasks from stored Maps

aggregator/pkg/server.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
5353
"operatorId", hex.EncodeToString(signedTaskResponse.OperatorId[:]))
5454
taskIndex := uint32(0)
5555

56+
// TODO: Add Retryable
5657
taskIndex, err := agg.GetTaskIndex(signedTaskResponse.BatchIdentifierHash)
5758

5859
if err != nil {
@@ -114,6 +115,7 @@ func (agg *Aggregator) ServerRunning(_ *struct{}, reply *int64) error {
114115

115116
// |---RETRYABLE---|
116117

118+
// TODO: Add Retryable
117119
/*
118120
- Errors:
119121
Permanent:
@@ -137,9 +139,10 @@ func (agg *Aggregator) ProcessNewSignature(ctx context.Context, taskIndex uint32
137139
return err
138140
}
139141

140-
return retry.Retry(processNewSignature_func, retry.MinDelayChain, retry.RetryFactor, retry.NumRetries, retry.MaxIntervalChain, retry.MaxElapsedTime)
142+
return retry.Retry(processNewSignature_func, retry.ChainRetryConfig())
141143
}
142144

145+
// TODO: Add Retryable + Comment
143146
func (agg *Aggregator) GetTaskIndex(batchIdentifierHash [32]byte) (uint32, error) {
144147
getTaskIndex_func := func() (uint32, error) {
145148
agg.taskMutex.Lock()
@@ -153,6 +156,5 @@ func (agg *Aggregator) GetTaskIndex(batchIdentifierHash [32]byte) (uint32, error
153156
return taskIndex, nil
154157
}
155158
}
156-
157-
return retry.RetryWithData(getTaskIndex_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
159+
return retry.RetryWithData(getTaskIndex_func, retry.DefaultRetryConfig())
158160
}

core/chainio/avs_subscriber.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ func (s *AvsSubscriber) SubscribeToNewTasksV2(newTaskCreatedChan chan *servicema
6868
// Subscribe to new tasks
6969
sub, err := SubscribeToNewTasksV2Retryable(&bind.WatchOpts{}, s.AvsContractBindings.ServiceManager, internalChannel, nil)
7070
if err != nil {
71-
s.logger.Error("Primary failed to subscribe to new AlignedLayer V2 tasks after %d retries", retry.NumRetries, "err", err)
71+
//TODO: Confirm these are accurate
72+
s.logger.Error("Primary failed to subscribe to new AlignedLayer V2 tasks after %d retries", retry.DefaultNumRetries, "err", err)
7273
return nil, err
7374
}
7475

7576
subFallback, err := SubscribeToNewTasksV2Retryable(&bind.WatchOpts{}, s.AvsContractBindings.ServiceManagerFallback, internalChannel, nil)
7677
if err != nil {
77-
s.logger.Error("Fallback failed to subscribe to new AlignedLayer V2 tasks after %d retries", retry.NumRetries, "err", err)
78+
//TODO: Confirm these are accurate
79+
s.logger.Error("Fallback failed to subscribe to new AlignedLayer V2 tasks after %d retries", retry.DefaultNumRetries, "err", err)
7880
return nil, err
7981
}
8082
s.logger.Info("Subscribed to new AlignedLayer V2 tasks")

core/chainio/avs_writer.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
153153
return nil, fmt.Errorf("transaction failed")
154154
}
155155

156-
//return retry.RetryWithData(respondToTaskV2Func, retry.MinDelay, retry.RetryFactor, 0, retry.MaxInterval, 0)
157156
return retry.RetryWithData(respondToTaskV2Func, respondToTaskV2Config)
158157
}
159158

core/chainio/retryable.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ func (w *AvsWriter) RespondToTaskV2Retryable(opts *bind.TransactOpts, batchMerkl
3232
}
3333
return tx, err
3434
}
35-
return retry.RetryWithData(respondToTaskV2_func, retry.MinDelayChain, retry.RetryFactor, retry.NumRetries, retry.MaxIntervalChain, retry.MaxElapsedTime)
35+
//return retry.RetryWithData(respondToTaskV2_func, retry.MinDelayChain, retry.RetryFactor, retry.NumRetries, retry.MaxIntervalChain, retry.MaxElapsedTime)
36+
return retry.RetryWithData(respondToTaskV2_func, retry.DefaultRetryConfig())
3637
}
3738

3839
/*
@@ -60,7 +61,7 @@ func (w *AvsWriter) BatchesStateRetryable(opts *bind.CallOpts, arg0 [32]byte) (s
6061
}
6162
return state, err
6263
}
63-
return retry.RetryWithData(batchesState_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
64+
return retry.RetryWithData(batchesState_func, retry.DefaultRetryConfig())
6465
}
6566

6667
/*
@@ -79,7 +80,7 @@ func (w *AvsWriter) BatcherBalancesRetryable(opts *bind.CallOpts, senderAddress
7980
}
8081
return batcherBalance, err
8182
}
82-
return retry.RetryWithData(batcherBalances_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
83+
return retry.RetryWithData(batcherBalances_func, retry.DefaultRetryConfig())
8384
}
8485

8586
/*
@@ -100,7 +101,7 @@ func (w *AvsWriter) BalanceAtRetryable(ctx context.Context, aggregatorAddress co
100101
}
101102
return aggregatorBalance, err
102103
}
103-
return retry.RetryWithData(balanceAt_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
104+
return retry.RetryWithData(balanceAt_func, retry.DefaultRetryConfig())
104105
}
105106

106107
// |---AVS_SUBSCRIBER---|
@@ -121,7 +122,7 @@ func (s *AvsSubscriber) BlockNumberRetryable(ctx context.Context) (uint64, error
121122
}
122123
return latestBlock, err
123124
}
124-
return retry.RetryWithData(latestBlock_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
125+
return retry.RetryWithData(latestBlock_func, retry.DefaultRetryConfig())
125126
}
126127

127128
/*
@@ -134,7 +135,7 @@ func (s *AvsSubscriber) FilterBatchV2Retryable(opts *bind.FilterOpts, batchMerkl
134135
filterNewBatchV2_func := func() (*servicemanager.ContractAlignedLayerServiceManagerNewBatchV2Iterator, error) {
135136
return s.AvsContractBindings.ServiceManager.FilterNewBatchV2(opts, batchMerkleRoot)
136137
}
137-
return retry.RetryWithData(filterNewBatchV2_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
138+
return retry.RetryWithData(filterNewBatchV2_func, retry.DefaultRetryConfig())
138139
}
139140

140141
/*
@@ -147,7 +148,7 @@ func (s *AvsSubscriber) FilterBatchV3Retryable(opts *bind.FilterOpts, batchMerkl
147148
filterNewBatchV2_func := func() (*servicemanager.ContractAlignedLayerServiceManagerNewBatchV3Iterator, error) {
148149
return s.AvsContractBindings.ServiceManager.FilterNewBatchV3(opts, batchMerkleRoot)
149150
}
150-
return retry.RetryWithData(filterNewBatchV2_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
151+
return retry.RetryWithData(filterNewBatchV2_func, retry.DefaultRetryConfig())
151152
}
152153

153154
/*
@@ -169,7 +170,7 @@ func (s *AvsSubscriber) BatchesStateRetryable(opts *bind.CallOpts, arg0 [32]byte
169170
return s.AvsContractBindings.ServiceManager.ContractAlignedLayerServiceManagerCaller.BatchesState(opts, arg0)
170171
}
171172

172-
return retry.RetryWithData(batchState_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
173+
return retry.RetryWithData(batchState_func, retry.DefaultRetryConfig())
173174
}
174175

175176
/*
@@ -188,7 +189,7 @@ func (s *AvsSubscriber) SubscribeNewHeadRetryable(ctx context.Context, c chan<-
188189
}
189190
return sub, err
190191
}
191-
return retry.RetryWithData(subscribeNewHead_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
192+
return retry.RetryWithData(subscribeNewHead_func, retry.DefaultRetryConfig())
192193
}
193194

194195
/*
@@ -206,7 +207,7 @@ func SubscribeToNewTasksV2Retryable(
206207
subscribe_func := func() (event.Subscription, error) {
207208
return serviceManager.WatchNewBatchV2(opts, newTaskCreatedChan, batchMerkleRoot)
208209
}
209-
return retry.RetryWithData(subscribe_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
210+
return retry.RetryWithData(subscribe_func, retry.DefaultRetryConfig())
210211
}
211212

212213
/*
@@ -224,5 +225,5 @@ func SubscribeToNewTasksV3Retryable(
224225
subscribe_func := func() (event.Subscription, error) {
225226
return serviceManager.WatchNewBatchV3(opts, newTaskCreatedChan, batchMerkleRoot)
226227
}
227-
return retry.RetryWithData(subscribe_func, retry.MinDelay, retry.RetryFactor, retry.NumRetries, retry.MaxInterval, retry.MaxElapsedTime)
228+
return retry.RetryWithData(subscribe_func, retry.DefaultRetryConfig())
228229
}

core/retry_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func TestWaitForTransactionReceipt(t *testing.T) {
170170
}
171171

172172
// Assert Call succeeds when Anvil running
173-
_, err = utils.WaitForTransactionReceiptRetryable(*client, *client, hash, time.Second*45)
173+
_, err = utils.WaitForTransactionReceiptRetryable(*client, *client, hash, retry.DefaultRetryConfig())
174174
assert.NotNil(t, err, "Error Waiting for Transaction with Anvil Running: %s\n", err)
175175
if !strings.Contains(err.Error(), "not found") {
176176
t.Errorf("WaitForTransactionReceipt Emitted incorrect error: %s\n", err)
@@ -182,7 +182,7 @@ func TestWaitForTransactionReceipt(t *testing.T) {
182182
return
183183
}
184184

185-
_, err = utils.WaitForTransactionReceiptRetryable(*client, *client, hash, time.Second*45)
185+
_, err = utils.WaitForTransactionReceiptRetryable(*client, *client, hash, retry.DefaultRetryConfig())
186186
assert.NotNil(t, err)
187187
if _, ok := err.(retry.PermanentError); ok {
188188
t.Errorf("WaitForTransactionReceipt Emitted non Transient error: %s\n", err)
@@ -198,7 +198,7 @@ func TestWaitForTransactionReceipt(t *testing.T) {
198198
t.Errorf("Error setting up Anvil: %s\n", err)
199199
}
200200

201-
_, err = utils.WaitForTransactionReceiptRetryable(*client, *client, hash, time.Second*45)
201+
_, err = utils.WaitForTransactionReceiptRetryable(*client, *client, hash, retry.DefaultRetryConfig())
202202
assert.NotNil(t, err)
203203
if !strings.Contains(err.Error(), "not found") {
204204
t.Errorf("WaitForTransactionReceipt Emitted incorrect error: %s\n", err)

0 commit comments

Comments
 (0)