From 6e5cceb126838528269fea0e43154bfc54e51c98 Mon Sep 17 00:00:00 2001
From: emidev98 <emilian@terra.money>
Date: Mon, 18 Dec 2023 14:21:38 +0200
Subject: [PATCH 1/4] feat(v2.9): remove pob

---
 Makefile                                      |  4 +-
 app/ante/ante.go                              | 12 ----
 app/app.go                                    | 57 +----------------
 app/app_test/app_test.go                      |  1 -
 app/config/const.go                           |  1 -
 app/genesis.go                                |  8 ---
 app/genesis_test.go                           | 17 -----
 app/keepers/keepers.go                        | 17 -----
 app/keepers/keys.go                           |  4 +-
 app/modules.go                                |  8 ---
 app/upgrade_handler.go                        | 17 +++--
 app/upgrades/v2.5/upgrade.go                  | 19 ------
 app/upgrades/v2.6/upgrade.go                  | 22 -------
 client/docs/config.json                       |  8 ---
 go.mod                                        |  1 -
 go.sum                                        |  6 +-
 integration-tests/package-lock.json           | 14 ++---
 integration-tests/package.json                |  2 +-
 .../{pob/pob.test.ts => disabled.pob/pob.ts}  |  0
 .../src/modules/icq/icqv1.test.ts             |  1 -
 interchaintest/pob_test.go                    | 63 -------------------
 scripts/protoc-swagger-gen.sh                 |  4 +-
 22 files changed, 22 insertions(+), 264 deletions(-)
 rename integration-tests/src/modules/{pob/pob.test.ts => disabled.pob/pob.ts} (100%)
 delete mode 100644 interchaintest/pob_test.go

diff --git a/Makefile b/Makefile
index 7110efb9..43474676 100644
--- a/Makefile
+++ b/Makefile
@@ -269,13 +269,11 @@ benchmark:
 simulate:
 	@go test  -bench BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true -Seed 1
 
-test-e2e-pob:
-	cd interchaintest && go test -race -v -run TestPOB .
 
 test-e2e-pmf:
 	cd interchaintest && go test -race -v -run TestPMF .
 
-.PHONY: test test-all test-cover test-unit test-race simulate test-e2e-pob test-e2e-pmf
+.PHONY: test test-all test-cover test-unit test-race simulate test-e2e-pmf
 
 ###############################################################################
 ###                                Linting                                  ###
diff --git a/app/ante/ante.go b/app/ante/ante.go
index c14b383d..9f9ab1c3 100644
--- a/app/ante/ante.go
+++ b/app/ante/ante.go
@@ -3,9 +3,6 @@ package ante
 import (
 	ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
 	ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
-	"github.com/skip-mev/pob/mempool"
-	pobante "github.com/skip-mev/pob/x/builder/ante"
-	pobkeeper "github.com/skip-mev/pob/x/builder/keeper"
 	feesharekeeper "github.com/terra-money/core/v2/x/feeshare/keeper"
 
 	"github.com/cosmos/cosmos-sdk/client"
@@ -29,9 +26,7 @@ type HandlerOptions struct {
 	BankKeeper        bankKeeper.Keeper
 	TxCounterStoreKey storetypes.StoreKey
 	WasmConfig        wasmTypes.WasmConfig
-	PobBuilderKeeper  pobkeeper.Keeper
 	TxConfig          client.TxConfig
-	PobMempool        mempool.Mempool
 }
 
 // NewAnteHandler returns an AnteHandler that checks and increments sequence
@@ -55,14 +50,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
 		sigGasConsumer = ante.DefaultSigVerificationGasConsumer
 	}
 
-	auctionDecorator := pobante.NewBuilderDecorator(
-		options.PobBuilderKeeper,
-		options.TxConfig.TxEncoder(),
-		options.PobMempool,
-	)
-
 	anteDecorators := []sdk.AnteDecorator{
-		auctionDecorator,
 		ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
 		wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit),
 		wasmkeeper.NewCountTXDecorator(options.TxCounterStoreKey),
