From d47a40bff6f11581356cb9a37be9af265771d0a1 Mon Sep 17 00:00:00 2001 From: Matt Curtis Date: Tue, 16 Jan 2024 15:59:32 +0000 Subject: [PATCH] Host: Fix bug causing unnecessary multiplier on L1 gas fees --- go/ethadapter/geth_rpc_client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go/ethadapter/geth_rpc_client.go b/go/ethadapter/geth_rpc_client.go index 20c79c2cc1..1d55dedbb1 100644 --- a/go/ethadapter/geth_rpc_client.go +++ b/go/ethadapter/geth_rpc_client.go @@ -259,8 +259,9 @@ func (e *gethRPCClient) PrepareTransactionToRetry(txData types.TxData, from geth } // it should never happen but to avoid any risk of repeated price increases we cap the possible retry price bumps to 5 - retryFloat := math.Max(_maxRetryPriceIncreases, float64(retryNumber)) + retryFloat := math.Min(_maxRetryPriceIncreases, float64(retryNumber)) // we apply a 20% gas price increase for each retry (retrying with similar price gets rejected by mempool) + // Retry '0' is the first attempt, gives multiplier of 1.0 multiplier := math.Pow(_retryPriceMultiplier, retryFloat) gasPriceFloat := new(big.Float).SetInt(gasPrice)