From d39a1daafe31ed265bcce0b6371c1d810fddd53e Mon Sep 17 00:00:00 2001 From: Ran Mishael Date: Thu, 26 Jan 2023 19:13:35 +0100 Subject: [PATCH] PRT-377 gas adjustments --- relayer/sentry/tx.go | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/relayer/sentry/tx.go b/relayer/sentry/tx.go index 720fb2fcd5..57deb7c61a 100644 --- a/relayer/sentry/tx.go +++ b/relayer/sentry/tx.go @@ -1,8 +1,6 @@ package sentry import ( - "strconv" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" @@ -12,7 +10,6 @@ import ( const ( defaultGasPrice = "0.000000001ulava" defaultGasAdjustment = 1.5 - maximumGasAllowed = 5000000 ) func SimulateAndBroadCastTx(clientCtx client.Context, txf tx.Factory, msg sdk.Msg) error { @@ -32,10 +29,6 @@ func SimulateAndBroadCastTx(clientCtx client.Context, txf tx.Factory, msg sdk.Ms return err } - if err := validateGas(gasUsed); err != nil { - return err - } - txf = txf.WithGas(gasUsed) err = tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) @@ -72,16 +65,6 @@ func prepareFactory(clientCtx client.Context, txf tx.Factory) (tx.Factory, error return txf, nil } -func validateGas(gas uint64) error { - if gas > maximumGasAllowed { - return utils.LavaFormatError("SimulateAndBroadCastTx - Maximum gas allowed Reached", nil, &map[string]string{ - "maximumGasAllowed": strconv.FormatUint(maximumGasAllowed, 10), - "gasUsed": strconv.FormatUint(gas, 10), - }) - } - return nil -} - func CheckProfitabilityAndBroadCastTx(clientCtx client.Context, txf tx.Factory, msg sdk.Msg) error { txf = txf.WithGasPrices(defaultGasPrice) txf = txf.WithGasAdjustment(defaultGasAdjustment) @@ -116,10 +99,6 @@ func CheckProfitabilityAndBroadCastTx(clientCtx client.Context, txf tx.Factory, } } - if err := validateGas(gasUsed); err != nil { - return err - } - txf = txf.WithGas(gasUsed) gasFee := txf.GasPrices()[0] @@ -127,7 +106,7 @@ func CheckProfitabilityAndBroadCastTx(clientCtx client.Context, txf tx.Factory, lavaRewardDec := sdk.NewDecCoinFromCoin(lavaReward) if gasFee.IsGTE(lavaRewardDec) { - utils.LavaFormatError("lava_relay_payment claim is not profitable", nil, &map[string]string{"gasFee": gasFee.String(), "lavareward:": lavaRewardDec.String(), "msg": msg.String()}) + return utils.LavaFormatError("lava_relay_payment claim is not profitable", nil, &map[string]string{"gasFee": gasFee.String(), "lavareward:": lavaRewardDec.String(), "msg": msg.String()}) } err = tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg)