@@ -80,22 +80,25 @@ func CosmosCheckTxAnte(
8080 returnErr = HandleOutofGas (r , tx .(GasTx ).GetGas (), ctx .GasMeter ().GasConsumed ())
8181 }
8282 }()
83- gasMeter , err := GetGasMeter (ctx .WithGasMeter (storetypes .NewNoConsumptionInfiniteGasMeter ()), tx , oraclek , ek , pk )
83+ gasMeter , isGasless , err := GetGasMeter (ctx .WithGasMeter (storetypes .NewNoConsumptionInfiniteGasMeter ()), tx , oraclek , ek , pk )
8484 if err != nil {
8585 return ctx , err
8686 }
8787 ctx = ctx .WithGasMeter (gasMeter )
8888
89- priority , err := CheckAndChargeFees (ctx , tx , accountKeeper , bankKeeper , feegrantKeeper , pk )
90- if err != nil {
91- return ctx , err
89+ if ! isGasless {
90+ priority , err := CheckAndChargeFees (ctx , tx , accountKeeper , bankKeeper , feegrantKeeper , pk )
91+ if err != nil {
92+ return ctx , err
93+ }
94+ if priority > antedecorators .MaxPriority {
95+ ctx = ctx .WithPriority (antedecorators .MaxPriority )
96+ } else {
97+ ctx = ctx .WithPriority (priority )
98+ }
9299 }
93100 if oracleVote {
94101 ctx = ctx .WithPriority (antedecorators .OraclePriority )
95- } else if priority > antedecorators .MaxPriority {
96- ctx = ctx .WithPriority (antedecorators .MaxPriority )
97- } else {
98- ctx = ctx .WithPriority (priority )
99102 }
100103
101104 authParams := accountKeeper .GetParams (ctx )
@@ -144,7 +147,7 @@ func CosmosStatelessChecks(tx sdk.Tx, height int64, consensusParams *tmproto.Con
144147 if cp := consensusParams ; cp != nil && cp .Block != nil {
145148 // If there exists a maximum block gas limit, we must ensure that the tx
146149 // does not exceed it.
147- if cp .Block .MaxGas > 0 && gasTx .GetGas () > uint64 (cp .Block .MaxGas ) {
150+ if cp .Block .MaxGas > 0 && gasTx .GetGas () > uint64 (cp .Block .MaxGas ) { //nolint:gosec
148151 return false , sdkerrors .Wrapf (sdkerrors .ErrOutOfGas , "tx gas wanted %d exceeds block max gas limit %d" , gasTx .GetGas (), cp .Block .MaxGas )
149152 }
150153 }
@@ -192,7 +195,7 @@ func CosmosStatelessChecks(tx sdk.Tx, height int64, consensusParams *tmproto.Con
192195 }
193196
194197 timeoutHeight := timeoutTx .GetTimeoutHeight ()
195- if timeoutHeight > 0 && uint64 (height ) > timeoutHeight {
198+ if timeoutHeight > 0 && uint64 (height ) > timeoutHeight { //nolint:gosec
196199 return oracleVote , sdkerrors .Wrapf (
197200 sdkerrors .ErrTxTimeoutHeight , "block height: %d, timeout height: %d" , height , timeoutHeight ,
198201 )
@@ -244,17 +247,17 @@ func GetGasMeter(
244247 ctx sdk.Context , tx sdk.Tx , oracleKeeper oraclekeeper.Keeper ,
245248 evmKeeper * evmkeeper.Keeper ,
246249 paramsKeeper paramskeeper.Keeper ,
247- ) (sdk.GasMeter , error ) {
250+ ) (sdk.GasMeter , bool , error ) {
248251 // TODO: may not be necessary for CheckTx
249252 isGasless , err := antedecorators .IsTxGasless (tx , ctx , oracleKeeper , evmKeeper )
250253 if err != nil {
251- return nil , err
254+ return nil , false , err
252255 }
253256 if ! isGasless {
254257 cosmosGasParams := paramsKeeper .GetCosmosGasParams (ctx )
255- return storetypes .NewMultiplierGasMeter (tx .(GasTx ).GetGas (), cosmosGasParams .CosmosGasMultiplierNumerator , cosmosGasParams .CosmosGasMultiplierDenominator ), nil
258+ return storetypes .NewMultiplierGasMeter (tx .(GasTx ).GetGas (), cosmosGasParams .CosmosGasMultiplierNumerator , cosmosGasParams .CosmosGasMultiplierDenominator ), isGasless , nil
256259 }
257- return ctx .GasMeter (), nil
260+ return ctx .GasMeter (), isGasless , nil
258261}
259262
260263func CheckAndChargeFees (ctx sdk.Context , tx sdk.Tx , accountKeeper authkeeper.AccountKeeper , bankKeeper bankkeeper.Keeper , feegrantKeeper * feegrantkeeper.Keeper , paramsKeeper paramskeeper.Keeper ) (priority int64 , err error ) {
@@ -280,7 +283,7 @@ func CheckAndChargeFees(ctx sdk.Context, tx sdk.Tx, accountKeeper authkeeper.Acc
280283 }
281284 }
282285 if gas > 0 {
283- priority = authante .GetTxPriority (feeCoins , int64 (gas ))
286+ priority = authante .GetTxPriority (feeCoins , int64 (gas )) //nolint:gosec
284287 }
285288 if addr := accountKeeper .GetModuleAddress (authtypes .FeeCollectorName ); addr == nil {
286289 return priority , fmt .Errorf ("fee collector module account (%s) has not been set" , authtypes .FeeCollectorName )
@@ -362,7 +365,7 @@ func CheckPubKeys(ctx sdk.Context, tx sdk.Tx, accountKeeper authkeeper.AccountKe
362365 accountKeeper .SetAccount (ctx , acc )
363366
364367 sigCount += authante .CountSubKeys (pk )
365- if uint64 (sigCount ) > authParams .TxSigLimit {
368+ if uint64 (sigCount ) > authParams .TxSigLimit { //nolint:gosec
366369 return sdkerrors .Wrapf (sdkerrors .ErrTooManySignatures ,
367370 "signatures: %d, limit: %d" , sigCount , authParams .TxSigLimit )
368371 }
0 commit comments