Skip to content

Commit

Permalink
Merge pull request #305 from White-Whale-Defi-Platform/hoa/add-test
Browse files Browse the repository at this point in the history
chore: change name v3 -> v4
  • Loading branch information
hoank101 authored Jan 10, 2024
2 parents 4f4c612 + 48c610e commit dec2b3d
Show file tree
Hide file tree
Showing 46 changed files with 112 additions and 145 deletions.
4 changes: 2 additions & 2 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package app

import (
errorsmod "cosmossdk.io/errors"
feeburnAnte "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/ante"
feeburnkeeper "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/keeper"
feeburnAnte "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/ante"
feeburnkeeper "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/keeper"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down
20 changes: 7 additions & 13 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ import (
tokenfactorykeeper "github.com/terra-money/core/v2/x/tokenfactory/keeper"
tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"

feeburnmodule "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn"
feeburnmoduleclient "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/client"
feeburnmodulekeeper "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/keeper"
feeburnmoduletypes "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/types"
feeburnmodule "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn"
feeburnmoduleclient "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/client"
feeburnmodulekeeper "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/keeper"
feeburnmoduletypes "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/types"

// Note: please do your research before using this in production app, this is a demo and not an officially
// supported IBC team implementation. It has no known issues, but do your own research before using it.
Expand All @@ -152,14 +152,13 @@ import (

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
appparams "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/params"
appparams "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/params"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"

v2 "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/upgrades/v2"
v3_0_2 "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/upgrades/v3_0_2"
v4 "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/upgrades/v4_1_0"
v3_0_2 "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/upgrades/v3_0_2"
v4 "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/upgrades/v4_1_0"
)

const (
Expand Down Expand Up @@ -1120,11 +1119,6 @@ func RegisterSwaggerAPI(rtr *mux.Router) {

// Setup Upgrade Handler
func (app *MigalooApp) setupUpgradeHandlers() {
app.UpgradeKeeper.SetUpgradeHandler(
v2.UpgradeName,
v2.CreateUpgradeHandler(app.mm, app.configurator),
)

app.UpgradeKeeper.SetUpgradeHandler(
v3_0_2.UpgradeName,
v3_0_2.CreateUpgradeHandler(app.mm, app.configurator),
Expand Down
2 changes: 1 addition & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package app
import (
"github.com/cosmos/cosmos-sdk/std"

"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/params"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/params"
)

// MakeEncodingConfig creates a new EncodingConfig with all modules registered
Expand Down
2 changes: 1 addition & 1 deletion app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
config "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/params"
config "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/params"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
Expand Down
20 changes: 0 additions & 20 deletions app/upgrades/v2/constants.go

This file was deleted.

19 changes: 0 additions & 19 deletions app/upgrades/v2/upgrades.go

This file was deleted.

15 changes: 0 additions & 15 deletions app/upgrades/v2_2_5/constants.go

This file was deleted.

19 changes: 0 additions & 19 deletions app/upgrades/v2_2_5/upgrades.go

This file was deleted.

2 changes: 1 addition & 1 deletion app/upgrades/v3_0_2/constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package v3

import (
"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/upgrades"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/upgrades"
)

// UpgradeName defines the on-chain upgrade name for the Migaloo v3.0.2 upgrade.
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v4_1_0/constants.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v4_1_0/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v3
package v4

import (
"github.com/cosmos/cosmos-sdk/baseapp"
Expand All @@ -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,
Expand Down
45 changes: 45 additions & 0 deletions app/upgrades/v4_1_0/upgrades_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package v4_test

import (
"testing"

apptesting "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app"
abci "github.com/cometbft/cometbft/abci/types"
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)
})
}
4 changes: 2 additions & 2 deletions cmd/migalood/cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/stretchr/testify/require"

"cosmossdk.io/simapp"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/cmd/migalood/cmd"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/cmd/migalood/cmd"
"github.com/cosmos/cosmos-sdk/client/flags"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
Expand Down
4 changes: 2 additions & 2 deletions cmd/migalood/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
"github.com/spf13/cobra"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/params"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/params"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"

Expand Down
4 changes: 2 additions & 2 deletions cmd/migalood/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"os"

"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/cmd/migalood/cmd"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/cmd/migalood/cmd"
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/White-Whale-Defi-Platform/migaloo-chain/v3
module github.com/White-Whale-Defi-Platform/migaloo-chain/v4

go 1.21

Expand Down
2 changes: 1 addition & 1 deletion proto/migaloo/feeburn/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package migaloo.feeburn;
import "gogoproto/gogo.proto";
import "migaloo/feeburn/params.proto";

option go_package = "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/types";
option go_package = "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/types";

// GenesisState defines the feeburn module's genesis state.
message GenesisState {
Expand Down
2 changes: 1 addition & 1 deletion proto/migaloo/feeburn/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package migaloo.feeburn;

import "gogoproto/gogo.proto";

option go_package = "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/types";
option go_package = "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/types";

// Params defines the parameters for the module.
message Params {
Expand Down
2 changes: 1 addition & 1 deletion proto/migaloo/feeburn/proposals.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package migaloo.feeburn;
import "gogoproto/gogo.proto";
import "migaloo/feeburn/params.proto";

option go_package = "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/types";
option go_package = "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/types";

message MsgUpdateTxFeeBurnPercentProposal {
option (gogoproto.equal) = false;
Expand Down
2 changes: 1 addition & 1 deletion proto/migaloo/feeburn/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "migaloo/feeburn/params.proto";

option go_package = "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/types";
option go_package = "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/types";

// Query defines the gRPC querier service.
service Query {
Expand Down
2 changes: 1 addition & 1 deletion proto/migaloo/feeburn/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "cosmos_proto/cosmos.proto";
import "migaloo/feeburn/params.proto";
import "gogoproto/gogo.proto";
import "amino/amino.proto";
option go_package = "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/types";
option go_package = "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/types";

// Msg defines the Msg service.
service Msg {
Expand Down
2 changes: 1 addition & 1 deletion scripts/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ done

cd ..
# move proto files to the right places
cp -r github.com/White-Whale-Defi-Platform/migaloo-chain/v3/* ./
cp -r github.com/White-Whale-Defi-Platform/migaloo-chain/v4/* ./
rm -rf github.com
1 change: 1 addition & 0 deletions scripts/tests/init-test-framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ update_test_genesis ".app_state[\"mint\"][\"params\"][\"mint_denom\"]=\"$DENOM\"
update_test_genesis ".app_state[\"crisis\"][\"constant_fee\"][\"denom\"]=\"$DENOM\""
update_test_genesis ".app_state[\"gov\"][\"params\"][\"min_deposit\"][0][\"denom\"]=\"$DENOM\""
update_test_genesis ".app_state[\"tokenfactory\"][\"params\"][\"denom_creation_fee\"][0][\"denom\"]=\"$DENOM\""
update_test_genesis ".app_state[\"feeburn\"][\"params\"][\"tx_fee_burn_percent\"]=\"50\""


# Starting the chain
Expand Down
4 changes: 2 additions & 2 deletions testutil/keeper/feeburn.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package keeper
import (
"testing"

"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/keeper"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/types"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/keeper"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/types"
tmdb "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
Expand Down
2 changes: 1 addition & 1 deletion x/feeburn/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/types"

feeburnkeeper "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/keeper"
feeburnkeeper "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
)

Expand Down
4 changes: 2 additions & 2 deletions x/feeburn/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"math"
"strconv"

config "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/params"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/ante"
config "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/params"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/ante"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
4 changes: 2 additions & 2 deletions x/feeburn/ante/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package ante_test
import (
"testing"

apptesting "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app"
config "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/app/params"
apptesting "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app"
config "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/params"
"github.com/cosmos/cosmos-sdk/client/tx"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
Expand Down
2 changes: 1 addition & 1 deletion x/feeburn/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// "github.com/cosmos/cosmos-sdk/client/flags"
// sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/types"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/types"
)

// GetQueryCmd returns the cli query commands for this module
Expand Down
2 changes: 1 addition & 1 deletion x/feeburn/client/cli/query_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cli
import (
"context"

"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/types"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion x/feeburn/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/cosmos/cosmos-sdk/client"
// "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/types"
"github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/types"
)

// GetTxCmd returns the transaction commands for this module
Expand Down
Loading

0 comments on commit dec2b3d

Please sign in to comment.