laconicd-deprecated/x/feemarket/keeper/abci_test.go
crypto-facs 620f6a6770
imp(feemarket): update BaseFee based on GasWanted (#1105)
* add gasWanted transient store keys

* add gasWanted transient store keeper functions

* add gasWanted transient store tracker

* add comment

* remove unncesary comment

* remove unnecesary function

* fix tests

* fix bad comment

* remove unnecesary comment

* update comment

* update changelog

* Update CHANGELOG.md

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* add GasWantedDecorator

* remove unnecesary comments

* gasWanted decorator test

* fix tests

* fix tests and build

* fix lint

* updated end block event

* Update app/ante/fee_market.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* fix undeclared variable

* Update app/ante/fee_market_test.go

* remove unnecesary line

* migrate MinGasMultiplier to FeeMarket module

* set limited gas wanted

* remove old newKeeper param

* update proto comment

* fix test

* update comments

* Update x/feemarket/keeper/abci.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* address comments from review

* tidy

* tests

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-06-05 09:22:33 +00:00

47 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)
})
}
}