diff --git a/app/app.go b/app/app.go
index 863c7836..359f2d19 100644
--- a/app/app.go
+++ b/app/app.go
@@ -6,8 +6,8 @@ import (
 	"net/http"
 	"os"
 	"path/filepath"
-	"reflect" // #nosec G702
 
+	// #nosec G702
 	"github.com/prometheus/client_golang/prometheus"
 
 	authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
@@ -89,9 +89,6 @@ import (
 	feeshare "github.com/terra-money/core/v2/x/feeshare"
 	feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"
 
-	pobabci "github.com/skip-mev/pob/abci"
-	pobmempool "github.com/skip-mev/pob/mempool"
-
 	tmjson "github.com/cometbft/cometbft/libs/json"
 
 	"github.com/terra-money/core/v2/app/ante"
@@ -156,9 +153,6 @@ type TerraApp struct {
 
 	invCheckPeriod uint
 
-	// Custom checkTx handler
-	checkTxHandler pobabci.CheckTx
-
 	// the module manager
 	mm           *module.Manager
 	basicManager module.BasicManager
@@ -256,10 +250,6 @@ func NewTerraApp(
 	app.RegisterUpgradeHandlers()
 	app.RegisterUpgradeStores()
 
-	config := pobmempool.NewDefaultAuctionFactory(encodingConfig.TxConfig.TxDecoder())
-	// when maxTx is set as 0, there won't be a limit on the number of txs in this mempool
-	pobMempool := pobmempool.NewAuctionMempool(encodingConfig.TxConfig.TxDecoder(), encodingConfig.TxConfig.TxEncoder(), 0, config)
-
 	anteHandler, err := ante.NewAnteHandler(
 		ante.HandlerOptions{
 			HandlerOptions: cosmosante.HandlerOptions{
@@ -274,9 +264,6 @@ func NewTerraApp(
 			IBCkeeper:         app.Keepers.IBCKeeper,
 			TxCounterStoreKey: app.keys[wasmtypes.StoreKey],
 			WasmConfig:        wasmConfig,
-			PobBuilderKeeper:  app.Keepers.BuilderKeeper,
-			TxConfig:          encodingConfig.TxConfig,
-			PobMempool:        pobMempool,
 		},
 	)
 	if err != nil {
@@ -290,34 +277,12 @@ func NewTerraApp(
 		},
 	)
 
-	// Create the proposal handler that will be used to build and validate blocks.
-	handler := pobabci.NewProposalHandler(
-		pobMempool,
-		bApp.Logger(),
-		anteHandler,
-		encodingConfig.TxConfig.TxEncoder(),
-		encodingConfig.TxConfig.TxDecoder(),
-	)
-	app.SetPrepareProposal(handler.PrepareProposalHandler())
-	app.SetProcessProposal(handler.ProcessProposalHandler())
-
-	// Set the custom CheckTx handler on BaseApp.
-	checkTxHandler := pobabci.NewCheckTxHandler(
-		app.BaseApp,
-		encodingConfig.TxConfig.TxDecoder(),
-		pobMempool,
-		anteHandler,
-		app.ChainID(),
-	)
-
 	// initialize BaseApp
 	app.SetInitChainer(app.InitChainer)
 	app.SetBeginBlocker(app.BeginBlocker)
 	app.SetAnteHandler(anteHandler)
 	app.SetPostHandler(postHandler)
 	app.SetEndBlocker(app.EndBlocker)
-	app.SetMempool(pobMempool)
-	app.SetCheckTx(checkTxHandler.CheckTx())
 
 	if loadLatest {
 		if err := app.LoadLatestVersion(); err != nil {
@@ -585,26 +550,6 @@ func (app *TerraApp) RegisterNodeService(clientCtx client.Context) {
 	nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter())
 }
 
-// ChainID gets chainID from private fields of BaseApp
-// Should be removed once SDK 0.50.x will be adopted
-func (app *TerraApp) ChainID() string {
-	field := reflect.ValueOf(app.BaseApp).Elem().FieldByName("chainID")
-	return field.String()
-}
-
-// CheckTx will check the transaction with the provided checkTxHandler. We override the default
-// handler so that we can verify bid transactions before they are inserted into the mempool.
-// With the POB CheckTx, we can verify the bid transaction and all of the bundled transactions
-// before inserting the bid transaction into the mempool.
-func (app *TerraApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
-	return app.checkTxHandler(req)
-}
-
-// SetCheckTx sets the checkTxHandler for the app.
-func (app *TerraApp) SetCheckTx(handler pobabci.CheckTx) {
-	app.checkTxHandler = handler
-}
-
 func (app *TerraApp) GetWasmOpts(appOpts servertypes.AppOptions) []wasmkeeper.Option {
 	var wasmOpts []wasmkeeper.Option
 	if cast.ToBool(appOpts.Get("telemetry.enabled")) {
diff --git a/app/app_test/app_test.go b/app/app_test/app_test.go
index 829ae49a..e6cf251a 100644
--- a/app/app_test/app_test.go
+++ b/app/app_test/app_test.go
@@ -180,7 +180,6 @@ func TestInitGenesisOnMigration(t *testing.T) {
 		"auth":                   4,
 		"authz":                  2,
 		"bank":                   4,
-		"builder":                1,
 		"capability":             1,
 		"consensus":              1,
 		"crisis":                 2,
diff --git a/app/config/const.go b/app/config/const.go
index b64f7790..34cd6009 100644
--- a/app/config/const.go
+++ b/app/config/const.go
@@ -207,7 +207,6 @@ const (
 	QueryDenomAuthorityMetadata                = "/osmosis.tokenfactory.v1beta1.Query/DenomAuthorityMetadata"
 	QueryDenomsFromCreator                     = "/osmosis.tokenfactory.v1beta1.Query/DenomsFromCreator"
 	QueryTokeFactoryParams                     = "/osmosis.tokenfactory.v1beta1.Query/Params"
-	QueryPobParams                             = "/pob.builder.v1.Query/Params"
 	QueryPFMParams                             = "/router.v1.Query/Params"
 
 	// UpgradeName gov proposal name
diff --git a/app/genesis.go b/app/genesis.go
index 1790f6a0..fd5dabba 100644
--- a/app/genesis.go
+++ b/app/genesis.go
@@ -8,7 +8,6 @@ import (
 	icagenesistypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types"
 	icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
 	icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
-	buildertypes "github.com/skip-mev/pob/x/builder/types"
 	"github.com/terra-money/core/v2/app/config"
 	tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"
 
@@ -63,12 +62,6 @@ func (genState GenesisState) SetDefaultTerraConfig(cdc codec.JSONCodec) GenesisS
 	tokenFactoryGenState.Params.DenomCreationFee = sdk.NewCoins(sdk.NewCoin(config.BondDenom, sdk.NewInt(10000000)))
 	genState[tokenfactorytypes.ModuleName] = cdc.MustMarshalJSON(&tokenFactoryGenState)
 
-	var builderGenState buildertypes.GenesisState
-	cdc.MustUnmarshalJSON(genState[buildertypes.ModuleName], &builderGenState)
-	builderGenState.Params.ReserveFee = sdk.NewCoin(config.BondDenom, sdk.NewInt(1))
-	builderGenState.Params.MinBidIncrement = sdk.NewCoin(config.BondDenom, sdk.NewInt(1))
-	genState[buildertypes.ModuleName] = cdc.MustMarshalJSON(&builderGenState)
-
 	var icqGenState icqtypes.GenesisState
 	cdc.MustUnmarshalJSON(genState[icqtypes.ModuleName], &icqGenState)
 	icqGenState.Params.HostEnabled = true
@@ -281,7 +274,6 @@ func icqAllowedQueries() []string {
 		config.QueryDenomAuthorityMetadata,
 		config.QueryDenomsFromCreator,
 		config.QueryTokeFactoryParams,
-		config.QueryPobParams,
 		config.QueryPFMParams,
 	}
 }
diff --git a/app/genesis_test.go b/app/genesis_test.go
index 45a2f7f7..8567433e 100644
--- a/app/genesis_test.go
+++ b/app/genesis_test.go
@@ -55,22 +55,6 @@ func TestGenesis(t *testing.T) {
 			"denom_metadata": [],
 			"send_enabled": []
 		},
-		"builder": {
-			"params": {
-				"max_bundle_size": 2,
-				"escrow_account_address": "32sHF2qbF8xMmvwle9QEcy59Cbc=",
-				"reserve_fee": {
-					"denom": "uluna",
-					"amount": "1"
-				},
-				"min_bid_increment": {
-					"denom": "uluna",
-					"amount": "1"
-				},
-				"front_running_protection": true,
-				"proposer_fee": "0.000000000000000000"
-			}
-		},
 		"capability": {
 			"index": "1",
 			"owners": []
@@ -396,7 +380,6 @@ func TestGenesis(t *testing.T) {
 					"/osmosis.tokenfactory.v1beta1.Query/DenomAuthorityMetadata",
 					"/osmosis.tokenfactory.v1beta1.Query/DenomsFromCreator",
 					"/osmosis.tokenfactory.v1beta1.Query/Params",
-					"/pob.builder.v1.Query/Params",
 					"/router.v1.Query/Params"
 				]
 			}
diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go
index 4cd0e67f..dddf53f1 100644
--- a/app/keepers/keepers.go
+++ b/app/keepers/keepers.go
@@ -93,7 +93,6 @@ import (
 	tokenfactorykeeper "github.com/terra-money/core/v2/x/tokenfactory/keeper"
 	tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"
 
-	pobtype "github.com/skip-mev/pob/x/builder/types"
 	"github.com/terra-money/alliance/x/alliance"
 	alliancekeeper "github.com/terra-money/alliance/x/alliance/keeper"
 	alliancetypes "github.com/terra-money/alliance/x/alliance/types"
@@ -101,8 +100,6 @@ import (
 	feesharekeeper "github.com/terra-money/core/v2/x/feeshare/keeper"
 	feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"
 
-	pobkeeper "github.com/skip-mev/pob/x/builder/keeper"
-
 	terraappconfig "github.com/terra-money/core/v2/app/config"
 	// unnamed import of statik for swagger UI support
 	_ "github.com/terra-money/core/v2/client/docs/statik"
@@ -126,7 +123,6 @@ var maccPerms = map[string][]string{
 	tokenfactorytypes.ModuleName:   {authtypes.Burner, authtypes.Minter},
 	alliancetypes.ModuleName:       {authtypes.Burner, authtypes.Minter},
 	alliancetypes.RewardsPoolName:  nil,
-	pobtype.ModuleName:             nil,
 }
 
 type TerraAppKeepers struct {
@@ -177,9 +173,6 @@ type TerraAppKeepers struct {
 
 	WasmKeeper       customwasmkeeper.Keeper
 	scopedWasmKeeper capabilitykeeper.ScopedKeeper
-
-	// BuilderKeeper is the keeper that handles processing auction transactions
-	BuilderKeeper pobkeeper.Keeper
 }
 
 func NewTerraAppKeepers(
@@ -534,16 +527,6 @@ func NewTerraAppKeepers(
 		),
 	)
 
-	keepers.BuilderKeeper = pobkeeper.NewKeeper(
-		appCodec,
-		keys[pobtype.StoreKey],
-		keepers.AccountKeeper,
-		keepers.BankKeeper,
-		keepers.DistrKeeper,
-		keepers.StakingKeeper,
-		authtypes.NewModuleAddress(govtypes.ModuleName).String(),
-	)
-
 	return keepers
 }
 
diff --git a/app/keepers/keys.go b/app/keepers/keys.go
index 496af563..d02540e9 100644
--- a/app/keepers/keys.go
+++ b/app/keepers/keys.go
@@ -46,8 +46,6 @@ import (
 	alliancetypes "github.com/terra-money/alliance/x/alliance/types"
 	feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"
 
-	pobtype "github.com/skip-mev/pob/x/builder/types"
-
 	// unnamed import of statik for swagger UI support
 	_ "github.com/terra-money/core/v2/client/docs/statik"
 )
@@ -62,7 +60,7 @@ func (keepers *TerraAppKeepers) GenerateKeys() {
 		icahosttypes.StoreKey, icacontrollertypes.StoreKey, routertypes.StoreKey,
 		consensusparamtypes.StoreKey, tokenfactorytypes.StoreKey, wasmtypes.StoreKey,
 		ibcfeetypes.StoreKey, ibchookstypes.StoreKey, crisistypes.StoreKey,
-		alliancetypes.StoreKey, feesharetypes.StoreKey, pobtype.StoreKey, icqtypes.StoreKey,
+		alliancetypes.StoreKey, feesharetypes.StoreKey, icqtypes.StoreKey,
 	)
 
 	keepers.tkeys = sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
diff --git a/app/modules.go b/app/modules.go
index 13fb70d3..caa50720 100644
--- a/app/modules.go
+++ b/app/modules.go
@@ -77,9 +77,6 @@ import (
 	"github.com/terra-money/alliance/x/alliance"
 	feeshare "github.com/terra-money/core/v2/x/feeshare"
 
-	pob "github.com/skip-mev/pob/x/builder"
-	pobtype "github.com/skip-mev/pob/x/builder/types"
-
 	ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
 	terrappsparams "github.com/terra-money/core/v2/app/params"
 
@@ -119,7 +116,6 @@ var ModuleBasics = module.NewBasicManager(
 	consensus.AppModuleBasic{},
 	alliance.AppModuleBasic{},
 	feeshare.AppModuleBasic{},
-	pob.AppModuleBasic{},
 	icq.AppModuleBasic{},
 )
 
@@ -157,7 +153,6 @@ func appModules(app *TerraApp, encodingConfig terrappsparams.EncodingConfig, ski
 		tokenfactory.NewAppModule(app.Keepers.TokenFactoryKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)),
 		alliance.NewAppModule(app.appCodec, app.Keepers.AllianceKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.interfaceRegistry, app.GetSubspace(alliancetypes.ModuleName)),
 		feeshare.NewAppModule(app.Keepers.FeeShareKeeper, app.Keepers.AccountKeeper, app.GetSubspace(feesharetypes.ModuleName)),
-		pob.NewAppModule(app.appCodec, app.Keepers.BuilderKeeper),
 		icq.NewAppModule(app.Keepers.ICQKeeper),
 	}
 }
@@ -196,7 +191,6 @@ var initGenesisOrder = []string{
 	feesharetypes.ModuleName,
 	consensusparamtypes.ModuleName,
 	icqtypes.ModuleName,
-	pobtype.ModuleName,
 }
 
 var beginBlockersOrder = []string{
@@ -229,7 +223,6 @@ var beginBlockersOrder = []string{
 	feesharetypes.ModuleName,
 	consensusparamtypes.ModuleName,
 	icqtypes.ModuleName,
-	pobtype.ModuleName,
 }
 
 var endBlockerOrder = []string{
@@ -262,5 +255,4 @@ var endBlockerOrder = []string{
 	feesharetypes.ModuleName,
 	consensusparamtypes.ModuleName,
 	icqtypes.ModuleName,
-	pobtype.ModuleName,
 }
diff --git a/app/upgrade_handler.go b/app/upgrade_handler.go
index 23f19618..4316a58c 100644
--- a/app/upgrade_handler.go
+++ b/app/upgrade_handler.go
@@ -4,7 +4,6 @@ import (
 	ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types"
 	icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
 	ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"
-	pobtype "github.com/skip-mev/pob/x/builder/types"
 	alliancetypes "github.com/terra-money/alliance/x/alliance/types"
 	terraappconfig "github.com/terra-money/core/v2/app/config"
 	v2_2_0 "github.com/terra-money/core/v2/app/upgrades/v2.2.0"
@@ -54,7 +53,6 @@ func (app *TerraApp) RegisterUpgradeHandlers() {
 			app.Keepers.ParamsKeeper,
 			app.Keepers.ConsensusParamsKeeper,
 			app.Keepers.ICAControllerKeeper,
-			app.Keepers.BuilderKeeper,
 			app.Keepers.AccountKeeper,
 		),
 	)
@@ -118,7 +116,7 @@ func (app *TerraApp) RegisterUpgradeStores() {
 			Added: []string{
 				consensusparamtypes.StoreKey,
 				crisistypes.StoreKey,
-				pobtype.StoreKey,
+				"builder",
 			},
 			Deleted: []string{
 				// Module intertx removed in v2.5 because it was never used
@@ -131,16 +129,17 @@ func (app *TerraApp) RegisterUpgradeStores() {
 		app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
 	} else if upgradeInfo.Name == terraappconfig.Upgrade2_6 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
 		storeUpgrades := storetypes.StoreUpgrades{
-			Added: []string{
-				feesharetypes.StoreKey,
-			},
+			Added: []string{feesharetypes.StoreKey},
 		}
 		app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
 	} else if upgradeInfo.Name == terraappconfig.Upgrade2_7 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
 		storeUpgrades := storetypes.StoreUpgrades{
-			Added: []string{
-				icqtypes.StoreKey,
-			},
+			Added: []string{icqtypes.StoreKey},
+		}
+		app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
+	} else if upgradeInfo.Name == terraappconfig.Upgrade2_9 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
+		storeUpgrades := storetypes.StoreUpgrades{
+			Deleted: []string{"builder"},
 		}
 		app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
 	}
diff --git a/app/upgrades/v2.5/upgrade.go b/app/upgrades/v2.5/upgrade.go
index 5481354c..f43d6d54 100644
--- a/app/upgrades/v2.5/upgrade.go
+++ b/app/upgrades/v2.5/upgrade.go
@@ -3,9 +3,6 @@ package v2_5
 import (
 	"time"
 
-	pobkeeper "github.com/skip-mev/pob/x/builder/keeper"
-	pobtypes "github.com/skip-mev/pob/x/builder/types"
-
 	authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
 
 	sdkerrors "cosmossdk.io/errors"
@@ -34,7 +31,6 @@ func CreateUpgradeHandler(
 	paramsKeeper paramskeeper.Keeper,
 	consensusParamsKeeper consensuskeeper.Keeper,
 	icacontrollerKeeper icacontrollerkeeper.Keeper,
-	pobKeeper pobkeeper.Keeper,
 	authKeeper authkeeper.AccountKeeper,
 ) upgradetypes.UpgradeHandler {
 	return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
@@ -65,21 +61,6 @@ func CreateUpgradeHandler(
 			return nil, err
 		}
 
-		// Create POB module account
-		_ = authKeeper.GetModuleAccount(ctx, pobtypes.ModuleName)
-
-		// Setting pob params to disable by default until a proposal is passed to enable it
-		err = pobKeeper.SetParams(ctx, pobtypes.Params{
-			MaxBundleSize:          0,
-			EscrowAccountAddress:   pobtypes.DefaultEscrowAccountAddress,
-			ReserveFee:             sdk.NewCoin("uluna", sdk.NewInt(1)),
-			MinBidIncrement:        sdk.NewCoin("uluna", sdk.NewInt(1)),
-			FrontRunningProtection: pobtypes.DefaultFrontRunningProtection,
-			ProposerFee:            pobtypes.DefaultProposerFee,
-		})
-		if err != nil {
-			return nil, err
-		}
 		return vm, nil
 	}
 }
diff --git a/app/upgrades/v2.6/upgrade.go b/app/upgrades/v2.6/upgrade.go
index 8a296496..14bd1346 100644
--- a/app/upgrades/v2.6/upgrade.go
+++ b/app/upgrades/v2.6/upgrade.go
@@ -8,7 +8,6 @@ import (
 	ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
 	ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
 	ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
-	pobtypes "github.com/skip-mev/pob/x/builder/types"
 	feesharekeeper "github.com/terra-money/core/v2/x/feeshare/keeper"
 	feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"
 
@@ -16,7 +15,6 @@ import (
 	sdk "github.com/cosmos/cosmos-sdk/types"
 	"github.com/cosmos/cosmos-sdk/types/module"
 	authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
-	authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
 	upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
 )
 
@@ -35,8 +33,6 @@ func CreateUpgradeHandler(
 		if err != nil {
 			return nil, err
 		}
-		// overwrite pob account to a module account for pisco-1
-		overwritePobModuleAccount(ctx, authKeeper)
 
 		// Increase the unbonding period for atlantic-2
 		err = increaseUnbondingPeriod(ctx, cdc, clientKeeper)
@@ -47,24 +43,6 @@ func CreateUpgradeHandler(
 	}
 }
 
-// Overwrite the module account for pisco-1
-func overwritePobModuleAccount(ctx sdk.Context, authKeeper authkeeper.AccountKeeper) {
-	if ctx.ChainID() == "pisco-1" {
-		macc := authtypes.NewEmptyModuleAccount(pobtypes.ModuleName)
-		pobaccount := authKeeper.GetAccount(ctx, macc.GetAddress())
-		// if pob account exists, overwrite it
-		// if not, create a new one
-		if pobaccount != nil {
-			macc.AccountNumber = pobaccount.GetAccountNumber()
-			maccI := (authKeeper.NewAccount(ctx, macc)).(authtypes.ModuleAccountI)
-			authKeeper.SetModuleAccount(ctx, maccI)
-		} else {
-			maccI := (authKeeper.NewAccount(ctx, macc)).(authtypes.ModuleAccountI)
-			authKeeper.SetModuleAccount(ctx, maccI)
-		}
-	}
-}
-
 // Iterate all IBC clients and increase unbonding period for all atlantic-2 clients
 func increaseUnbondingPeriod(ctx sdk.Context, cdc codec.BinaryCodec, clientKeeper clientkeeper.Keeper) error {
 	var clientIDs []string
diff --git a/client/docs/config.json b/client/docs/config.json
index 345b5698..16ed8481 100644
--- a/client/docs/config.json
+++ b/client/docs/config.json
@@ -237,14 +237,6 @@
         }
       }
     },
-    {
-      "url": "./tmp-swagger-gen/pob/builder/v1/query.swagger.json",
-      "operationIds": {
-        "rename": {
-          "Params": "PobParams"
-        }
-      }
-    },
     {
       "url": "./tmp-swagger-gen/juno/feeshare/v1/query.swagger.json",
       "operationIds": {
diff --git a/go.mod b/go.mod
index 8d0db47d..55dd68a1 100644
--- a/go.mod
+++ b/go.mod
@@ -25,7 +25,6 @@ require (
 	github.com/pkg/errors v0.9.1
 	github.com/prometheus/client_golang v1.16.0
 	github.com/rakyll/statik v0.1.7
-	github.com/skip-mev/pob v1.0.4
 	github.com/spf13/cast v1.5.1
 	github.com/spf13/cobra v1.7.0
 	github.com/spf13/viper v1.16.0
diff --git a/go.sum b/go.sum
index 67b777e0..956eb614 100644
--- a/go.sum
+++ b/go.sum
@@ -954,7 +954,7 @@ github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWEr
 github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
 github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034=
-github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs=
+github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w=
 github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
 github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
 github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
@@ -1070,8 +1070,6 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
 github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
 github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
 github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
-github.com/skip-mev/pob v1.0.4 h1:Degz+Pdm9pCom16bbLawZhXi6PbYPiiJe6cGjBE5g30=
-github.com/skip-mev/pob v1.0.4/go.mod h1:tpZivmkiDgCO6O79qBnK4eJQjuJeR9yUzc1jPlGaE1s=
 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
 github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
 github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
@@ -1585,7 +1583,7 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
 golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
 golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
 golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
-golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
+golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/integration-tests/package-lock.json b/integration-tests/package-lock.json
index bfcffad7..238bbd43 100644
--- a/integration-tests/package-lock.json
+++ b/integration-tests/package-lock.json
@@ -9,7 +9,7 @@
       "version": "v2.9.0",
       "license": "MIT",
       "dependencies": {
-        "@terra-money/feather.js": "^2.0.0-beta.14",
+        "@terra-money/feather.js": "^2.0.0-beta.16",
         "moment": "^2.29.4"
       },
       "devDependencies": {
@@ -1802,9 +1802,9 @@
       }
     },
     "node_modules/@terra-money/feather.js": {
-      "version": "2.0.0-beta.14",
-      "resolved": "https://registry.npmjs.org/@terra-money/feather.js/-/feather.js-2.0.0-beta.14.tgz",
-      "integrity": "sha512-imb/Pi6Y3+8lAiLODAYU0PQ5Pygugc3QLrf1wpL8VsQFKu8sJAFsL4k/UUGnR0h0iR3GSAtq+kebcX8NwxhsJA==",
+      "version": "2.0.0-beta.16",
+      "resolved": "https://registry.npmjs.org/@terra-money/feather.js/-/feather.js-2.0.0-beta.16.tgz",
+      "integrity": "sha512-VsIcHXft1T57HlWnyKfTIjylss15PZhMuIVjQ8hE7CJvI2p2/EEolGwLkOg/4EdzGJ2pSxGUGjvm97pGQAZERw==",
       "dependencies": {
         "@ethersproject/bytes": "^5.7.0",
         "@terra-money/legacy.proto": "npm:@terra-money/terra.proto@^0.1.7",
@@ -7007,9 +7007,9 @@
       }
     },
     "@terra-money/feather.js": {
-      "version": "2.0.0-beta.14",
-      "resolved": "https://registry.npmjs.org/@terra-money/feather.js/-/feather.js-2.0.0-beta.14.tgz",
-      "integrity": "sha512-imb/Pi6Y3+8lAiLODAYU0PQ5Pygugc3QLrf1wpL8VsQFKu8sJAFsL4k/UUGnR0h0iR3GSAtq+kebcX8NwxhsJA==",
+      "version": "2.0.0-beta.16",
+      "resolved": "https://registry.npmjs.org/@terra-money/feather.js/-/feather.js-2.0.0-beta.16.tgz",
+      "integrity": "sha512-VsIcHXft1T57HlWnyKfTIjylss15PZhMuIVjQ8hE7CJvI2p2/EEolGwLkOg/4EdzGJ2pSxGUGjvm97pGQAZERw==",
       "requires": {
         "@ethersproject/bytes": "^5.7.0",
         "@terra-money/legacy.proto": "npm:@terra-money/terra.proto@^0.1.7",
diff --git a/integration-tests/package.json b/integration-tests/package.json
index d2acc023..7242836b 100644
--- a/integration-tests/package.json
+++ b/integration-tests/package.json
@@ -35,7 +35,7 @@
     "typescript": "^5.2.2"
   },
   "dependencies": {
-    "@terra-money/feather.js": "^2.0.0-beta.14",
+    "@terra-money/feather.js": "^2.0.0-beta.16",
     "moment": "^2.29.4"
   }
 }
diff --git a/integration-tests/src/modules/pob/pob.test.ts b/integration-tests/src/modules/disabled.pob/pob.ts
similarity index 100%
rename from integration-tests/src/modules/pob/pob.test.ts
rename to integration-tests/src/modules/disabled.pob/pob.ts
diff --git a/integration-tests/src/modules/icq/icqv1.test.ts b/integration-tests/src/modules/icq/icqv1.test.ts
index ce8f9d3b..cedf0a25 100644
--- a/integration-tests/src/modules/icq/icqv1.test.ts
+++ b/integration-tests/src/modules/icq/icqv1.test.ts
@@ -171,7 +171,6 @@ describe("ICQ Module (https://github.com/cosmos/ibc-apps/tree/main/modules/async
                     "/osmosis.tokenfactory.v1beta1.Query/DenomAuthorityMetadata",
                     "/osmosis.tokenfactory.v1beta1.Query/DenomsFromCreator",
                     "/osmosis.tokenfactory.v1beta1.Query/Params",
-                    "/pob.builder.v1.Query/Params",
                     "/router.v1.Query/Params"
                 ]
             });
diff --git a/interchaintest/pob_test.go b/interchaintest/pob_test.go
deleted file mode 100644
index 0c036682..00000000
--- a/interchaintest/pob_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package interchaintest
-
-import (
-	"testing"
-
-	"github.com/strangelove-ventures/interchaintest/v7"
-
-	sdk "github.com/cosmos/cosmos-sdk/types"
-
-	"github.com/skip-mev/pob/tests/integration"
-	"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
-	"github.com/stretchr/testify/suite"
-)
-
-var (
-	numVals = 4
-	numFull = 0
-)
-
-func GetInterchainSpecForPOB() *interchaintest.ChainSpec {
-	// update the genesis kv for juno
-	updatedChainConfig := config
-	updatedChainConfig.ModifyGenesis = cosmos.ModifyGenesis(append(defaultGenesisKV, []cosmos.GenesisKV{
-		{
-			Key:   "app_state.builder.params.max_bundle_size",
-			Value: 3,
-		},
-		{
-			Key:   "app_state.builder.params.reserve_fee.denom",
-			Value: "uluna",
-		},
-		{
-			Key:   "app_state.builder.params.reserve_fee.amount",
-			Value: "1",
-		},
-		{
-			Key:   "app_state.builder.params.min_bid_increment.denom",
-			Value: "uluna",
-		},
-		{
-			Key:   "app_state.builder.params.min_bid_increment.amount",
-			Value: "1",
-		},
-	}...))
-
-	return &interchaintest.ChainSpec{
-		Name:          "terra",
-		ChainName:     "terra",
-		Version:       "latest",
-		ChainConfig:   updatedChainConfig,
-		NumValidators: &numVals,
-		NumFullNodes:  &numFull,
-	}
-
-}
-
-func TestPOB(t *testing.T) {
-	sdk.GetConfig().SetBech32PrefixForAccount("terra", "terra")
-	s := integration.NewPOBIntegrationTestSuiteFromSpec(GetInterchainSpecForPOB())
-	s.WithDenom("uluna")
-
-	suite.Run(t, s)
-}
diff --git a/scripts/protoc-swagger-gen.sh b/scripts/protoc-swagger-gen.sh
index 12c4cf8f..d7145376 100755
--- a/scripts/protoc-swagger-gen.sh
+++ b/scripts/protoc-swagger-gen.sh
@@ -20,14 +20,13 @@ icq_proto_dir=$(go list -f '{{ .Dir }}' -m github.com/cosmos/ibc-apps/modules/as
 wasm_dir=$(go list -f '{{ .Dir }}' -m github.com/CosmWasm/wasmd)
 google_api_dir=$(go list -f '{{ .Dir }}' -m github.com/grpc-ecosystem/grpc-gateway)
 cosmos_proto_dir=$(go list -f '{{ .Dir }}' -m github.com/cosmos/cosmos-proto)
-pob_proto_dir=$(go list -f '{{ .Dir }}' -m github.com/skip-mev/pob)
 
 # move the vendor folder back to ./vendor
 if [ -d $temp_dir ]; then
   mv ./$temp_dir ./vendor
 fi
 
-proto_dirs=$(find $icq_proto_dir/proto $cosmos_sdk_dir/proto $alliance_dir/proto $ibc_dir/proto $ibc_pfm/proto $wasm_dir/proto $cosmos_proto_dir/proto $pob_proto_dir/proto ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
+proto_dirs=$(find $icq_proto_dir/proto $cosmos_sdk_dir/proto $alliance_dir/proto $ibc_dir/proto $ibc_pfm/proto $wasm_dir/proto $cosmos_proto_dir/proto ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
 for dir in $proto_dirs; do
   # generate swagger files (filter query files)
   query_file=$(find "${dir}" -maxdepth 1 \( -name 'query.proto' -o -name 'service.proto' \))
@@ -45,7 +44,6 @@ for dir in $proto_dirs; do
     -I "$google_api_dir/third_party" \
     -I "$google_api_dir/third_party/googleapis" \
     -I "$cosmos_proto_dir/proto" \
-    -I "$pob_proto_dir/proto" \
     -I "$icq_proto_dir/proto" \
     -I "proto" \
       "$query_file" \

From 4af99916f98b227046570a17b055a25b4037516f Mon Sep 17 00:00:00 2001
From: emidev98 <emilian@terra.money>
Date: Mon, 18 Dec 2023 15:11:09 +0200
Subject: [PATCH 2/4] feat(v2.9): remove pob

---
 .github/workflows/interchaine2e.yml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.github/workflows/interchaine2e.yml b/.github/workflows/interchaine2e.yml
index 071c745f..1600802d 100644
--- a/.github/workflows/interchaine2e.yml
+++ b/.github/workflows/interchaine2e.yml
@@ -56,7 +56,6 @@ jobs:
       matrix:
         # names of `make` commands to run tests
         test:
-          - "test-e2e-pob"
           - "test-e2e-pmf"
       fail-fast: false
 

From 785ccfa4d54ff31b4b786b3758ad723e3ed89c48 Mon Sep 17 00:00:00 2001
From: emidev98 <emilian@terra.money>
Date: Tue, 19 Dec 2023 18:39:06 +0200
Subject: [PATCH 3/4] tests(v2.9): structure and renaming

---
 app/{app_test => test_helpers}/app_test.go    | 127 ++++++++++++------
 .../test_helpers.go                           |  77 +----------
 app/upgrade_handler.go                        |  37 ++---
 x/feeshare/keeper/genesis_test.go             |   4 +-
 x/feeshare/keeper/keeper_test.go              |   4 +-
 x/feeshare/post/post_test.go                  |   4 +-
 x/tokenfactory/client/cli/query_test.go       |   4 +-
 x/tokenfactory/keeper/keeper_test.go          |   4 +-
 8 files changed, 104 insertions(+), 157 deletions(-)
 rename app/{app_test => test_helpers}/app_test.go (76%)
 rename app/{app_test => test_helpers}/test_helpers.go (60%)

diff --git a/app/app_test/app_test.go b/app/test_helpers/app_test.go
similarity index 76%
rename from app/app_test/app_test.go
rename to app/test_helpers/app_test.go
index e6cf251a..e542c49c 100644
--- a/app/app_test/app_test.go
+++ b/app/test_helpers/app_test.go
@@ -1,9 +1,10 @@
-package app
+package test_helpers
 
 import (
 	"encoding/json"
 	"os"
 	"testing"
+	"time"
 
 	dbm "github.com/cometbft/cometbft-db"
 	abci "github.com/cometbft/cometbft/abci/types"
@@ -16,8 +17,11 @@ import (
 	"github.com/terra-money/core/v2/x/feeshare"
 	"github.com/terra-money/core/v2/x/tokenfactory"
 
+	codectypes "github.com/cosmos/cosmos-sdk/codec/types"
+	cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
 	mocktestutils "github.com/cosmos/cosmos-sdk/testutil/mock"
 	simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
+	stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
 
 	tmtypes "github.com/cometbft/cometbft/types"
 	"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
@@ -55,6 +59,7 @@ import (
 	"github.com/CosmWasm/wasmd/x/wasm"
 	wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
 	terra_app "github.com/terra-money/core/v2/app"
+	appparams "github.com/terra-money/core/v2/app/params"
 )
 
 var (
@@ -72,7 +77,7 @@ var (
 	addr4 = sdk.AccAddress(pk4.Address())
 )
 
-func TestSimAppExportAndBlockedAddrs(t *testing.T) {
+func (ats *AppTestSuite) TestSimAppExportAndBlockedAddrs(t *testing.T) {
 	encCfg := terra_app.MakeEncodingConfig()
 	db := dbm.NewMemDB()
 	app := terra_app.NewTerraApp(
@@ -208,50 +213,18 @@ func TestInitGenesisOnMigration(t *testing.T) {
 	})
 }
 
-func TestLegacyAmino(t *testing.T) {
-	encCfg := terra_app.MakeEncodingConfig()
-	db := dbm.NewMemDB()
-	app := terra_app.NewTerraApp(
-		log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
-		db, nil, true, map[int64]bool{}, terra_app.DefaultNodeHome, 0,
-		encCfg, simtestutil.EmptyAppOptions{}, wasmtypes.DefaultWasmConfig())
+func (ats *AppTestSuite) TestCodecs(t *testing.T) {
+	ats.Setup()
 
-	require.Equal(t, encCfg.Amino, app.LegacyAmino())
-}
-
-func TestAppCodec(t *testing.T) {
 	encCfg := terra_app.MakeEncodingConfig()
-	db := dbm.NewMemDB()
-	app := terra_app.NewTerraApp(
-		log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
-		db, nil, true, map[int64]bool{}, terra_app.DefaultNodeHome, 0,
-		encCfg, simtestutil.EmptyAppOptions{}, wasmtypes.DefaultWasmConfig())
 
-	require.Equal(t, encCfg.Marshaler, app.AppCodec())
-}
-
-func TestInterfaceRegistry(t *testing.T) {
-	encCfg := terra_app.MakeEncodingConfig()
-	db := dbm.NewMemDB()
-	app := terra_app.NewTerraApp(
-		log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
-		db, nil, true, map[int64]bool{}, terra_app.DefaultNodeHome, 0,
-		encCfg, simtestutil.EmptyAppOptions{}, wasmtypes.DefaultWasmConfig())
-
-	require.Equal(t, encCfg.InterfaceRegistry, app.InterfaceRegistry())
-}
-
-func TestGetKey(t *testing.T) {
-	encCfg := terra_app.MakeEncodingConfig()
-	db := dbm.NewMemDB()
-	app := terra_app.NewTerraApp(
-		log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
-		db, nil, true, map[int64]bool{}, terra_app.DefaultNodeHome, 0,
-		encCfg, simtestutil.EmptyAppOptions{}, wasmtypes.DefaultWasmConfig())
-
-	require.NotEmpty(t, app.GetKey(banktypes.StoreKey))
-	require.NotEmpty(t, app.GetTKey(paramstypes.TStoreKey))
-	require.NotEmpty(t, app.GetMemKey(capabilitytypes.MemStoreKey))
+	// Vlidate that the tests contain the correct encoding configuration
+	require.Equal(t, encCfg.Amino, ats.App.LegacyAmino())
+	require.Equal(t, encCfg.Marshaler, ats.App.AppCodec())
+	require.Equal(t, encCfg.InterfaceRegistry, ats.App.InterfaceRegistry())
+	require.NotEmpty(t, ats.App.GetKey(banktypes.StoreKey))
+	require.NotEmpty(t, ats.App.GetTKey(paramstypes.TStoreKey))
+	require.NotEmpty(t, ats.App.GetMemKey(capabilitytypes.MemStoreKey))
 }
 
 func TestSimAppEnforceStakingForVestingTokens(t *testing.T) {
@@ -324,3 +297,71 @@ func TestSimAppEnforceStakingForVestingTokens(t *testing.T) {
 		require.Equal(t, sdk.NewDec(3_500_001_000_000), share)
 	}
 }
+
+func SetupGenesisValSet(
+	valSet *tmtypes.ValidatorSet,
+	genAccs []authtypes.GenesisAccount,
+	opts []wasm.Option,
+	app *terra_app.TerraApp,
+	encCfg appparams.EncodingConfig,
+	balances ...banktypes.Balance,
+) terra_app.GenesisState {
+	genesisState := terra_app.NewDefaultGenesisState(encCfg.Marshaler)
+	// set genesis accounts
+	authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
+	genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis)
+
+	validators := make([]stakingtypes.Validator, 0, len(valSet.Validators))
+	delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators))
+
+	bondAmt := sdk.NewInt(1000000)
+	totalSupply := sdk.NewCoins()
+
+	for _, val := range valSet.Validators {
+		pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey)
+		if err != nil {
+			panic(err)
+		}
+
+		pkAny, err := codectypes.NewAnyWithValue(pk)
+		if err != nil {
+			panic(err)
+		}
+		validator := stakingtypes.Validator{
+			OperatorAddress:   sdk.ValAddress(val.Address).String(),
+			ConsensusPubkey:   pkAny,
+			Jailed:            false,
+			Status:            stakingtypes.Bonded,
+			Tokens:            bondAmt,
+			DelegatorShares:   sdk.OneDec(),
+			Description:       stakingtypes.Description{},
+			UnbondingHeight:   int64(0),
+			UnbondingTime:     time.Unix(0, 0).UTC(),
+			Commission:        stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
+			MinSelfDelegation: sdk.ZeroInt(),
+		}
+		validators = append(validators, validator)
+		delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec()))
+
+	}
+
+	// set validators and delegations
+	stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)
+	genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis)
+
+	// add bonded amount to bonded pool module account
+	balances = append(balances, banktypes.Balance{
+		Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(),
+		Coins:   sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)},
+	})
+
+	for _, b := range balances {
+		// add genesis acc tokens and delegated tokens to total supply
+		totalSupply = totalSupply.Add(b.Coins...)
+	}
+	// update total supply
+	bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{})
+	genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis)
+
+	return genesisState
+}
diff --git a/app/app_test/test_helpers.go b/app/test_helpers/test_helpers.go
similarity index 60%
rename from app/app_test/test_helpers.go
rename to app/test_helpers/test_helpers.go
index ad6ac4fe..5ed88461 100644
--- a/app/app_test/test_helpers.go
+++ b/app/test_helpers/test_helpers.go
@@ -1,18 +1,14 @@
-package app
-
-// DONTCOVER
+package test_helpers
 
 import (
 	"os"
 	"time"
 
-	"github.com/CosmWasm/wasmd/x/wasm"
 	wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
 	dbm "github.com/cometbft/cometbft-db"
 	"github.com/cometbft/cometbft/crypto/ed25519"
 	"github.com/cometbft/cometbft/libs/log"
 	tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
-	tmtypes "github.com/cometbft/cometbft/types"
 	"github.com/stretchr/testify/suite"
 	terra_app "github.com/terra-money/core/v2/app"
 	appparams "github.com/terra-money/core/v2/app/params"
@@ -20,15 +16,12 @@ import (
 	tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"
 
 	"github.com/cosmos/cosmos-sdk/baseapp"
-	codectypes "github.com/cosmos/cosmos-sdk/codec/types"
-	cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
 	simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
 	sdk "github.com/cosmos/cosmos-sdk/types"
 	authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
 	banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
 	distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
 	minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
-	stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
 )
 
 type AppTestSuite struct {
@@ -133,71 +126,3 @@ func (s *AppTestSuite) FundModule(moduleAccount string, amounts sdk.Coins) (err
 
 	return s.App.Keepers.BankKeeper.SendCoinsFromModuleToModule(s.Ctx, minttypes.ModuleName, moduleAccount, amounts)
 }
-
-func SetupGenesisValSet(
-	valSet *tmtypes.ValidatorSet,
-	genAccs []authtypes.GenesisAccount,
-	opts []wasm.Option,
-	app *terra_app.TerraApp,
-	encCfg appparams.EncodingConfig,
-	balances ...banktypes.Balance,
-) terra_app.GenesisState {
-	genesisState := terra_app.NewDefaultGenesisState(encCfg.Marshaler)
-	// set genesis accounts
-	authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
-	genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis)
-
-	validators := make([]stakingtypes.Validator, 0, len(valSet.Validators))
-	delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators))
-
-	bondAmt := sdk.NewInt(1000000)
-	totalSupply := sdk.NewCoins()
-
-	for _, val := range valSet.Validators {
-		pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey)
-		if err != nil {
-			panic(err)
-		}
-
-		pkAny, err := codectypes.NewAnyWithValue(pk)
-		if err != nil {
-			panic(err)
-		}
-		validator := stakingtypes.Validator{
-			OperatorAddress:   sdk.ValAddress(val.Address).String(),
-			ConsensusPubkey:   pkAny,
-			Jailed:            false,
-			Status:            stakingtypes.Bonded,
-			Tokens:            bondAmt,
-			DelegatorShares:   sdk.OneDec(),
-			Description:       stakingtypes.Description{},
-			UnbondingHeight:   int64(0),
-			UnbondingTime:     time.Unix(0, 0).UTC(),
-			Commission:        stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
-			MinSelfDelegation: sdk.ZeroInt(),
-		}
-		validators = append(validators, validator)
-		delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec()))
-
-	}
-
-	// set validators and delegations
-	stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)
-	genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis)
-
-	// add bonded amount to bonded pool module account
-	balances = append(balances, banktypes.Balance{
-		Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(),
-		Coins:   sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)},
-	})
-
-	for _, b := range balances {
-		// add genesis acc tokens and delegated tokens to total supply
-		totalSupply = totalSupply.Add(b.Coins...)
-	}
-	// update total supply
-	bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{})
-	genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis)
-
-	return genesisState
-}
diff --git a/app/upgrade_handler.go b/app/upgrade_handler.go
index 4316a58c..8686c53e 100644
--- a/app/upgrade_handler.go
+++ b/app/upgrade_handler.go
@@ -102,45 +102,26 @@ func (app *TerraApp) RegisterUpgradeStores() {
 	// Add stores for new modules
 	if upgradeInfo.Name == terraappconfig.Upgrade2_3_0 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
 		storeUpgrades := storetypes.StoreUpgrades{
-			Added: []string{
-				icacontrollertypes.StoreKey,
-				tokenfactorytypes.StoreKey,
-				ibcfeetypes.StoreKey,
-				ibchookstypes.StoreKey,
-				alliancetypes.StoreKey,
-			},
+			Added: []string{icacontrollertypes.StoreKey, tokenfactorytypes.StoreKey, ibcfeetypes.StoreKey, ibchookstypes.StoreKey, alliancetypes.StoreKey},
 		}
 		app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
 	} else if upgradeInfo.Name == terraappconfig.Upgrade2_5 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
 		storeUpgrades := storetypes.StoreUpgrades{
-			Added: []string{
-				consensusparamtypes.StoreKey,
-				crisistypes.StoreKey,
-				"builder",
-			},
-			Deleted: []string{
-				// Module intertx removed in v2.5 because it was never used
-				// (https://github.com/cosmos/interchain-accounts-demo)
-				// The same functionalities are availablein the interchain-accounts
-				// module commands available in scripts/tests/ica/delegate.sh
-				"intertx",
-			},
+			Added: []string{consensusparamtypes.StoreKey, crisistypes.StoreKey, "builder"},
+			// Module intertx removed in v2.5 because it was never used (https://github.com/cosmos/interchain-accounts-demo)
+			// The same functionalities are availablein the interchain-accounts under the path
+			// integration-tests/src/modules/ica/icav1.test.ts
+			Deleted: []string{"intertx"},
 		}
 		app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
 	} else if upgradeInfo.Name == terraappconfig.Upgrade2_6 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
