@@ -15,14 +15,7 @@ import (
1515
1616// |---AVS_WRITER---|
1717
18- /*
19- RespondToTaskV2Retryable
20- Send a transaction to the AVS contract to respond to a task.
21- - All errors are considered Transient Errors
22- - Retry times (3 retries): 12 sec (1 Blocks), 24 sec (2 Blocks), 48 sec (4 Blocks)
23- - 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.
24- */
25- func (w * AvsWriter ) RespondToTaskV2Retryable (opts * bind.TransactOpts , batchMerkleRoot [32 ]byte , senderAddress common.Address , nonSignerStakesAndSignature servicemanager.IBLSSignatureCheckerNonSignerStakesAndSignature ) (* types.Transaction , error ) {
18+ func RespondToTaskV2 (w * AvsWriter , opts * bind.TransactOpts , batchMerkleRoot [32 ]byte , senderAddress common.Address , nonSignerStakesAndSignature servicemanager.IBLSSignatureCheckerNonSignerStakesAndSignature ) func () (* types.Transaction , error ) {
2619 respondToTaskV2_func := func () (* types.Transaction , error ) {
2720 // Try with main connection
2821 tx , err := w .AvsContractBindings .ServiceManager .RespondToTaskV2 (opts , batchMerkleRoot , senderAddress , nonSignerStakesAndSignature )
@@ -32,21 +25,25 @@ func (w *AvsWriter) RespondToTaskV2Retryable(opts *bind.TransactOpts, batchMerkl
3225 }
3326 return tx , err
3427 }
35- return retry . RetryWithData ( respondToTaskV2_func , retry . ChainRetryConfig ())
28+ return respondToTaskV2_func
3629}
3730
3831/*
39- BatchesStateRetryable
40- Get the state of a batch from the AVS contract.
32+ RespondToTaskV2Retryable
33+ Send a transaction to the AVS contract to respond to a task .
4134- All errors are considered Transient Errors
42- - Retry times (3 retries): 1 sec, 2 sec, 4 sec
35+ - Retry times (3 retries): 12 sec (1 Blocks), 24 sec (2 Blocks), 48 sec (4 Blocks)
36+ - 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.
4337*/
44- func (w * AvsWriter ) BatchesStateRetryable (opts * bind.CallOpts , arg0 [32 ]byte ) (struct {
38+ func (w * AvsWriter ) RespondToTaskV2Retryable (opts * bind.TransactOpts , batchMerkleRoot [32 ]byte , senderAddress common.Address , nonSignerStakesAndSignature servicemanager.IBLSSignatureCheckerNonSignerStakesAndSignature ) (* types.Transaction , error ) {
39+ return retry .RetryWithData (RespondToTaskV2 (w , opts , batchMerkleRoot , senderAddress , nonSignerStakesAndSignature ), retry .ChainRetryConfig ())
40+ }
41+
42+ func BatchesState (w * AvsWriter , opts * bind.CallOpts , arg0 [32 ]byte ) func () (struct {
4543 TaskCreatedBlock uint32
4644 Responded bool
4745 RespondToTaskFeeLimit * big.Int
4846}, error ) {
49-
5047 batchesState_func := func () (struct {
5148 TaskCreatedBlock uint32
5249 Responded bool
@@ -60,16 +57,24 @@ func (w *AvsWriter) BatchesStateRetryable(opts *bind.CallOpts, arg0 [32]byte) (s
6057 }
6158 return state , err
6259 }
63- return retry . RetryWithData ( batchesState_func , retry . DefaultRetryConfig ())
60+ return batchesState_func
6461}
6562
6663/*
67- BatcherBalancesRetryable
68- Get the balance of a batcher from the AVS contract.
64+ BatchesStateRetryable
65+ Get the state of a batch from the AVS contract.
6966- All errors are considered Transient Errors
7067- Retry times (3 retries): 1 sec, 2 sec, 4 sec
7168*/
72- func (w * AvsWriter ) BatcherBalancesRetryable (opts * bind.CallOpts , senderAddress common.Address ) (* big.Int , error ) {
69+ func (w * AvsWriter ) BatchesStateRetryable (opts * bind.CallOpts , arg0 [32 ]byte ) (struct {
70+ TaskCreatedBlock uint32
71+ Responded bool
72+ RespondToTaskFeeLimit * big.Int
73+ }, error ) {
74+ return retry .RetryWithData (BatchesState (w , opts , arg0 ), retry .DefaultRetryConfig ())
75+ }
76+
77+ func BatcherBalances (w * AvsWriter , opts * bind.CallOpts , senderAddress common.Address ) func () (* big.Int , error ) {
7378 batcherBalances_func := func () (* big.Int , error ) {
7479 // Try with main connection
7580 batcherBalance , err := w .AvsContractBindings .ServiceManager .BatchersBalances (opts , senderAddress )
@@ -79,18 +84,20 @@ func (w *AvsWriter) BatcherBalancesRetryable(opts *bind.CallOpts, senderAddress
7984 }
8085 return batcherBalance , err
8186 }
82- return retry . RetryWithData ( batcherBalances_func , retry . DefaultRetryConfig ())
87+ return batcherBalances_func
8388}
8489
8590/*
86- BalanceAtRetryable
87- Get the balance of aggregatorAddress at blockNumber.
88- If blockNumber is nil, it gets the latest balance.
89- TODO: it gets the balance from an Address, not necessarily an aggregator. The name of the parameter should be changed.
91+ BatcherBalancesRetryable
92+ Get the balance of a batcher from the AVS contract.
9093- All errors are considered Transient Errors
91- - Retry times (3 retries): 1 sec, 2 sec, 4 sec.
94+ - Retry times (3 retries): 1 sec, 2 sec, 4 sec
9295*/
93- func (w * AvsWriter ) BalanceAtRetryable (ctx context.Context , aggregatorAddress common.Address , blockNumber * big.Int ) (* big.Int , error ) {
96+ func (w * AvsWriter ) BatcherBalancesRetryable (opts * bind.CallOpts , senderAddress common.Address ) (* big.Int , error ) {
97+ return retry .RetryWithData (BatcherBalances (w , opts , senderAddress ), retry .DefaultRetryConfig ())
98+ }
99+
100+ func BalanceAt (w * AvsWriter , ctx context.Context , aggregatorAddress common.Address , blockNumber * big.Int ) func () (* big.Int , error ) {
94101 balanceAt_func := func () (* big.Int , error ) {
95102 // Try with main connection
96103 aggregatorBalance , err := w .Client .BalanceAt (ctx , aggregatorAddress , blockNumber )
@@ -100,18 +107,24 @@ func (w *AvsWriter) BalanceAtRetryable(ctx context.Context, aggregatorAddress co
100107 }
101108 return aggregatorBalance , err
102109 }
103- return retry . RetryWithData ( balanceAt_func , retry . DefaultRetryConfig ())
110+ return balanceAt_func
104111}
105112
106- // |---AVS_SUBSCRIBER---|
107-
108113/*
109- BlockNumberRetryable
110- Get the latest block number from Ethereum
114+ BalanceAtRetryable
115+ Get the balance of aggregatorAddress at blockNumber.
116+ If blockNumber is nil, it gets the latest balance.
117+ TODO: it gets the balance from an Address, not necessarily an aggregator. The name of the parameter should be changed.
111118- All errors are considered Transient Errors
112119- Retry times (3 retries): 1 sec, 2 sec, 4 sec.
113120*/
114- func (s * AvsSubscriber ) BlockNumberRetryable (ctx context.Context ) (uint64 , error ) {
121+ func (w * AvsWriter ) BalanceAtRetryable (ctx context.Context , aggregatorAddress common.Address , blockNumber * big.Int ) (* big.Int , error ) {
122+ return retry .RetryWithData (BalanceAt (w , ctx , aggregatorAddress , blockNumber ), retry .DefaultRetryConfig ())
123+ }
124+
125+ // |---AVS_SUBSCRIBER---|
126+
127+ func BlockNumber (s * AvsSubscriber , ctx context.Context ) func () (uint64 , error ) {
115128 latestBlock_func := func () (uint64 , error ) {
116129 // Try with main connection
117130 latestBlock , err := s .AvsContractBindings .ethClient .BlockNumber (ctx )
@@ -121,42 +134,54 @@ func (s *AvsSubscriber) BlockNumberRetryable(ctx context.Context) (uint64, error
121134 }
122135 return latestBlock , err
123136 }
124- return retry . RetryWithData ( latestBlock_func , retry . DefaultRetryConfig ())
137+ return latestBlock_func
125138}
126139
127140/*
128- FilterBatchV2Retryable
129- Get NewBatchV2 logs from the AVS contract.
141+ BlockNumberRetryable
142+ Get the latest block number from Ethereum
130143- All errors are considered Transient Errors
131144- Retry times (3 retries): 1 sec, 2 sec, 4 sec.
132145*/
133- func (s * AvsSubscriber ) FilterBatchV2Retryable (opts * bind.FilterOpts , batchMerkleRoot [][32 ]byte ) (* servicemanager.ContractAlignedLayerServiceManagerNewBatchV2Iterator , error ) {
146+ func (s * AvsSubscriber ) BlockNumberRetryable (ctx context.Context ) (uint64 , error ) {
147+ return retry .RetryWithData (BlockNumber (s , ctx ), retry .DefaultRetryConfig ())
148+ }
149+
150+ func FilterBatchV2 (s * AvsSubscriber , opts * bind.FilterOpts , batchMerkleRoot [][32 ]byte ) func () (* servicemanager.ContractAlignedLayerServiceManagerNewBatchV2Iterator , error ) {
134151 filterNewBatchV2_func := func () (* servicemanager.ContractAlignedLayerServiceManagerNewBatchV2Iterator , error ) {
135152 return s .AvsContractBindings .ServiceManager .FilterNewBatchV2 (opts , batchMerkleRoot )
136153 }
137- return retry . RetryWithData ( filterNewBatchV2_func , retry . DefaultRetryConfig ())
154+ return filterNewBatchV2_func
138155}
139156
140157/*
141- FilterBatchV3Retryable
142- Get NewBatchV3 logs from the AVS contract.
158+ FilterBatchV2Retryable
159+ Get NewBatchV2 logs from the AVS contract.
143160- All errors are considered Transient Errors
144161- Retry times (3 retries): 1 sec, 2 sec, 4 sec.
145162*/
146- func (s * AvsSubscriber ) FilterBatchV3Retryable (opts * bind.FilterOpts , batchMerkleRoot [][32 ]byte ) (* servicemanager.ContractAlignedLayerServiceManagerNewBatchV3Iterator , error ) {
147- filterNewBatchV2_func := func () (* servicemanager.ContractAlignedLayerServiceManagerNewBatchV3Iterator , error ) {
163+ func (s * AvsSubscriber ) FilterBatchV2Retryable (opts * bind.FilterOpts , batchMerkleRoot [][32 ]byte ) (* servicemanager.ContractAlignedLayerServiceManagerNewBatchV2Iterator , error ) {
164+ return retry .RetryWithData (FilterBatchV2 (s , opts , batchMerkleRoot ), retry .DefaultRetryConfig ())
165+ }
166+
167+ func FilterBatchV3 (s * AvsSubscriber , opts * bind.FilterOpts , batchMerkleRoot [][32 ]byte ) func () (* servicemanager.ContractAlignedLayerServiceManagerNewBatchV3Iterator , error ) {
168+ filterNewBatchV3_func := func () (* servicemanager.ContractAlignedLayerServiceManagerNewBatchV3Iterator , error ) {
148169 return s .AvsContractBindings .ServiceManager .FilterNewBatchV3 (opts , batchMerkleRoot )
149170 }
150- return retry . RetryWithData ( filterNewBatchV2_func , retry . DefaultRetryConfig ())
171+ return filterNewBatchV3_func
151172}
152173
153174/*
154- BatchesStateRetryable
155- Get the state of a batch from the AVS contract.
175+ FilterBatchV3Retryable
176+ Get NewBatchV3 logs from the AVS contract.
156177- All errors are considered Transient Errors
157- - Retry times (3 retries): 1 sec, 2 sec, 4 sec
178+ - Retry times (3 retries): 1 sec, 2 sec, 4 sec.
158179*/
159- func (s * AvsSubscriber ) BatchesStateRetryable (opts * bind.CallOpts , arg0 [32 ]byte ) (struct {
180+ func (s * AvsSubscriber ) FilterBatchV3Retryable (opts * bind.FilterOpts , batchMerkleRoot [][32 ]byte ) (* servicemanager.ContractAlignedLayerServiceManagerNewBatchV3Iterator , error ) {
181+ return retry .RetryWithData (FilterBatchV3 (s , opts , batchMerkleRoot ), retry .DefaultRetryConfig ())
182+ }
183+
184+ func BatchState (s * AvsSubscriber , opts * bind.CallOpts , arg0 [32 ]byte ) func () (struct {
160185 TaskCreatedBlock uint32
161186 Responded bool
162187 RespondToTaskFeeLimit * big.Int
@@ -168,17 +193,25 @@ func (s *AvsSubscriber) BatchesStateRetryable(opts *bind.CallOpts, arg0 [32]byte
168193 }, error ) {
169194 return s .AvsContractBindings .ServiceManager .ContractAlignedLayerServiceManagerCaller .BatchesState (opts , arg0 )
170195 }
171-
172- return retry .RetryWithData (batchState_func , retry .DefaultRetryConfig ())
196+ return batchState_func
173197}
174198
175199/*
176- SubscribeNewHeadRetryable
177- Subscribe to new heads from the Ethereum node .
200+ BatchesStateRetryable
201+ Get the state of a batch from the AVS contract .
178202- All errors are considered Transient Errors
179- - Retry times (3 retries): 1 sec, 2 sec, 4 sec.
203+ - Retry times (3 retries): 1 sec, 2 sec, 4 sec
180204*/
181- func (s * AvsSubscriber ) SubscribeNewHeadRetryable (ctx context.Context , c chan <- * types.Header ) (ethereum.Subscription , error ) {
205+ func (s * AvsSubscriber ) BatchesStateRetryable (opts * bind.CallOpts , arg0 [32 ]byte ) (struct {
206+ TaskCreatedBlock uint32
207+ Responded bool
208+ RespondToTaskFeeLimit * big.Int
209+ }, error ) {
210+
211+ return retry .RetryWithData (BatchState (s , opts , arg0 ), retry .DefaultRetryConfig ())
212+ }
213+
214+ func SubscribeNewHead (s * AvsSubscriber , ctx context.Context , c chan <- * types.Header ) func () (ethereum.Subscription , error ) {
182215 subscribeNewHead_func := func () (ethereum.Subscription , error ) {
183216 // Try with main connection
184217 sub , err := s .AvsContractBindings .ethClient .SubscribeNewHead (ctx , c )
@@ -188,7 +221,29 @@ func (s *AvsSubscriber) SubscribeNewHeadRetryable(ctx context.Context, c chan<-
188221 }
189222 return sub , err
190223 }
191- return retry .RetryWithData (subscribeNewHead_func , retry .DefaultRetryConfig ())
224+ return subscribeNewHead_func
225+ }
226+
227+ /*
228+ SubscribeNewHeadRetryable
229+ Subscribe to new heads from the Ethereum node.
230+ - All errors are considered Transient Errors
231+ - Retry times (3 retries): 1 sec, 2 sec, 4 sec.
232+ */
233+ func (s * AvsSubscriber ) SubscribeNewHeadRetryable (ctx context.Context , c chan <- * types.Header ) (ethereum.Subscription , error ) {
234+ return retry .RetryWithData (SubscribeNewHead (s , ctx , c ), retry .DefaultRetryConfig ())
235+ }
236+
237+ func SubscribeToNewTasksV2 (
238+ opts * bind.WatchOpts ,
239+ serviceManager * servicemanager.ContractAlignedLayerServiceManager ,
240+ newTaskCreatedChan chan * servicemanager.ContractAlignedLayerServiceManagerNewBatchV2 ,
241+ batchMerkleRoot [][32 ]byte ,
242+ ) func () (event.Subscription , error ) {
243+ subscribe_func := func () (event.Subscription , error ) {
244+ return serviceManager .WatchNewBatchV2 (opts , newTaskCreatedChan , batchMerkleRoot )
245+ }
246+ return subscribe_func
192247}
193248
194249/*
@@ -203,10 +258,19 @@ func SubscribeToNewTasksV2Retryable(
203258 newTaskCreatedChan chan * servicemanager.ContractAlignedLayerServiceManagerNewBatchV2 ,
204259 batchMerkleRoot [][32 ]byte ,
205260) (event.Subscription , error ) {
261+ return retry .RetryWithData (SubscribeToNewTasksV2 (opts , serviceManager , newTaskCreatedChan , batchMerkleRoot ), retry .DefaultRetryConfig ())
262+ }
263+
264+ func SubscribeToNewTasksV3 (
265+ opts * bind.WatchOpts ,
266+ serviceManager * servicemanager.ContractAlignedLayerServiceManager ,
267+ newTaskCreatedChan chan * servicemanager.ContractAlignedLayerServiceManagerNewBatchV3 ,
268+ batchMerkleRoot [][32 ]byte ,
269+ ) func () (event.Subscription , error ) {
206270 subscribe_func := func () (event.Subscription , error ) {
207- return serviceManager .WatchNewBatchV2 (opts , newTaskCreatedChan , batchMerkleRoot )
271+ return serviceManager .WatchNewBatchV3 (opts , newTaskCreatedChan , batchMerkleRoot )
208272 }
209- return retry . RetryWithData ( subscribe_func , retry . DefaultRetryConfig ())
273+ return subscribe_func
210274}
211275
212276/*
@@ -221,8 +285,5 @@ func SubscribeToNewTasksV3Retryable(
221285 newTaskCreatedChan chan * servicemanager.ContractAlignedLayerServiceManagerNewBatchV3 ,
222286 batchMerkleRoot [][32 ]byte ,
223287) (event.Subscription , error ) {
224- subscribe_func := func () (event.Subscription , error ) {
225- return serviceManager .WatchNewBatchV3 (opts , newTaskCreatedChan , batchMerkleRoot )
226- }
227- return retry .RetryWithData (subscribe_func , retry .DefaultRetryConfig ())
288+ return retry .RetryWithData (SubscribeToNewTasksV3 (opts , serviceManager , newTaskCreatedChan , batchMerkleRoot ), retry .DefaultRetryConfig ())
228289}
0 commit comments