Skip to content

Commit ae215ea

Browse files
committed
separate retryable logic from functions
1 parent b938b01 commit ae215ea

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

core/chainio/retryable.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ func (w *AvsWriter) RespondToTaskV2Retryable(opts *bind.TransactOpts, batchMerkl
3737
}
3838

3939
/*
40-
BatchesStateRetryable
41-
Get the state of a batch from the AVS contract.
40+
RespondToTaskV2Retryable
41+
Send a transaction to the AVS contract to respond to a task.
4242
- All errors are considered Transient Errors
43-
- Retry times (3 retries): 1 sec, 2 sec, 4 sec
43+
- Retry times (3 retries): 12 sec (1 Blocks), 24 sec (2 Blocks), 48 sec (4 Blocks)
44+
- NOTE: Contract call reverts are not considered `PermanentError`'s as block reorg's may lead to contract call revert in which case the aggregator should retry.
4445
*/
4546
func (w *AvsWriter) BatchesStateRetryable(opts *bind.CallOpts, arg0 [32]byte, config *retry.RetryParams) (struct {
4647
TaskCreatedBlock uint32
4748
Responded bool
4849
RespondToTaskFeeLimit *big.Int
4950
}, error) {
50-
5151
batchesState_func := func() (struct {
5252
TaskCreatedBlock uint32
5353
Responded bool
@@ -65,8 +65,8 @@ func (w *AvsWriter) BatchesStateRetryable(opts *bind.CallOpts, arg0 [32]byte, co
6565
}
6666

6767
/*
68-
BatcherBalancesRetryable
69-
Get the balance of a batcher from the AVS contract.
68+
BatchesStateRetryable
69+
Get the state of a batch from the AVS contract.
7070
- All errors are considered Transient Errors
7171
- Retry times (3 retries): 1 sec, 2 sec, 4 sec
7272
*/
@@ -205,8 +205,17 @@ func SubscribeToNewTasksV2Retryable(
205205
batchMerkleRoot [][32]byte,
206206
config *retry.RetryParams,
207207
) (event.Subscription, error) {
208+
return retry.RetryWithData(SubscribeToNewTasksV2(opts, serviceManager, newTaskCreatedChan, batchMerkleRoot), retry.DefaultRetryConfig())
209+
}
210+
211+
func SubscribeToNewTasksV3(
212+
opts *bind.WatchOpts,
213+
serviceManager *servicemanager.ContractAlignedLayerServiceManager,
214+
newTaskCreatedChan chan *servicemanager.ContractAlignedLayerServiceManagerNewBatchV3,
215+
batchMerkleRoot [][32]byte,
216+
) func() (event.Subscription, error) {
208217
subscribe_func := func() (event.Subscription, error) {
209-
return serviceManager.WatchNewBatchV2(opts, newTaskCreatedChan, batchMerkleRoot)
218+
return serviceManager.WatchNewBatchV3(opts, newTaskCreatedChan, batchMerkleRoot)
210219
}
211220
return retry.RetryWithData(subscribe_func, config)
212221
}

0 commit comments

Comments
 (0)