@@ -21,8 +21,11 @@ import (
2121)
2222
2323const (
24- GasBumpPercentage int = 20
25- // wait as much as 3 blocks time for the receipt
24+ // How much to bump every retry (constant)
25+ GasBaseBumpPercentage int = 20
26+ // An extra percentage to bump every retry i*5 (linear)
27+ GasBumpIncrementalBumpPercentage int = 5
28+ // Wait as much as 3 blocks time for the receipt
2629 SendAggregateResponseReceiptTimeout time.Duration = time .Second * 36
2730)
2831
@@ -82,9 +85,9 @@ func NewAvsWriterFromConfig(baseConfig *config.BaseConfig, ecdsaConfig *config.E
8285// it will try again bumping the last tx gas price based on `CalculateGasPriceBump`
8386// This process happens indefinitely until the transaction is included.
8487//
85- // Note: If the rpc endpoints fail, the retry will stop it returning a permanent error.
86- // This is because the retries are infinite and we want to prevent increasing the time between them too much as it is exponential.
87- // And we might also if the rpc is down for a good period of time, we might fall into an infinite waiting.
88+ // Note: If the rpc endpoints fail, the retry mechanism stops, returning a permanent error.
89+ // This is because retries are infinite and we want to prevent increasing the time between them too much as it is exponential.
90+ // And, if the rpc is down for a good period of time, we might fall into an infinite waiting.
8891func (w * AvsWriter ) SendAggregatedResponse (batchIdentifierHash [32 ]byte , batchMerkleRoot [32 ]byte , senderAddress [20 ]byte , nonSignerStakesAndSignature servicemanager.IBLSSignatureCheckerNonSignerStakesAndSignature , onRetry func ()) (* types.Receipt , error ) {
8992 txOpts := * w .Signer .GetTxOpts ()
9093 txOpts .NoSend = true // simulate the transaction
@@ -124,7 +127,7 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
124127 return nil , connection.PermanentError {Inner : err }
125128 }
126129 }
127- txOpts .GasPrice = utils .CalculateGasPriceBumpBasedOnRetry (gasPrice , GasBumpPercentage , i )
130+ txOpts .GasPrice = utils .CalculateGasPriceBumpBasedOnRetry (gasPrice , GasBaseBumpPercentage , GasBumpIncrementalBumpPercentage , i )
128131
129132 w .logger .Infof ("Sending ResponseToTask transaction with a gas price of %v" , txOpts .GasPrice )
130133 err = w .checkRespondToTaskFeeLimit (tx , txOpts , batchIdentifierHash , senderAddress )
0 commit comments