diff --git a/custom/auth/client/utils/feeutils.go b/custom/auth/client/utils/feeutils.go index 7496b20e..30123f82 100644 --- a/custom/auth/client/utils/feeutils.go +++ b/custom/auth/client/utils/feeutils.go @@ -46,7 +46,8 @@ func ComputeFeesWithCmd( gasStr, _ := flagSet.GetString(flags.FlagGas) switch gasStr { case flags.GasFlagAuto: - // skip + txf = txf.WithGas(0) + txf = txf.WithSimulateAndExecute(true) case "": txf = txf.WithGas(0) txf = txf.WithSimulateAndExecute(true) @@ -123,8 +124,9 @@ func CalculateGas( return nil, 0, err } - taxGas := simSpecialRes.GasInfo.GasUsed - simRes.GasInfo.GasUsed - actualGas := uint64(txf.GasAdjustment() * float64(simRes.GasInfo.GasUsed)) + taxGas := simRes.GasInfo.GasUsed - simSpecialRes.GasInfo.GasUsed + actualGas := uint64(txf.GasAdjustment() * float64(simSpecialRes.GasInfo.GasUsed)) + simRes.GasInfo = simSpecialRes.GasInfo return simRes, actualGas + taxGas, nil } diff --git a/custom/wasm/keeper/handler_plugin.go b/custom/wasm/keeper/handler_plugin.go index 12987836..f22e959d 100644 --- a/custom/wasm/keeper/handler_plugin.go +++ b/custom/wasm/keeper/handler_plugin.go @@ -97,7 +97,7 @@ func (h SDKMessageHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddr return nil, nil, err } ctx.TaxGasMeter().ConsumeGas(taxGas, "tax gas") - if ctx.IsSpecialSimulate() { + if ctx.IsSimulate() { ctx.CacheTaxGasMeter().ConsumeGas(taxGas, "tax gas") } diff --git a/go.mod b/go.mod index 4544f7a6..d18f8482 100644 --- a/go.mod +++ b/go.mod @@ -227,7 +227,7 @@ replace ( // use cometbft github.com/cometbft/cometbft => github.com/classic-terra/cometbft v0.37.4-terra1 github.com/cometbft/cometbft-db => github.com/cometbft/cometbft-db v0.8.0 - github.com/cosmos/cosmos-sdk => github.com/classic-terra/cosmos-sdk v0.47.10-terra.2 + github.com/cosmos/cosmos-sdk => ../Upgrade/cosmos-sdk github.com/cosmos/ibc-go/v7 => github.com/classic-terra/ibc-go/v7 v7.4.0-terra.1 github.com/cosmos/ledger-cosmos-go => github.com/terra-money/ledger-terra-go v0.11.2 // replace goleveldb to optimized one diff --git a/go.sum b/go.sum index f848552d..467109c0 100644 --- a/go.sum +++ b/go.sum @@ -350,8 +350,6 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/classic-terra/cometbft v0.37.4-terra1 h1:eT5B2n5KKi5WVW+3ZNOVTmtfKKaZrXOLX9G80m9mhZo= github.com/classic-terra/cometbft v0.37.4-terra1/go.mod h1:vFqj7Qe3uFFJvHZleTJPQDmJ/WscXHi4rKWqiCAaNZk= -github.com/classic-terra/cosmos-sdk v0.47.10-terra.2 h1:f54DHwGuOcyrWToTYKpFLy1i5qUz9GAtc6DOg7rF6zI= -github.com/classic-terra/cosmos-sdk v0.47.10-terra.2/go.mod h1:Qgm2WbKtqHgE1v9eAra7Fos/zAcB7F4ikwwbDm9SV+o= github.com/classic-terra/goleveldb v0.0.0-20230914223247-2b28f6655121 h1:fjpWDB0hm225wYg9vunyDyTH8ftd5xEUgINJKidj+Tw= github.com/classic-terra/goleveldb v0.0.0-20230914223247-2b28f6655121/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/classic-terra/ibc-go/v7 v7.4.0-terra.1 h1:xPT04cguu/Tt//x8eOKQVZP3RfYh/JDaBS4jPexK/OM= diff --git a/x/tax2gas/ante/ante.go b/x/tax2gas/ante/ante.go index b75d5719..434647b9 100644 --- a/x/tax2gas/ante/ante.go +++ b/x/tax2gas/ante/ante.go @@ -116,7 +116,7 @@ func (fd FeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, nex WithValue(types.FinalGasPrices, gasPrices) if !taxGas.IsZero() { newCtx.TaxGasMeter().ConsumeGas(taxGas, "ante handler taxGas") - if ctx.IsSpecialSimulate() { + if ctx.IsSimulate() { ctx.CacheTaxGasMeter().ConsumeGas(taxGas, "tax gas") } } diff --git a/x/tax2gas/post/post.go b/x/tax2gas/post/post.go index 100ae476..a6709465 100644 --- a/x/tax2gas/post/post.go +++ b/x/tax2gas/post/post.go @@ -91,7 +91,7 @@ func (tgd Tax2gasPostDecorator) PostHandle(ctx sdk.Context, tx sdk.Tx, simulate taxGasUint64 := taxGas.Uint64() // Check if gas not overflow if totalGasConsumed+taxGasUint64 >= totalGasConsumed && totalGasConsumed+taxGasUint64 >= taxGasUint64 { - if ctx.IsSpecialSimulate() { + if ctx.IsSimulate() { if taxGasUint64+totalGasConsumed > ctx.GasMeter().Limit() { ctx.GasMeter().ExtendGasLimit() }