forked from cerc-io/laconicd-deprecated
29d3abcf09
* Reuse cosmos-sdk client library to create keyring Extracted from https://github.com/evmos/ethermint/pull/1168 Cleanup cmd code for easier to migration to cosmos-sdk 0.46 * Update cosmos-sdk v0.46 prepare for implementing cosmos-sdk feemarket and tx prioritization changelog refactor cmd use sdkmath fix lint fix unit tests fix unit test genesis fix unit tests fix unit test env setup fix unit tests fix unit tests register PrivKey impl fix extension options fix lint fix unit tests make HandlerOption.Validate private gofumpt fix msg response decoding fix sim test bump cosmos-sdk version fix sim test sdk 46 fix unit test fix unit tests update ibc-go
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package keeper_test
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/tendermint/tendermint/abci/types"
|
|
)
|
|
|
|
func (suite *KeeperTestSuite) TestEndBlock() {
|
|
testCases := []struct {
|
|
name string
|
|
NoBaseFee bool
|
|
malleate func()
|
|
expGasWanted uint64
|
|
}{
|
|
{
|
|
"baseFee nil",
|
|
true,
|
|
func() {},
|
|
uint64(0),
|
|
},
|
|
{
|
|
"pass",
|
|
false,
|
|
func() {
|
|
meter := sdk.NewGasMeter(uint64(1000000000))
|
|
suite.ctx = suite.ctx.WithBlockGasMeter(meter)
|
|
suite.app.FeeMarketKeeper.SetTransientBlockGasWanted(suite.ctx, 5000000)
|
|
},
|
|
uint64(2500000),
|
|
},
|
|
}
|
|
for _, tc := range testCases {
|
|
suite.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
|
suite.SetupTest() // reset
|
|
params := suite.app.FeeMarketKeeper.GetParams(suite.ctx)
|
|
params.NoBaseFee = tc.NoBaseFee
|
|
suite.app.FeeMarketKeeper.SetParams(suite.ctx, params)
|
|
|
|
tc.malleate()
|
|
suite.app.FeeMarketKeeper.EndBlock(suite.ctx, types.RequestEndBlock{Height: 1})
|
|
gasWanted := suite.app.FeeMarketKeeper.GetBlockGasWanted(suite.ctx)
|
|
suite.Require().Equal(tc.expGasWanted, gasWanted, tc.name)
|
|
})
|
|
}
|
|
}
|