Skip to content

Commit ea0c2c0

Browse files
OppenJulian Ventura
andauthored
fix: nil dereference on aggregator retries (#1441)
Co-authored-by: Julian Ventura <[email protected]>
1 parent c223d8f commit ea0c2c0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

core/chainio/avs_writer.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ func NewAvsWriterFromConfig(baseConfig *config.BaseConfig, ecdsaConfig *config.E
8181
func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMerkleRoot [32]byte, senderAddress [20]byte, nonSignerStakesAndSignature servicemanager.IBLSSignatureCheckerNonSignerStakesAndSignature, gasBumpPercentage uint, gasBumpIncrementalPercentage uint, timeToWaitBeforeBump time.Duration, onGasPriceBumped func(*big.Int)) (*types.Receipt, error) {
8282
txOpts := *w.Signer.GetTxOpts()
8383
txOpts.NoSend = true // simulate the transaction
84-
tx, err := w.RespondToTaskV2Retryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
84+
simTx, err := w.RespondToTaskV2Retryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
8585
if err != nil {
8686
return nil, err
8787
}
8888

8989
// Set the nonce, as we might have to replace the transaction with a higher gas price
90-
txNonce := big.NewInt(int64(tx.Nonce()))
90+
txNonce := big.NewInt(int64(simTx.Nonce()))
9191
txOpts.Nonce = txNonce
92-
txOpts.GasPrice = tx.GasPrice()
92+
txOpts.GasPrice = simTx.GasPrice()
9393
txOpts.NoSend = false
9494
i := 0
9595

@@ -114,21 +114,21 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
114114

115115
// We compare both Aggregator funds and Batcher balance in Aligned against respondToTaskFeeLimit
116116
// Both are required to have some balance, more details inside the function
117-
err = w.checkAggAndBatcherHaveEnoughBalance(tx, txOpts, batchIdentifierHash, senderAddress)
117+
err = w.checkAggAndBatcherHaveEnoughBalance(simTx, txOpts, batchIdentifierHash, senderAddress)
118118
if err != nil {
119119
return nil, retry.PermanentError{Inner: err}
120120
}
121121

122122
w.logger.Infof("Sending RespondToTask transaction with a gas price of %v", txOpts.GasPrice)
123123

124-
tx, err = w.RespondToTaskV2Retryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
124+
realTx, err := w.RespondToTaskV2Retryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
125125
if err != nil {
126126
return nil, err
127127
}
128128

129-
receipt, err := utils.WaitForTransactionReceiptRetryable(w.Client, w.ClientFallback, tx.Hash(), timeToWaitBeforeBump)
129+
receipt, err := utils.WaitForTransactionReceiptRetryable(w.Client, w.ClientFallback, realTx.Hash(), timeToWaitBeforeBump)
130130
if receipt != nil {
131-
w.checkIfAggregatorHadToPaidForBatcher(tx, batchIdentifierHash)
131+
w.checkIfAggregatorHadToPaidForBatcher(realTx, batchIdentifierHash)
132132
return receipt, nil
133133
}
134134

0 commit comments

Comments
 (0)