@@ -3,6 +3,7 @@ package ante_test
33import (
44 "context"
55 "fmt"
6+ stdmath "math"
67
78 "cosmossdk.io/math"
89
@@ -147,3 +148,43 @@ func (suite *AnteTestSuite) TestEnsureMempoolFees() {
147148 _ , _ , err = fc .CheckTxFeeWithMinGasPrices (suite .ctx , tx )
148149 suite .Require ().NotNil (err , "Decorator should have errored on too low fee for local gasPrice" )
149150}
151+
152+ func (suite * AnteTestSuite ) TestEnsureMempoolFees_PriorityOverflowCapped () {
153+ suite .SetupTest ()
154+ suite .txBuilder = suite .clientCtx .TxConfig .NewTxBuilder ()
155+
156+ fc := ante .NewMempoolFeeChecker (TestAnteKeeper {
157+ pools : map [string ][]math.Int {
158+ "rare" : {
159+ math .NewInt (5_000_000_000_000_000_000 ),
160+ math .OneInt (),
161+ },
162+ },
163+ weights : map [string ][]math.LegacyDec {
164+ "rare" : {
165+ math .LegacyOneDec (),
166+ math .LegacyOneDec (),
167+ },
168+ },
169+ baseDenom : baseDenom ,
170+ baseGasPrice : math .LegacyZeroDec (),
171+ })
172+
173+ priv1 , _ , addr1 := testdata .KeyTestPubAddr ()
174+ msg := testdata .NewTestMsg (addr1 )
175+
176+ suite .Require ().NoError (suite .txBuilder .SetMsgs (msg ))
177+ suite .txBuilder .SetFeeAmount (sdk .NewCoins (sdk .NewCoin ("rare" , math .OneInt ())))
178+ suite .txBuilder .SetGasLimit (1 )
179+
180+ privs , accNums , accSeqs := []cryptotypes.PrivKey {priv1 }, []uint64 {0 }, []uint64 {0 }
181+ tx , err := suite .CreateTestTx (privs , accNums , accSeqs , suite .ctx .ChainID ())
182+ suite .Require ().NoError (err )
183+
184+ suite .ctx = suite .ctx .WithIsCheckTx (true )
185+ suite .ctx = suite .ctx .WithMinGasPrices (nil )
186+
187+ _ , priority , err := fc .CheckTxFeeWithMinGasPrices (suite .ctx , tx )
188+ suite .Require ().NoError (err )
189+ suite .Require ().Equal (int64 (stdmath .MaxInt64 ), priority )
190+ }
0 commit comments