Skip to content

Commit

Permalink
fix: aggregator 2x bump in mainnet (yetanotherco#1551)
Browse files Browse the repository at this point in the history
Co-authored-by: Julian Arce <[email protected]>
  • Loading branch information
MarcosNicolau and JuArce authored Dec 4, 2024
1 parent 65bac39 commit f0af68a
Showing 1 changed file with 11 additions and 2 deletions.
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

0 comments on commit f0af68a

Please sign in to comment.