Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: nil dereference on aggregator retries #1441

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions core/chainio/avs_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ func NewAvsWriterFromConfig(baseConfig *config.BaseConfig, ecdsaConfig *config.E
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) {
txOpts := *w.Signer.GetTxOpts()
txOpts.NoSend = true // simulate the transaction
tx, err := w.RespondToTaskV2Retryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
sim_tx, err := w.RespondToTaskV2Retryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
if err != nil {
return nil, err
}

// Set the nonce, as we might have to replace the transaction with a higher gas price
txNonce := big.NewInt(int64(tx.Nonce()))
txNonce := big.NewInt(int64(sim_tx.Nonce()))
txOpts.Nonce = txNonce
txOpts.GasPrice = tx.GasPrice()
txOpts.GasPrice = sim_tx.GasPrice()
txOpts.NoSend = false
i := 0

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

// We compare both Aggregator funds and Batcher balance in Aligned against respondToTaskFeeLimit
// Both are required to have some balance, more details inside the function
err = w.checkAggAndBatcherHaveEnoughBalance(tx, txOpts, batchIdentifierHash, senderAddress)
err = w.checkAggAndBatcherHaveEnoughBalance(sim_tx, txOpts, batchIdentifierHash, senderAddress)
Oppen marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return nil, retry.PermanentError{Inner: err}
}

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

tx, err = w.RespondToTaskV2Retryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
real_tx, err := w.RespondToTaskV2Retryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
if err != nil {
return nil, err
}

receipt, err := utils.WaitForTransactionReceiptRetryable(w.Client, w.ClientFallback, tx.Hash(), timeToWaitBeforeBump)
receipt, err := utils.WaitForTransactionReceiptRetryable(w.Client, w.ClientFallback, real_tx.Hash(), timeToWaitBeforeBump)
if receipt != nil {
w.checkIfAggregatorHadToPaidForBatcher(tx, batchIdentifierHash)
w.checkIfAggregatorHadToPaidForBatcher(real_tx, batchIdentifierHash)
return receipt, nil
}

Expand Down
Loading