Skip to content
Merged
Changes from all 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
13 changes: 11 additions & 2 deletions core/chainio/avs_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
// Set the nonce, as we might have to replace the transaction with a higher gas price
txNonce := big.NewInt(int64(simTx.Nonce()))
txOpts.Nonce = txNonce
txOpts.GasPrice = simTx.GasPrice()
txOpts.GasPrice = nil
txOpts.NoSend = false
i := 0

Expand All @@ -113,7 +113,16 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
if err != nil {
return nil, err
}
previousTxGasPrice := txOpts.GasPrice

// if txOpts.GasPrice wasn't previously set use the fetched gasPrice
// this should happen on the first iteration only
var previousTxGasPrice *big.Int
if txOpts.GasPrice == nil {
previousTxGasPrice = gasPrice
} else {
previousTxGasPrice = txOpts.GasPrice
}

// in order to avoid replacement transaction underpriced
// the bumped gas price has to be at least 10% higher than the previous one.
minimumGasPriceBump := utils.CalculateGasPriceBumpBasedOnRetry(previousTxGasPrice, 10, 0, gasBumpPercentageLimit, 0)
Expand Down
Loading