From c2b0d00769007968250ce853dc56d4c8839a105e Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Tue, 16 Jan 2024 12:51:05 -0800 Subject: [PATCH] gas / gas adjustment fixes --- oracle/client/client.go | 2 +- oracle/client/tx.go | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/oracle/client/client.go b/oracle/client/client.go index 8a60f30c..e4de2203 100644 --- a/oracle/client/client.go +++ b/oracle/client/client.go @@ -271,7 +271,7 @@ func (oc OracleClient) CreateTxFactory() (tx.Factory, error) { return tx.Factory{}, err } - if oc.GasAdjustment == -1 { + if oc.GasAdjustment > 0 { return tx.Factory{}. WithAccountRetriever(clientCtx.AccountRetriever). WithChainID(oc.ChainID). diff --git a/oracle/client/tx.go b/oracle/client/tx.go index 43c5f591..c42b04b6 100644 --- a/oracle/client/tx.go +++ b/oracle/client/tx.go @@ -19,12 +19,14 @@ func BroadcastTx(clientCtx client.Context, txf tx.Factory, msgs ...sdk.Msg) (*sd return nil, err } - _, adjusted, err := tx.CalculateGas(clientCtx, txf, msgs...) - if err != nil { - return nil, err - } + if txf.GasAdjustment() > 0 { + _, adjusted, err := tx.CalculateGas(clientCtx, txf, msgs...) + if err != nil { + return nil, err + } - txf = txf.WithGas(adjusted) + txf = txf.WithGas(adjusted) + } unsignedTx, err := txf.BuildUnsignedTx(msgs...) if err != nil {