-		storeUpgrades := storetypes.StoreUpgrades{
-			Added: []string{feesharetypes.StoreKey},
-		}
+		storeUpgrades := storetypes.StoreUpgrades{Added: []string{feesharetypes.StoreKey}}
 		app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
 	} else if upgradeInfo.Name == terraappconfig.Upgrade2_7 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
-		storeUpgrades := storetypes.StoreUpgrades{
-			Added: []string{icqtypes.StoreKey},
-		}
+		storeUpgrades := storetypes.StoreUpgrades{Added: []string{icqtypes.StoreKey}}
 		app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
 	} else if upgradeInfo.Name == terraappconfig.Upgrade2_9 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
-		storeUpgrades := storetypes.StoreUpgrades{
-			Deleted: []string{"builder"},
-		}
+		storeUpgrades := storetypes.StoreUpgrades{Deleted: []string{"builder"}}
 		app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
 	}
 }
diff --git a/x/feeshare/keeper/genesis_test.go b/x/feeshare/keeper/genesis_test.go
index b01c4f19..cb03d5c6 100644
--- a/x/feeshare/keeper/genesis_test.go
+++ b/x/feeshare/keeper/genesis_test.go
@@ -6,7 +6,7 @@ import (
 
 	"github.com/stretchr/testify/suite"
 
-	app_test "github.com/terra-money/core/v2/app/app_test"
+	"github.com/terra-money/core/v2/app/test_helpers"
 
 	sdk "github.com/cosmos/cosmos-sdk/types"
 
@@ -14,7 +14,7 @@ import (
 )
 
 type GenesisTestSuite struct {
-	app_test.AppTestSuite
+	test_helpers.AppTestSuite
 }
 
 func TestGenesisTestSuite(t *testing.T) {
diff --git a/x/feeshare/keeper/keeper_test.go b/x/feeshare/keeper/keeper_test.go
index 445f60a4..983223ed 100644
--- a/x/feeshare/keeper/keeper_test.go
+++ b/x/feeshare/keeper/keeper_test.go
@@ -7,7 +7,7 @@ import (
 
 	sdk "github.com/cosmos/cosmos-sdk/types"
 
-	app "github.com/terra-money/core/v2/app/app_test"
+	"github.com/terra-money/core/v2/app/test_helpers"
 	"github.com/terra-money/core/v2/x/feeshare/types"
 )
 
@@ -21,7 +21,7 @@ type BankKeeper interface {
 }
 
 type IntegrationTestSuite struct {
-	app.AppTestSuite
+	test_helpers.AppTestSuite
 
 	queryClient types.QueryClient
 }
diff --git a/x/feeshare/post/post_test.go b/x/feeshare/post/post_test.go
index 40857834..065c457e 100644
--- a/x/feeshare/post/post_test.go
+++ b/x/feeshare/post/post_test.go
@@ -12,15 +12,15 @@ import (
 
 	wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
 	abci "github.com/cometbft/cometbft/abci/types"
-	app "github.com/terra-money/core/v2/app/app_test"
 	"github.com/terra-money/core/v2/app/post/mocks"
+	"github.com/terra-money/core/v2/app/test_helpers"
 	post "github.com/terra-money/core/v2/x/feeshare/post"
 	"github.com/terra-money/core/v2/x/feeshare/types"
 	customwasmtypes "github.com/terra-money/core/v2/x/wasm/types"
 )
 
 type AnteTestSuite struct {
-	app.AppTestSuite
+	test_helpers.AppTestSuite
 }
 
 func TestAnteSuite(t *testing.T) {
diff --git a/x/tokenfactory/client/cli/query_test.go b/x/tokenfactory/client/cli/query_test.go
index 383de399..b6c6c822 100644
--- a/x/tokenfactory/client/cli/query_test.go
+++ b/x/tokenfactory/client/cli/query_test.go
@@ -7,15 +7,15 @@ import (
 	"cosmossdk.io/math"
 	"github.com/stretchr/testify/suite"
 
-	app "github.com/terra-money/core/v2/app/app_test"
 	"github.com/terra-money/core/v2/app/config"
+	"github.com/terra-money/core/v2/app/test_helpers"
 	"github.com/terra-money/core/v2/x/tokenfactory/types"
 
 	sdk "github.com/cosmos/cosmos-sdk/types"
 )
 
 type QueryTestSuite struct {
-	app.AppTestSuite
+	test_helpers.AppTestSuite
 }
 
 func (s *QueryTestSuite) TestQueriesNeverAlterState() {
diff --git a/x/tokenfactory/keeper/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go
index 8209de66..d7e6fc30 100644
--- a/x/tokenfactory/keeper/keeper_test.go
+++ b/x/tokenfactory/keeper/keeper_test.go
@@ -13,13 +13,13 @@ import (
 	bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
 	banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
 
-	app "github.com/terra-money/core/v2/app/app_test"
+	"github.com/terra-money/core/v2/app/test_helpers"
 	"github.com/terra-money/core/v2/x/tokenfactory/keeper"
 	"github.com/terra-money/core/v2/x/tokenfactory/types"
 )
 
 type KeeperTestSuite struct {
-	app.AppTestSuite
+	test_helpers.AppTestSuite
 
 	queryClient    types.QueryClient
 	msgServer      types.MsgServer

From f22348df0828b5c31f7373cb34718f37c4f1e549 Mon Sep 17 00:00:00 2001
From: emidev98 <emilian@terra.money>
Date: Thu, 21 Dec 2023 15:26:59 +0200
Subject: [PATCH 4/4] tests(v2.9): improve coverage and redeability

---
 app/app.go                       |  11 +-
 app/encoding_test.go             |  29 +++
 app/genesis_test.go              | 260 +++++++++++++++++++++-
 app/test_helpers/app_test.go     | 367 -------------------------------
 app/test_helpers/test_helpers.go |   2 +
 5 files changed, 295 insertions(+), 374 deletions(-)
 create mode 100644 app/encoding_test.go
 delete mode 100644 app/test_helpers/app_test.go

diff --git a/app/app.go b/app/app.go
index 359f2d19..cfb6c7e2 100644
--- a/app/app.go
+++ b/app/app.go
@@ -2,6 +2,7 @@ package app
 
 import (
 	"encoding/json"
+	"fmt"
 	"io"
 	"net/http"
 	"os"
@@ -47,7 +48,7 @@ import (
 	cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante"
 	authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
 	authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
-	vestingexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
+	vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
 	authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
 	banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
 	"github.com/cosmos/cosmos-sdk/x/capability"
@@ -470,8 +471,10 @@ func (app *TerraApp) enforceStakingForVestingTokens(ctx sdk.Context, genesisStat
 			panic(err)
 		}
 
-		if vestingAcc, ok := account.(vestingexported.VestingAccount); ok {
-			amt := vestingAcc.GetOriginalVesting().AmountOf(app.Keepers.StakingKeeper.BondDenom(ctx))
+		bondDenom := app.Keepers.StakingKeeper.BondDenom(ctx)
+
+		if vestingAcc, ok := account.(*vestingtypes.BaseVestingAccount); ok {
+			amt := vestingAcc.GetOriginalVesting().AmountOf(bondDenom)
 
 			// to prevent staking multiple times over the same validator
 			// adjust split amount for the whale account
@@ -488,6 +491,8 @@ func (app *TerraApp) enforceStakingForVestingTokens(ctx sdk.Context, genesisStat
 			// stake 200_000_000_000 to val3
 			for ; amt.GTE(powerReduction); amt = amt.Sub(splitAmt) {
 				validator := validators[i%validatorLen]
+				address := vestingAcc.GetAddress().String()
+				fmt.Print(address)
 				if _, err := app.Keepers.StakingKeeper.Delegate(
 					ctx,
 					vestingAcc.GetAddress(),
diff --git a/app/encoding_test.go b/app/encoding_test.go
new file mode 100644
index 00000000..092ff63e
--- /dev/null
+++ b/app/encoding_test.go
@@ -0,0 +1,29 @@
+package app_test
+
+import (
+	banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
+	capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
+	paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
+	"github.com/terra-money/core/v2/app"
+	"github.com/terra-money/core/v2/app/test_helpers"
+)
+
+type AppCodecsTestSuite struct {
+	test_helpers.AppTestSuite
+}
+
+func (acts *AppCodecsTestSuite) TestCodecs() {
+	// Setting up the app
+	acts.Setup()
+
+	// generating the encoding config to assert agains
+	encCfg := app.MakeEncodingConfig()
+
+	// Validate the encoding config have been configured as expected for the App
+	acts.Require().Equal(encCfg.Amino, acts.App.LegacyAmino())
+	acts.Require().Equal(encCfg.Marshaler, acts.App.AppCodec())
+	acts.Require().Equal(encCfg.InterfaceRegistry, acts.App.InterfaceRegistry())
+	acts.Require().NotEmpty(acts.App.GetKey(banktypes.StoreKey))
+	acts.Require().NotEmpty(acts.App.GetTKey(paramstypes.TStoreKey))
+	acts.Require().NotEmpty(acts.App.GetMemKey(capabilitytypes.MemStoreKey))
+}
diff --git a/app/genesis_test.go b/app/genesis_test.go
index 8567433e..9ec8bc3a 100644
--- a/app/genesis_test.go
+++ b/app/genesis_test.go
@@ -2,19 +2,271 @@ package app_test
 
 import (
 	"encoding/json"
+	"os"
 	"testing"
+	"time"
 
-	"github.com/stretchr/testify/require"
+	cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
+
+	abci "github.com/cometbft/cometbft/abci/types"
+	"github.com/cometbft/cometbft/libs/log"
+	codectypes "github.com/cosmos/cosmos-sdk/codec/types"
+	"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
+	"github.com/terra-money/core/v2/app/test_helpers"
+
+	ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee"
+	"github.com/golang/mock/gomock"
+	"github.com/stretchr/testify/suite"
+	"github.com/terra-money/alliance/x/alliance"
 	"github.com/terra-money/core/v2/app"
+	"github.com/terra-money/core/v2/x/feeshare"
+	"github.com/terra-money/core/v2/x/tokenfactory"
+
+	mocktestutils "github.com/cosmos/cosmos-sdk/testutil/mock"
+	simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
+	sdk "github.com/cosmos/cosmos-sdk/types"
+
+	"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
+	icq "github.com/cosmos/ibc-apps/modules/async-icq/v7"
+	ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7"
+	ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
+	"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
+	ibc "github.com/cosmos/ibc-go/v7/modules/core"
+
+	"github.com/cosmos/cosmos-sdk/types/module"
+	"github.com/cosmos/cosmos-sdk/x/auth"
+	"github.com/cosmos/cosmos-sdk/x/auth/vesting"
+	vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
+	authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
+	"github.com/cosmos/cosmos-sdk/x/bank"
+	"github.com/cosmos/cosmos-sdk/x/capability"
+	"github.com/cosmos/cosmos-sdk/x/crisis"
+	"github.com/cosmos/cosmos-sdk/x/distribution"
+	"github.com/cosmos/cosmos-sdk/x/evidence"
+	feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
+	"github.com/cosmos/cosmos-sdk/x/genutil"
+	"github.com/cosmos/cosmos-sdk/x/gov"
+	"github.com/cosmos/cosmos-sdk/x/mint"
+	"github.com/cosmos/cosmos-sdk/x/params"
+	"github.com/cosmos/cosmos-sdk/x/slashing"
+	"github.com/cosmos/cosmos-sdk/x/staking"
+	"github.com/cosmos/cosmos-sdk/x/upgrade"
+
+	"github.com/CosmWasm/wasmd/x/wasm"
+	wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
+	tmtypes "github.com/cometbft/cometbft/types"
+	authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
+	banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
+	stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
 )
 
-func TestGenesis(t *testing.T) {
+type AppGenesisTestSuite struct {
+	test_helpers.AppTestSuite
+}
+
+func TestAnteSuite(t *testing.T) {
+	suite.Run(t, new(AppGenesisTestSuite))
+}
+
+func (s *AppGenesisTestSuite) TestExportImportStateWithGenesisVestingAccs() {
+	// Setup the test suite
+	s.Setup()
+	bondAmt := sdk.NewInt(100_000_000_000_000_000)
+	coin := sdk.NewCoin("stake", bondAmt)
+
+	// Generate a random validators private/public key
+	privVal := mocktestutils.NewPV()
+	pubKey, err := privVal.GetPubKey()
+	s.Require().NoError(err)
+	privVal1 := mocktestutils.NewPV()
+	pubKey1, err := privVal1.GetPubKey()
+	s.Require().NoError(err)
+
+	// create validator set with single validator
+	valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{
+		tmtypes.NewValidator(pubKey, 1),
+		tmtypes.NewValidator(pubKey1, 1),
+	})
+	senderPrivKey := secp256k1.GenPrivKey()
+	senderPrivKey1 := secp256k1.GenPrivKey()
+	acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0)
+	acc1 := authtypes.NewBaseAccount(senderPrivKey1.PubKey().Address().Bytes(), senderPrivKey1.PubKey(), 0, 0)
+	vestingAcc := vestingtypes.NewBaseVestingAccount(acc, sdk.NewCoins(coin), time.Now().Unix())
+	vestingAcc1 := vestingtypes.NewBaseVestingAccount(acc1, sdk.NewCoins(coin), time.Now().Unix())
+
+	// Get genesis state and setup the chain
+	genesisState := app.NewDefaultGenesisState(s.EncodingConfig.Marshaler)
+	genesisState.SetDefaultTerraConfig(s.EncodingConfig.Marshaler)
+	genesisAccs := authtypes.NewGenesisState(authtypes.DefaultParams(), []authtypes.GenesisAccount{vestingAcc, vestingAcc1})
+	genesisState[authtypes.ModuleName] = s.EncodingConfig.Marshaler.MustMarshalJSON(genesisAccs)
+
+	validators := make([]stakingtypes.Validator, 0, len(valSet.Validators))
+	delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators))
+
+	for _, val := range valSet.Validators {
+		pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey)
+		s.Require().NoError(err)
+		pkAny, err := codectypes.NewAnyWithValue(pk)
+		s.Require().NoError(err)
+
+		validator := stakingtypes.Validator{
+			OperatorAddress:   sdk.ValAddress(val.Address).String(),
+			ConsensusPubkey:   pkAny,
+			Jailed:            false,
+			Status:            stakingtypes.Bonded,
+			Tokens:            bondAmt,
+			DelegatorShares:   sdk.OneDec(),
+			Description:       stakingtypes.Description{},
+			UnbondingHeight:   int64(0),
+			UnbondingTime:     time.Unix(0, 0).UTC(),
+			Commission:        stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
+			MinSelfDelegation: sdk.ZeroInt(),
+		}
+		validators = append(validators, validator)
+	}
+	delegations = append(delegations, stakingtypes.NewDelegation(vestingAcc.GetAddress(), valSet.Validators[0].Address.Bytes(), sdk.OneDec()))
+	delegations = append(delegations, stakingtypes.NewDelegation(vestingAcc1.GetAddress(), valSet.Validators[1].Address.Bytes(), sdk.OneDec()))
+
+	// set validators and delegations
+	stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)
+	genesisState[stakingtypes.ModuleName] = s.App.AppCodec().MustMarshalJSON(stakingGenesis)
+
+	// add bonded amount to bonded pool module account
+	balances := []banktypes.Balance{
+		{Address: vestingAcc.GetAddress().String(), Coins: sdk.NewCoins(coin)},
+		{Address: vestingAcc1.GetAddress().String(), Coins: sdk.NewCoins(coin)},
+		{
+			Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(),
+			Coins:   sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(200_000_000_000_000_000))},
+		}}
+
+	// update total supply
+	bankGenesis := banktypes.NewGenesisState(
+		banktypes.DefaultGenesisState().Params,
+		balances,
+		sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(400000000000000000))),
+		[]banktypes.Metadata{},
+		[]banktypes.SendEnabled{},
+	)
+	genesisState[banktypes.ModuleName] = s.App.AppCodec().MustMarshalJSON(bankGenesis)
+
+	stateBytes, err := json.MarshalIndent(genesisState, "", "  ")
+	s.Require().NoError(err)
+
+	// Initialize the chain
+	s.App.InitChain(
+		abci.RequestInitChain{
+			Validators:    []abci.ValidatorUpdate{},
+			AppStateBytes: stateBytes,
+		},
+	)
+	s.App.Commit()
+
+	// Making a new app object with the db, so that initchain hasn't been called
+	app2 := app.NewTerraApp(
+		log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
+		s.DB,
+		nil,
+		true,
+		map[int64]bool{},
+		app.DefaultNodeHome,
+		0,
+		app.MakeEncodingConfig(),
+		simtestutil.EmptyAppOptions{},
+		wasmtypes.DefaultWasmConfig())
+	_, err = app2.ExportAppStateAndValidators(false, []string{}, []string{})
+	s.Require().NoError(err, "ExportAppStateAndValidators should not have an error")
+}
+
+func (s *AppGenesisTestSuite) TestMigration() {
+	s.Setup()
+
+	// Create a mock module. This module will serve as the new module we're
+	// adding during a migration.
+	mockCtrl := gomock.NewController(s.T())
+	s.T().Cleanup(mockCtrl.Finish)
+	mockModule := mocktestutils.NewMockAppModuleWithAllExtensions(mockCtrl)
+	mockDefaultGenesis := json.RawMessage(`{"key": "value"}`)
+	mockModule.EXPECT().DefaultGenesis(gomock.Eq(s.App.AppCodec())).Times(1).Return(mockDefaultGenesis)
+	mockModule.EXPECT().InitGenesis(gomock.Eq(s.Ctx), gomock.Eq(s.App.AppCodec()), gomock.Eq(mockDefaultGenesis)).Times(1).Return(nil)
+	mockModule.EXPECT().ConsensusVersion().Times(1).Return(uint64(0))
+
+	s.App.GetModuleManager().Modules["mock"] = mockModule
+
+	// Run migrations only for "mock" module. We exclude it from
+	// the VersionMap to simulate upgrading with a new module.
+	res, err := s.App.GetModuleManager().RunMigrations(s.Ctx, s.App.GetConfigurator(),
+		module.VersionMap{
+			"alliance":               alliance.AppModule{}.ConsensusVersion(),
+			"auth":                   auth.AppModule{}.ConsensusVersion(),
+			"authz":                  authzmodule.AppModule{}.ConsensusVersion(),
+			"bank":                   bank.AppModule{}.ConsensusVersion(),
+			"capability":             capability.AppModule{}.ConsensusVersion(),
+			"crisis":                 crisis.AppModule{}.ConsensusVersion(),
+			"distribution":           distribution.AppModule{}.ConsensusVersion(),
+			"evidence":               evidence.AppModule{}.ConsensusVersion(),
+			"feegrant":               feegrantmodule.AppModule{}.ConsensusVersion(),
+			"feeshare":               feeshare.AppModule{}.ConsensusVersion(),
+			"feeibc":                 ibcfee.AppModule{}.ConsensusVersion(),
+			"genutil":                genutil.AppModule{}.ConsensusVersion(),
+			"gov":                    gov.AppModule{}.ConsensusVersion(),
+			"ibc":                    ibc.AppModule{}.ConsensusVersion(),
+			"interchainquery":        icq.AppModule{}.ConsensusVersion(),
+			"ibchooks":               ibchooks.AppModule{}.ConsensusVersion(),
+			"interchainaccounts":     ica.AppModule{}.ConsensusVersion(),
+			"mint":                   mint.AppModule{}.ConsensusVersion(),
+			"packetfowardmiddleware": router.AppModule{}.ConsensusVersion(),
+			"params":                 params.AppModule{}.ConsensusVersion(),
+			"slashing":               slashing.AppModule{}.ConsensusVersion(),
+			"staking":                staking.AppModule{}.ConsensusVersion(),
+			"tokenfactory":           tokenfactory.AppModule{}.ConsensusVersion(),
+			"transfer":               transfer.AppModule{}.ConsensusVersion(),
+			"upgrade":                upgrade.AppModule{}.ConsensusVersion(),
+			"vesting":                vesting.AppModule{}.ConsensusVersion(),
+			"wasm":                   wasm.AppModule{}.ConsensusVersion(),
+		},
+	)
+	s.Require().NoError(err)
+	s.Require().Equal(res, module.VersionMap{
+		"alliance":               5,
+		"auth":                   4,
+		"authz":                  2,
+		"bank":                   4,
+		"capability":             1,
+		"consensus":              1,
+		"crisis":                 2,
+		"distribution":           3,
+		"evidence":               1,
+		"feegrant":               2,
+		"feeshare":               2,
+		"feeibc":                 1,
+		"genutil":                1,
+		"gov":                    4,
+		"ibc":                    4,
+		"ibchooks":               1,
+		"interchainaccounts":     2,
+		"interchainquery":        1,
+		"mint":                   2,
+		"mock":                   0,
+		"packetfowardmiddleware": 1,
+		"params":                 1,
+		"slashing":               3,
+		"staking":                4,
+		"tokenfactory":           3,
+		"transfer":               3,
+		"upgrade":                2,
+		"vesting":                1,
+		"wasm":                   4,
+	})
+}
+
+func (s *AppGenesisTestSuite) TestGenesis() {
 	encCfg := app.MakeEncodingConfig()
 	genesisState := app.NewDefaultGenesisState(encCfg.Marshaler)
 	genesisState.SetDefaultTerraConfig(encCfg.Marshaler)
 
 	jsonGenState, err := json.Marshal(genesisState)
-	require.Nil(t, err)
+	s.Require().NoError(err)
 
 	expectedState := `{
 		"06-solomachine": null,
@@ -469,5 +721,5 @@ func TestGenesis(t *testing.T) {
 			"sequences": []
 		}
 	}`
-	require.JSONEq(t, string(jsonGenState), expectedState)
+	s.Require().JSONEq(string(jsonGenState), expectedState)
 }
diff --git a/app/test_helpers/app_test.go b/app/test_helpers/app_test.go
deleted file mode 100644
index e542c49c..00000000
--- a/app/test_helpers/app_test.go
+++ /dev/null
@@ -1,367 +0,0 @@
-package test_helpers
-
-import (
-	"encoding/json"
-	"os"
-	"testing"
-	"time"
-
-	dbm "github.com/cometbft/cometbft-db"
-	abci "github.com/cometbft/cometbft/abci/types"
-	"github.com/cometbft/cometbft/libs/log"
-	tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
-	ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee"
-	"github.com/golang/mock/gomock"
-	"github.com/stretchr/testify/require"
-	"github.com/terra-money/alliance/x/alliance"
-	"github.com/terra-money/core/v2/x/feeshare"
-	"github.com/terra-money/core/v2/x/tokenfactory"
-
-	codectypes "github.com/cosmos/cosmos-sdk/codec/types"
-	cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
-	mocktestutils "github.com/cosmos/cosmos-sdk/testutil/mock"
-	simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
-	stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
-
-	tmtypes "github.com/cometbft/cometbft/types"
-	"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
-	icq "github.com/cosmos/ibc-apps/modules/async-icq/v7"
-	ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7"
-	ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
-	"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
-	ibc "github.com/cosmos/ibc-go/v7/modules/core"
-
-	"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
-	sdk "github.com/cosmos/cosmos-sdk/types"
-	"github.com/cosmos/cosmos-sdk/types/module"
-	"github.com/cosmos/cosmos-sdk/x/auth"
-	authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
-	"github.com/cosmos/cosmos-sdk/x/auth/vesting"
-	vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
-	authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
-	"github.com/cosmos/cosmos-sdk/x/bank"
-	banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
-	"github.com/cosmos/cosmos-sdk/x/capability"
-	capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
-	"github.com/cosmos/cosmos-sdk/x/crisis"
-	"github.com/cosmos/cosmos-sdk/x/distribution"
-	"github.com/cosmos/cosmos-sdk/x/evidence"
-	feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
-	"github.com/cosmos/cosmos-sdk/x/genutil"
-	"github.com/cosmos/cosmos-sdk/x/gov"
-	"github.com/cosmos/cosmos-sdk/x/mint"
-	"github.com/cosmos/cosmos-sdk/x/params"
-	paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
-	"github.com/cosmos/cosmos-sdk/x/slashing"
-	"github.com/cosmos/cosmos-sdk/x/staking"
-	"github.com/cosmos/cosmos-sdk/x/upgrade"
-
-	"github.com/CosmWasm/wasmd/x/wasm"
-	wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
-	terra_app "github.com/terra-money/core/v2/app"
-	appparams "github.com/terra-money/core/v2/app/params"
-)
-
-var (
-	priv1 = secp256k1.GenPrivKey()
-	priv2 = secp256k1.GenPrivKey()
-	priv3 = secp256k1.GenPrivKey()
-	priv4 = secp256k1.GenPrivKey()
-	pk1   = priv1.PubKey()
-	pk2   = priv2.PubKey()
-	pk3   = priv3.PubKey()
-	pk4   = priv4.PubKey()
-	addr1 = sdk.AccAddress(pk1.Address())
-	addr2 = sdk.AccAddress(pk2.Address())
-	addr3 = sdk.AccAddress(pk3.Address())
-	addr4 = sdk.AccAddress(pk4.Address())
-)
-
-func (ats *AppTestSuite) TestSimAppExportAndBlockedAddrs(t *testing.T) {
-	encCfg := terra_app.MakeEncodingConfig()
-	db := dbm.NewMemDB()
-	app := terra_app.NewTerraApp(
-		log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
-		db, nil, true, map[int64]bool{}, terra_app.DefaultNodeHome, 0, encCfg,
-		simtestutil.EmptyAppOptions{}, wasmtypes.DefaultWasmConfig())
-
-	// generate validator private/public key
-	privVal := mocktestutils.NewPV()
-	pubKey, err := privVal.GetPubKey()
-	require.NoError(t, err)
-
-	// create validator set with single validator
-	validator := tmtypes.NewValidator(pubKey, 1)
-	valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator})
-
-	// generate genesis account
-	senderPrivKey := secp256k1.GenPrivKey()
-	acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0)
-	balance := banktypes.Balance{
-		Address: acc.GetAddress().String(),
-		Coins:   sdk.NewCoins(),
-	}
-
-	genesisState := SetupGenesisValSet(valSet, []authtypes.GenesisAccount{acc}, nil, app, encCfg, balance)
-	stateBytes, err := json.MarshalIndent(genesisState, "", "  ")
-	require.NoError(t, err)
-
-	// Initialize the chain
-	app.InitChain(
-		abci.RequestInitChain{
-			Validators:    []abci.ValidatorUpdate{},
-			AppStateBytes: stateBytes,
-		},
-	)
-	app.Commit()
-
-	// Making a new app object with the db, so that initchain hasn't been called
-	app2 := terra_app.NewTerraApp(
-		log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
-		db, nil, true, map[int64]bool{}, terra_app.DefaultNodeHome, 0,
-		encCfg, simtestutil.EmptyAppOptions{}, wasmtypes.DefaultWasmConfig())
-	_, err = app2.ExportAppStateAndValidators(false, []string{}, []string{})
-	require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
-}
-
-func TestInitGenesisOnMigration(t *testing.T) {
-	db := dbm.NewMemDB()
-	encCfg := terra_app.MakeEncodingConfig()
-	logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
-	app := terra_app.NewTerraApp(
-		logger, db, nil, true, map[int64]bool{},
-		terra_app.DefaultNodeHome, 0, encCfg, simtestutil.EmptyAppOptions{}, wasmtypes.DefaultWasmConfig())
-
-	ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})
-
-	// Create a mock module. This module will serve as the new module we're
-	// adding during a migration.
-	mockCtrl := gomock.NewController(t)
-	t.Cleanup(mockCtrl.Finish)
-	mockModule := mocktestutils.NewMockAppModuleWithAllExtensions(mockCtrl)
-	mockDefaultGenesis := json.RawMessage(`{"key": "value"}`)
-	mockModule.EXPECT().DefaultGenesis(gomock.Eq(app.AppCodec())).Times(1).Return(mockDefaultGenesis)
-	mockModule.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(app.AppCodec()), gomock.Eq(mockDefaultGenesis)).Times(1).Return(nil)
-	mockModule.EXPECT().ConsensusVersion().Times(1).Return(uint64(0))
-
-	app.GetModuleManager().Modules["mock"] = mockModule
-
-	// Run migrations only for "mock" module. We exclude it from
-	// the VersionMap to simulate upgrading with a new module.
-	res, err := app.GetModuleManager().RunMigrations(ctx, app.GetConfigurator(),
-		module.VersionMap{
-			"alliance":               alliance.AppModule{}.ConsensusVersion(),
-			"auth":                   auth.AppModule{}.ConsensusVersion(),
-			"authz":                  authzmodule.AppModule{}.ConsensusVersion(),
-			"bank":                   bank.AppModule{}.ConsensusVersion(),
-			"capability":             capability.AppModule{}.ConsensusVersion(),
-			"crisis":                 crisis.AppModule{}.ConsensusVersion(),
-			"distribution":           distribution.AppModule{}.ConsensusVersion(),
-			"evidence":               evidence.AppModule{}.ConsensusVersion(),
-			"feegrant":               feegrantmodule.AppModule{}.ConsensusVersion(),
-			"feeshare":               feeshare.AppModule{}.ConsensusVersion(),
-			"feeibc":                 ibcfee.AppModule{}.ConsensusVersion(),
-			"genutil":                genutil.AppModule{}.ConsensusVersion(),
-			"gov":                    gov.AppModule{}.ConsensusVersion(),
-			"ibc":                    ibc.AppModule{}.ConsensusVersion(),
-			"interchainquery":        icq.AppModule{}.ConsensusVersion(),
-			"ibchooks":               ibchooks.AppModule{}.ConsensusVersion(),
-			"interchainaccounts":     ica.AppModule{}.ConsensusVersion(),
-			"mint":                   mint.AppModule{}.ConsensusVersion(),
-			"packetfowardmiddleware": router.AppModule{}.ConsensusVersion(),
-			"params":                 params.AppModule{}.ConsensusVersion(),
-			"slashing":               slashing.AppModule{}.ConsensusVersion(),
-			"staking":                staking.AppModule{}.ConsensusVersion(),
-			"tokenfactory":           tokenfactory.AppModule{}.ConsensusVersion(),
-			"transfer":               transfer.AppModule{}.ConsensusVersion(),
-			"upgrade":                upgrade.AppModule{}.ConsensusVersion(),
-			"vesting":                vesting.AppModule{}.ConsensusVersion(),
-			"wasm":                   wasm.AppModule{}.ConsensusVersion(),
-		},
-	)
-	require.NoError(t, err)
-	require.Equal(t, res, module.VersionMap{
-		"alliance":               5,
-		"auth":                   4,
-		"authz":                  2,
-		"bank":                   4,
-		"capability":             1,
-		"consensus":              1,
-		"crisis":                 2,
-		"distribution":           3,
-		"evidence":               1,
-		"feegrant":               2,
-		"feeshare":               2,
-		"feeibc":                 1,
-		"genutil":                1,
-		"gov":                    4,
-		"ibc":                    4,
-		"ibchooks":               1,
-		"interchainaccounts":     2,
-		"interchainquery":        1,
-		"mint":                   2,
-		"mock":                   0,
-		"packetfowardmiddleware": 1,
-		"params":                 1,
-		"slashing":               3,
-		"staking":                4,
-		"tokenfactory":           3,
-		"transfer":               3,
-		"upgrade":                2,
-		"vesting":                1,
-		"wasm":                   4,
-	})
-}
-
-func (ats *AppTestSuite) TestCodecs(t *testing.T) {
-	ats.Setup()
-
-	encCfg := terra_app.MakeEncodingConfig()
-
-	// Vlidate that the tests contain the correct encoding configuration
-	require.Equal(t, encCfg.Amino, ats.App.LegacyAmino())
-	require.Equal(t, encCfg.Marshaler, ats.App.AppCodec())
-	require.Equal(t, encCfg.InterfaceRegistry, ats.App.InterfaceRegistry())
-	require.NotEmpty(t, ats.App.GetKey(banktypes.StoreKey))
-	require.NotEmpty(t, ats.App.GetTKey(paramstypes.TStoreKey))
-	require.NotEmpty(t, ats.App.GetMemKey(capabilitytypes.MemStoreKey))
-}
-
-func TestSimAppEnforceStakingForVestingTokens(t *testing.T) {
-	encCfg := terra_app.MakeEncodingConfig()
-	db := dbm.NewMemDB()
-	app := terra_app.NewTerraApp(
-		log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
-		db, nil, true, map[int64]bool{}, terra_app.DefaultNodeHome, 0, encCfg,
-		simtestutil.EmptyAppOptions{}, wasmtypes.DefaultWasmConfig(),
-	)
-	genAccounts := authtypes.GenesisAccounts{
-		vestingtypes.NewContinuousVestingAccount(
-			authtypes.NewBaseAccountWithAddress(addr1),
-			sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(2_500_000_000_000))),
-			1660000000,
-			1670000000,
-		),
-		vestingtypes.NewContinuousVestingAccount(
-			authtypes.NewBaseAccountWithAddress(addr2),
-			sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(4_500_000_000_000))),
-			1660000000,
-			1670000000,
-		),
-		authtypes.NewBaseAccountWithAddress(addr3),
-		authtypes.NewBaseAccountWithAddress(addr4),
-	}
-	balances := []banktypes.Balance{
-		{
-			Address: addr1.String(),
-			Coins:   sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(2_500_000_000_000))),
-		},
-		{
-			Address: addr2.String(),
-			Coins:   sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(4_500_000_000_000))),
-		},
-		{
-			Address: addr3.String(),
-			Coins:   sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1_000_000))),
-		},
-		{
-			Address: addr4.String(),
-			Coins:   sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1_000_000))),
-		},
-	}
-
-	// generate validator private/public key
-	privVal := mocktestutils.NewPV()
-	pubKey, err := privVal.GetPubKey()
-	require.NoError(t, err, "PubKey should not have an error")
-	validator := tmtypes.NewValidator(pubKey, 1)
-	valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator})
-
-	genesisState := SetupGenesisValSet(valSet, genAccounts, nil, app, encCfg, balances...)
-	ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})
-
-	genesisState[authtypes.ModuleName] = app.GetAppCodec().MustMarshalJSON(authtypes.NewGenesisState(authtypes.DefaultParams(), genAccounts))
-	delegations := app.Keepers.StakingKeeper.GetAllDelegations(ctx)
-	sharePerValidators := make(map[string]sdk.Dec)
-
-	for _, del := range delegations {
-		if val, found := sharePerValidators[del.ValidatorAddress]; !found {
-			sharePerValidators[del.ValidatorAddress] = del.GetShares()
-		} else {
-			sharePerValidators[del.ValidatorAddress] = val.Add(del.GetShares())
-		}
-	}
-
-	/* #nosec */
-	for _, share := range sharePerValidators {
-		require.Equal(t, sdk.NewDec(3_500_001_000_000), share)
-	}
-}
-
-func SetupGenesisValSet(
-	valSet *tmtypes.ValidatorSet,
-	genAccs []authtypes.GenesisAccount,
-	opts []wasm.Option,
-	app *terra_app.TerraApp,
-	encCfg appparams.EncodingConfig,
-	balances ...banktypes.Balance,
-) terra_app.GenesisState {
-	genesisState := terra_app.NewDefaultGenesisState(encCfg.Marshaler)
-	// set genesis accounts
-	authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
-	genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis)
-
-	validators := make([]stakingtypes.Validator, 0, len(valSet.Validators))
-	delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators))
-
-	bondAmt := sdk.NewInt(1000000)
-	totalSupply := sdk.NewCoins()
-
-	for _, val := range valSet.Validators {
-		pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey)
-		if err != nil {
-			panic(err)
-		}
-
-		pkAny, err := codectypes.NewAnyWithValue(pk)
-		if err != nil {
-			panic(err)
-		}
-		validator := stakingtypes.Validator{
-			OperatorAddress:   sdk.ValAddress(val.Address).String(),
-			ConsensusPubkey:   pkAny,
-			Jailed:            false,
-			Status:            stakingtypes.Bonded,
-			Tokens:            bondAmt,
-			DelegatorShares:   sdk.OneDec(),
-			Description:       stakingtypes.Description{},
-			UnbondingHeight:   int64(0),
-			UnbondingTime:     time.Unix(0, 0).UTC(),
-			Commission:        stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
-			MinSelfDelegation: sdk.ZeroInt(),
-		}
-		validators = append(validators, validator)
-		delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec()))
-
-	}
-
-	// set validators and delegations
-	stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)
-	genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis)
-
-	// add bonded amount to bonded pool module account
-	balances = append(balances, banktypes.Balance{
-		Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(),
-		Coins:   sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)},
-	})
-
-	for _, b := range balances {
-		// add genesis acc tokens and delegated tokens to total supply
-		totalSupply = totalSupply.Add(b.Coins...)
-	}
-	// update total supply
-	bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{})
-	genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis)
-
-	return genesisState
-}
diff --git a/app/test_helpers/test_helpers.go b/app/test_helpers/test_helpers.go
index 5ed88461..063b44d7 100644
--- a/app/test_helpers/test_helpers.go
+++ b/app/test_helpers/test_helpers.go
@@ -28,6 +28,7 @@ type AppTestSuite struct {
 	suite.Suite
 
 	App            *terra_app.TerraApp
+	DB             dbm.DB
 	Ctx            sdk.Context
 	QueryHelper    *baseapp.QueryServiceTestHelper
 	TestAccs       []sdk.AccAddress
@@ -42,6 +43,7 @@ func (s *AppTestSuite) Setup() {
 	genesisState.SetDefaultTerraConfig(encCfg.Marshaler)
 
 	db := dbm.NewMemDB()
+	s.DB = db
 	s.App = terra_app.NewTerraApp(
 		log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
 		db,