Skip to content

Commit 087b5f3

Browse files
committed
add constants + use config in SendAggregatedResponse
1 parent 5f437ae commit 087b5f3

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

core/chainio/avs_writer.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ import (
2323
)
2424

2525
const (
26-
waitForTxConfigMaxInterval = 2 * time.Second
27-
waitForTxConfigNumRetries = 0
26+
waitForTxMaxInterval = 2 * time.Second
27+
waitForTxNumRetries = 0
28+
respondToTaskV2NumRetries uint64 = 0
29+
respondToTaskV2MaxInterval = time.Millisecond * 500
30+
respondToTaskV2MaxElapsedTime = 0
2831
)
2932

3033
type AvsWriter struct {
@@ -111,12 +114,14 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
111114

112115
// Set Retry config for RespondToTaskV2
113116
respondToTaskV2Config := retry.EthCallRetryConfig()
114-
respondToTaskV2Config.MaxElapsedTime = 0
117+
respondToTaskV2Config.NumRetries = respondToTaskV2NumRetries
118+
respondToTaskV2Config.MaxInterval = respondToTaskV2MaxInterval
119+
respondToTaskV2Config.MaxElapsedTime = respondToTaskV2MaxElapsedTime
115120

116121
// Set Retry config for WaitForTxRetryable
117122
waitForTxConfig := retry.EthCallRetryConfig()
118-
waitForTxConfig.MaxInterval = waitForTxConfigMaxInterval
119-
waitForTxConfig.NumRetries = waitForTxConfigNumRetries
123+
waitForTxConfig.MaxInterval = waitForTxMaxInterval
124+
waitForTxConfig.NumRetries = waitForTxNumRetries
120125
waitForTxConfig.MaxElapsedTime = timeToWaitBeforeBump
121126

122127
var sentTxs []*types.Transaction
@@ -185,7 +190,7 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
185190
}
186191
sentTxs = append(sentTxs, realTx)
187192

188-
w.logger.Infof("Transaction sent, waiting for receipt", "merkle root", batchMerkleRootHashString)
193+
w.logger.Infof("Transaction sent, waiting for receipt", "merkle root", batchMerkleRootHashString)
189194
receipt, err := utils.WaitForTransactionReceiptRetryable(w.Client, w.ClientFallback, realTx.Hash(), waitForTxConfig)
190195

191196
if receipt != nil {
@@ -204,7 +209,7 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
204209
return nil, fmt.Errorf("transaction failed")
205210
}
206211

207-
// This just retries the bump of a fee in case of a timeout
212+
// This just retries the bump of a fee in case of a timeout
208213
// The wait is done before on WaitForTransactionReceiptRetryable, and all the functions are retriable,
209214
// so this retry doesn't need to wait more time
210215
return retry.RetryWithData(respondToTaskV2Func, respondToTaskV2Config)

0 commit comments

Comments
 (0)