@@ -15,6 +15,7 @@ import (
1515 "github.com/ethereum/go-ethereum/common"
1616 "github.com/ethereum/go-ethereum/core/types"
1717 servicemanager "github.com/yetanotherco/aligned_layer/contracts/bindings/AlignedLayerServiceManager"
18+ connection "github.com/yetanotherco/aligned_layer/core"
1819 "github.com/yetanotherco/aligned_layer/core/config"
1920 "github.com/yetanotherco/aligned_layer/core/utils"
2021)
@@ -95,26 +96,28 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
9596 txOpts .Nonce = txNonce
9697 var i uint64 = 1
9798
98- beforeTransaction := func (gasPrice * big.Int ) error {
99- txOpts .GasPrice = gasPrice
99+ executeTransaction := func (bumpedGasPrices * big.Int ) ( * types. Transaction , error ) {
100+ txOpts .GasPrice = bumpedGasPrices
100101 w .logger .Infof ("Sending ResponseToTask transaction with a gas price of %v" , txOpts .GasPrice )
101102 err = w .checkRespondToTaskFeeLimit (tx , txOpts , batchIdentifierHash , senderAddress )
102- return err
103- }
104103
105- executeTransaction := func (gasPrice * big.Int ) (* types.Transaction , error ) {
104+ if err != nil {
105+ return nil , connection.PermanentError {Inner : err }
106+ }
107+
106108 tx , err = w .AvsContractBindings .ServiceManager .RespondToTaskV2 (& txOpts , batchMerkleRoot , senderAddress , nonSignerStakesAndSignature , new (big.Int ).SetUint64 (i ))
107109 if err != nil {
108110 // Retry with fallback
109111 tx , err = w .AvsContractBindings .ServiceManagerFallback .RespondToTaskV2 (& txOpts , batchMerkleRoot , senderAddress , nonSignerStakesAndSignature , new (big.Int ).SetUint64 (i ))
110- i ++
111- return tx , err
112+ if err != nil {
113+ return nil , connection.PermanentError {Inner : err }
114+ }
115+ return tx , nil
112116 }
113- i ++
114- return tx , err
117+ return tx , nil
115118 }
116119
117- return utils .SendTransactionWithInfiniteRetryAndBumpingGasPrice (beforeTransaction , executeTransaction , w .Client , tx .GasPrice ())
120+ return utils .SendTransactionWithInfiniteRetryAndBumpingGasPrice (executeTransaction , w .Client , tx .GasPrice ())
118121}
119122
120123func (w * AvsWriter ) checkRespondToTaskFeeLimit (tx * types.Transaction , txOpts bind.TransactOpts , batchIdentifierHash [32 ]byte , senderAddress [20 ]byte ) error {
0 commit comments