diff --git a/app/upgrades/v4_1_0/constants.go b/app/upgrades/v4_1_0/constants.go index 07b276ad..c68f43a0 100644 --- a/app/upgrades/v4_1_0/constants.go +++ b/app/upgrades/v4_1_0/constants.go @@ -1,4 +1,4 @@ -package v3 +package v4 // UpgradeName defines the on-chain upgrade name for the Migaloo v3.0.2 upgrade. // this upgrade includes the fix for pfm diff --git a/app/upgrades/v4_1_0/upgrades.go b/app/upgrades/v4_1_0/upgrades.go index d850891d..ea8585ba 100644 --- a/app/upgrades/v4_1_0/upgrades.go +++ b/app/upgrades/v4_1_0/upgrades.go @@ -1,4 +1,4 @@ -package v3 +package v4 import ( "github.com/cosmos/cosmos-sdk/baseapp" @@ -14,7 +14,7 @@ import ( ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ) -// small security fix, can be a no-op, running mm.RunMigarions just to be sure +// CreateUpgradeHandler small security fix, can be a no-op, running mm.RunMigarions just to be sure func CreateUpgradeHandler( mm *module.Manager, configurator module.Configurator, diff --git a/app/upgrades/v4_1_0/upgrades_test.go b/app/upgrades/v4_1_0/upgrades_test.go new file mode 100644 index 00000000..319c966d --- /dev/null +++ b/app/upgrades/v4_1_0/upgrades_test.go @@ -0,0 +1,45 @@ +package v4_test + +import ( + abci "github.com/cometbft/cometbft/abci/types" + "testing" + + apptesting "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/stretchr/testify/suite" +) + +const ( + v4UpgradeHeight = int64(10) +) + +type UpgradeTestSuite struct { + apptesting.KeeperTestHelper +} + +func TestUpgradeTestSuite(t *testing.T) { + suite.Run(t, new(UpgradeTestSuite)) +} + +func (suite *UpgradeTestSuite) TestUpgrade() { + suite.Setup(suite.T(), apptesting.SimAppChainID) + dummyUpgrade(suite) + feeBurnParam := suite.App.FeeBurnKeeper.GetParams(suite.Ctx) + suite.Require().Equal("0", feeBurnParam.GetTxFeeBurnPercent()) +} + +func dummyUpgrade(s *UpgradeTestSuite) { + s.Ctx = s.Ctx.WithBlockHeight(v4UpgradeHeight - 1) + plan := upgradetypes.Plan{Name: "v4.1.0", Height: v4UpgradeHeight} + err := s.App.UpgradeKeeper.ScheduleUpgrade(s.Ctx, plan) + s.Require().NoError(err) + _, exists := s.App.UpgradeKeeper.GetUpgradePlan(s.Ctx) + s.Require().True(exists) + + s.Ctx = s.Ctx.WithBlockHeight(v4UpgradeHeight) + + s.Require().NotPanics(func() { + beginBlockRequest := abci.RequestBeginBlock{} + s.App.BeginBlocker(s.Ctx, beginBlockRequest) + }) +}