From fa1f6b45006737d4a179d0f13c4443757c656adf Mon Sep 17 00:00:00 2001 From: emidev98 Date: Thu, 12 Oct 2023 18:04:30 +0300 Subject: [PATCH 1/3] wip: distr keeper --- app/app.go | 11 +++--- custom/distribution/keeper/keeper.go | 54 ++++++++++++++++++++++++++++ custom/distribution/module.go | 42 ++++++++++++++++++++++ 3 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 custom/distribution/keeper/keeper.go create mode 100644 custom/distribution/module.go diff --git a/app/app.go b/app/app.go index 3b6cc5c8..9d61fa32 100644 --- a/app/app.go +++ b/app/app.go @@ -65,6 +65,7 @@ import ( feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + customdistrkeeper "github.com/terra-money/core/v2/custom/distribution/keeper" "github.com/cosmos/cosmos-sdk/x/gov" govclient "github.com/cosmos/cosmos-sdk/x/gov/client" @@ -320,7 +321,7 @@ type TerraApp struct { StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper - DistrKeeper distrkeeper.Keeper + DistrKeeper customdistrkeeper.Keeper GovKeeper govkeeper.Keeper CrisisKeeper crisiskeeper.Keeper UpgradeKeeper *upgradekeeper.Keeper @@ -479,7 +480,7 @@ func NewTerraApp( authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - app.DistrKeeper = distrkeeper.NewKeeper( + app.DistrKeeper = customdistrkeeper.NewKeeper( appCodec, keys[distrtypes.StoreKey], app.AccountKeeper, @@ -661,7 +662,7 @@ func NewTerraApp( app.AccountKeeper, app.BankKeeper, app.StakingKeeper, - distrkeeper.NewQuerier(app.DistrKeeper), + distrkeeper.NewQuerier(app.DistrKeeper.Keeper), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, @@ -753,7 +754,7 @@ func NewTerraApp( gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), - distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), + distr.NewAppModule(appCodec, app.DistrKeeper.Keeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), upgrade.NewAppModule(app.UpgradeKeeper), @@ -1299,7 +1300,7 @@ func (app *TerraApp) SimulationManager() *module.SimulationManager { gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), - distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), + distr.NewAppModule(appCodec, app.DistrKeeper.Keeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(stakingtypes.ModuleName)), params.NewAppModule(app.ParamsKeeper), evidence.NewAppModule(app.EvidenceKeeper), diff --git a/custom/distribution/keeper/keeper.go b/custom/distribution/keeper/keeper.go new file mode 100644 index 00000000..10ed34eb --- /dev/null +++ b/custom/distribution/keeper/keeper.go @@ -0,0 +1,54 @@ +package keeper + +import ( + "fmt" + "time" + + sdkerrors "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + "github.com/cosmos/cosmos-sdk/x/distribution/types" +) + +type Keeper struct { + distributionkeeper.Keeper + bankKeeper types.BankKeeper + communityPoolBlockedUntil time.Time +} + +func NewKeeper( + cdc codec.BinaryCodec, + key storetypes.StoreKey, + authKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, + stakingKeeper types.StakingKeeper, + feeCollectorName string, + authority string, +) Keeper { + + return Keeper{ + Keeper: distributionkeeper.NewKeeper(cdc, + key, + authKeeper, + bankKeeper, + stakingKeeper, + feeCollectorName, + authority, + ), + bankKeeper: bankKeeper, + communityPoolBlockedUntil: time.Date(2025, 1, 1, 0, 0, 0, 0, time.Local), + } +} + +// DistributeFromFeePool distributes funds from the distribution module account to +// a receiver address while updating the community pool +func (k Keeper) DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error { + if k.communityPoolBlockedUntil.After(ctx.BlockHeader().Time) { + message := fmt.Sprintf("CommunityPool is blocked until %s", k.communityPoolBlockedUntil) + return sdkerrors.New(types.ModuleName, 999, message) + } + + return k.Keeper.DistributeFromFeePool(ctx, amount, receiveAddr) +} diff --git a/custom/distribution/module.go b/custom/distribution/module.go new file mode 100644 index 00000000..fbf7e627 --- /dev/null +++ b/custom/distribution/module.go @@ -0,0 +1,42 @@ +package distribution + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/x/bank/exported" + + distributionmod "github.com/cosmos/cosmos-sdk/x/distribution" + "github.com/cosmos/cosmos-sdk/x/distribution/types" + distrkeeper "github.com/terra-money/core/v2/custom/distribution/keeper" +) + +// AppModule wraps around the bank module and the bank keeper to return the right total supply ignoring bonded tokens +// that the alliance module minted to rebalance the voting power +// It modifies the TotalSupply and SupplyOf GRPC queries +type AppModule struct { + distributionmod.AppModule + keeper distrkeeper.Keeper +} + +// NewAppModule creates a new AppModule object +func NewAppModule( + cdc codec.Codec, + keeper distrkeeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, + stakingKeeper types.StakingKeeper, + ss exported.Subspace, +) AppModule { + appModule := distributionmod.NewAppModule( + cdc, + keeper.Keeper, + accountKeeper, + bankKeeper, + stakingKeeper, + ss, + ) + + return AppModule{ + AppModule: appModule, + keeper: keeper, + } +} From 6680a204dcde5b5782f3fa9f28fffee9bfd1f4a9 Mon Sep 17 00:00:00 2001 From: emidev98 Date: Fri, 13 Oct 2023 16:18:25 +0300 Subject: [PATCH 2/3] feat: block community pool test --- app/app_test/test_helpers.go | 1 - custom/distribution/keeper/keeper.go | 18 ++++---- custom/distribution/module_test.go | 62 ++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 custom/distribution/module_test.go diff --git a/app/app_test/test_helpers.go b/app/app_test/test_helpers.go index 8cbc4aca..158d13dd 100644 --- a/app/app_test/test_helpers.go +++ b/app/app_test/test_helpers.go @@ -114,7 +114,6 @@ func (s *AppTestSuite) CreateRandomAccounts(numAccts int) []sdk.AccAddress { // FundAcc funds target address with specified amount. func (s *AppTestSuite) FundAcc(acc sdk.AccAddress, amounts sdk.Coins) (err error) { - s.Require().NoError(err) if err := s.App.BankKeeper.MintCoins(s.Ctx, minttypes.ModuleName, amounts); err != nil { return err } diff --git a/custom/distribution/keeper/keeper.go b/custom/distribution/keeper/keeper.go index 10ed34eb..1755421b 100644 --- a/custom/distribution/keeper/keeper.go +++ b/custom/distribution/keeper/keeper.go @@ -12,10 +12,17 @@ import ( "github.com/cosmos/cosmos-sdk/x/distribution/types" ) +var ( + communityPoolBlockedUntil = time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) + ErrCommunityPoolBlocked = sdkerrors.New( + types.ModuleName, + 9999, + fmt.Sprintf("CommunityPool is blocked until %s", communityPoolBlockedUntil), + ) +) + type Keeper struct { distributionkeeper.Keeper - bankKeeper types.BankKeeper - communityPoolBlockedUntil time.Time } func NewKeeper( @@ -37,17 +44,14 @@ func NewKeeper( feeCollectorName, authority, ), - bankKeeper: bankKeeper, - communityPoolBlockedUntil: time.Date(2025, 1, 1, 0, 0, 0, 0, time.Local), } } // DistributeFromFeePool distributes funds from the distribution module account to // a receiver address while updating the community pool func (k Keeper) DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error { - if k.communityPoolBlockedUntil.After(ctx.BlockHeader().Time) { - message := fmt.Sprintf("CommunityPool is blocked until %s", k.communityPoolBlockedUntil) - return sdkerrors.New(types.ModuleName, 999, message) + if communityPoolBlockedUntil.After(ctx.BlockHeader().Time) { + return ErrCommunityPoolBlocked } return k.Keeper.DistributeFromFeePool(ctx, amount, receiveAddr) diff --git a/custom/distribution/module_test.go b/custom/distribution/module_test.go new file mode 100644 index 00000000..e2cac70a --- /dev/null +++ b/custom/distribution/module_test.go @@ -0,0 +1,62 @@ +package distribution_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + + sdkerrors "cosmossdk.io/errors" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + app "github.com/terra-money/core/v2/app/app_test" +) + +type DistributionModuleTest struct { + app.AppTestSuite +} + +func TestDistributionModuleTest(t *testing.T) { + suite.Run(t, new(DistributionModuleTest)) +} + +func (s *DistributionModuleTest) TestDistributonModule() { + s.Setup() + receiver := s.TestAccs[0] + + testCases := []struct { + name string + expectPass bool + err error + blockTime time.Time + }{ + { + "Send transasction from community pool", + true, + nil, + time.Date(2025, 1, 1, 1, 1, 1, 1, time.UTC), + }, + { + "Block transasction from community pool", + false, + sdkerrors.New(distrtypes.ModuleName, 999, "CommunityPool is blocked until 2025-01-01 00:00:00 +0000 UTC"), + time.Date(2024, 1, 1, 1, 1, 1, 1, time.UTC), + }, + } + + for _, tc := range testCases { + s.Ctx = s.Ctx.WithBlockTime(tc.blockTime) + + err := s.App.DistrKeeper.DistributeFromFeePool( + s.Ctx, + sdk.NewCoins(sdk.NewCoin("uluna", sdk.NewInt(0))), + receiver, + ) + if tc.expectPass { + s.Require().NoError(err, tc.name) + } else { + s.Require().EqualError(err, tc.err.Error(), tc.name) + } + } +} From d901b7b496f92735062b35655478569aa3090f5a Mon Sep 17 00:00:00 2001 From: emidev98 Date: Mon, 23 Oct 2023 09:59:01 +0200 Subject: [PATCH 3/3] chore: make format --- app/ante/ante.go | 13 +++++++------ app/app_test/app_test.go | 16 +++++++++------- app/app_test/test_helpers.go | 17 +++++++++-------- app/genesis.go | 15 ++++++++------- app/params/address.go | 3 ++- app/params/denoms.go | 3 ++- app/rpc/health.go | 6 ++++-- app/upgrades/v2.3.0/upgrade.go | 7 ++++--- app/upgrades/v2.5/upgrade.go | 19 +++++++++++-------- app/upgrades/v2.6/upgrade.go | 13 +++++++------ app/wasmconfig/config.go | 1 + cmd/terrad/root.go | 1 + custom/bank/keeper/hooks.go | 3 ++- custom/bank/keeper/keeper.go | 3 ++- custom/bank/module.go | 5 +++-- x/feeshare/keeper/genesis_test.go | 3 ++- x/feeshare/keeper/grpc_query_test.go | 3 ++- x/tokenfactory/bindings/custom_msg_test.go | 1 + x/tokenfactory/bindings/custom_query_test.go | 3 ++- x/tokenfactory/bindings/helpers_test.go | 7 +++++-- x/tokenfactory/bindings/message_plugin.go | 1 + x/tokenfactory/bindings/query_plugin.go | 1 + x/tokenfactory/bindings/wasm.go | 3 ++- x/tokenfactory/client/cli/query.go | 3 ++- x/tokenfactory/client/cli/query_test.go | 3 ++- x/tokenfactory/keeper/admins.go | 3 ++- x/tokenfactory/keeper/before_send_test.go | 1 + x/tokenfactory/keeper/genesis_test.go | 3 ++- x/tokenfactory/keeper/migrator.go | 3 ++- x/tokenfactory/keeper/msg_server.go | 1 + x/tokenfactory/migrations/v2/store.go | 5 +++-- x/tokenfactory/migrations/v3/store.go | 5 +++-- x/tokenfactory/module.go | 7 ++++--- x/tokenfactory/types/denoms.go | 1 + x/tokenfactory/types/genesis.go | 1 + x/tokenfactory/types/msgs.go | 1 + x/tokenfactory/types/msgs_test.go | 4 +++- x/tokenfactory/types/params_test.go | 3 ++- 38 files changed, 118 insertions(+), 73 deletions(-) diff --git a/app/ante/ante.go b/app/ante/ante.go index 83f96deb..bfd25243 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -1,12 +1,6 @@ package ante import ( - "github.com/cosmos/cosmos-sdk/client" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/auth/ante" - bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" 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" @@ -15,6 +9,13 @@ import ( feeshareante "github.com/terra-money/core/v2/x/feeshare/ante" feesharekeeper "github.com/terra-money/core/v2/x/feeshare/keeper" + "github.com/cosmos/cosmos-sdk/client" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/app/app_test/app_test.go b/app/app_test/app_test.go index a4e4f563..d3b9b484 100644 --- a/app/app_test/app_test.go +++ b/app/app_test/app_test.go @@ -9,8 +9,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - mocktestutils "github.com/cosmos/cosmos-sdk/testutil/mock" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" @@ -19,7 +17,16 @@ import ( "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" + tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router" + 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" @@ -44,11 +51,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/upgrade" - "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router" - 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/CosmWasm/wasmd/x/wasm" terra_app "github.com/terra-money/core/v2/app" diff --git a/app/app_test/test_helpers.go b/app/app_test/test_helpers.go index 8cbc4aca..e1baa3df 100644 --- a/app/app_test/test_helpers.go +++ b/app/app_test/test_helpers.go @@ -13,6 +13,15 @@ import ( "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" + "github.com/terra-money/core/v2/app" + terra_app "github.com/terra-money/core/v2/app" + "github.com/terra-money/core/v2/app/config" + appparams "github.com/terra-money/core/v2/app/params" + "github.com/terra-money/core/v2/app/wasmconfig" + feesharetypes "github.com/terra-money/core/v2/x/feeshare/types" + 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" @@ -23,14 +32,6 @@ import ( 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" - "github.com/stretchr/testify/suite" - "github.com/terra-money/core/v2/app" - terra_app "github.com/terra-money/core/v2/app" - "github.com/terra-money/core/v2/app/config" - appparams "github.com/terra-money/core/v2/app/params" - "github.com/terra-money/core/v2/app/wasmconfig" - feesharetypes "github.com/terra-money/core/v2/x/feeshare/types" - tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types" ) type AppTestSuite struct { diff --git a/app/genesis.go b/app/genesis.go index 58a6bf74..cb20dfbc 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -3,13 +3,6 @@ package app import ( "encoding/json" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" 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" @@ -17,6 +10,14 @@ import ( 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" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // GenesisState - The genesis state of the blockchain is represented here as a map of raw json diff --git a/app/params/address.go b/app/params/address.go index cc45c387..1d6e44e8 100644 --- a/app/params/address.go +++ b/app/params/address.go @@ -2,8 +2,9 @@ package params import ( wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/terra-money/core/v2/app/config" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func RegisterAddressesConfig() *sdk.Config { diff --git a/app/params/denoms.go b/app/params/denoms.go index d299427b..d465ef88 100644 --- a/app/params/denoms.go +++ b/app/params/denoms.go @@ -1,8 +1,9 @@ package params import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/terra-money/core/v2/app/config" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func RegisterDenomsConfig() error { diff --git a/app/rpc/health.go b/app/rpc/health.go index e4b37b10..c3ef3dfe 100644 --- a/app/rpc/health.go +++ b/app/rpc/health.go @@ -2,10 +2,12 @@ package rpc import ( "context" + "net/http" + ctypes "github.com/cometbft/cometbft/rpc/core/types" - "github.com/cosmos/cosmos-sdk/client" "github.com/gorilla/mux" - "net/http" + + "github.com/cosmos/cosmos-sdk/client" ) type HealthcheckResponse struct { diff --git a/app/upgrades/v2.3.0/upgrade.go b/app/upgrades/v2.3.0/upgrade.go index da51a8de..35d45984 100644 --- a/app/upgrades/v2.3.0/upgrade.go +++ b/app/upgrades/v2.3.0/upgrade.go @@ -1,12 +1,13 @@ package v2_3_0 import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/terra-money/core/v2/app/config" tokenfactorykeeper "github.com/terra-money/core/v2/x/tokenfactory/keeper" tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) func CreateUpgradeHandler( diff --git a/app/upgrades/v2.5/upgrade.go b/app/upgrades/v2.5/upgrade.go index 656f9250..5481354c 100644 --- a/app/upgrades/v2.5/upgrade.go +++ b/app/upgrades/v2.5/upgrade.go @@ -1,12 +1,21 @@ package v2_5 import ( - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "time" + pobkeeper "github.com/skip-mev/pob/x/builder/keeper" pobtypes "github.com/skip-mev/pob/x/builder/types" - "time" + + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" sdkerrors "cosmossdk.io/errors" + icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" + clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" + 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" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -15,12 +24,6 @@ import ( paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" - 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" ) func CreateUpgradeHandler( diff --git a/app/upgrades/v2.6/upgrade.go b/app/upgrades/v2.6/upgrade.go index e61ca04b..8a296496 100644 --- a/app/upgrades/v2.6/upgrade.go +++ b/app/upgrades/v2.6/upgrade.go @@ -4,12 +4,6 @@ import ( "time" sdkerrors "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/codec" - 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" clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" @@ -17,6 +11,13 @@ import ( 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" + + "github.com/cosmos/cosmos-sdk/codec" + 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" ) func CreateUpgradeHandler( diff --git a/app/wasmconfig/config.go b/app/wasmconfig/config.go index e724d306..9dccc54d 100644 --- a/app/wasmconfig/config.go +++ b/app/wasmconfig/config.go @@ -5,6 +5,7 @@ import ( "github.com/spf13/cobra" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + servertypes "github.com/cosmos/cosmos-sdk/server/types" ) diff --git a/cmd/terrad/root.go b/cmd/terrad/root.go index 2d43cc91..7eafd349 100644 --- a/cmd/terrad/root.go +++ b/cmd/terrad/root.go @@ -14,6 +14,7 @@ import ( "github.com/spf13/viper" tmcfg "github.com/cometbft/cometbft/config" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" diff --git a/custom/bank/keeper/hooks.go b/custom/bank/keeper/hooks.go index 7bb01cf6..33560d1c 100644 --- a/custom/bank/keeper/hooks.go +++ b/custom/bank/keeper/hooks.go @@ -1,8 +1,9 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" customterratypes "github.com/terra-money/core/v2/custom/bank/types" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // Implements StakingHooks interface diff --git a/custom/bank/keeper/keeper.go b/custom/bank/keeper/keeper.go index bd28a1c1..e20a30c9 100644 --- a/custom/bank/keeper/keeper.go +++ b/custom/bank/keeper/keeper.go @@ -7,9 +7,10 @@ import ( accountkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" custombankkeeper "github.com/terra-money/alliance/custom/bank/keeper" customterratypes "github.com/terra-money/core/v2/custom/bank/types" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) type Keeper struct { diff --git a/custom/bank/module.go b/custom/bank/module.go index e0d79d69..682ec284 100644 --- a/custom/bank/module.go +++ b/custom/bank/module.go @@ -7,10 +7,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank/exported" "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/types/module" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" customalliancemod "github.com/terra-money/alliance/custom/bank" custombankkeeper "github.com/terra-money/core/v2/custom/bank/keeper" + + "github.com/cosmos/cosmos-sdk/types/module" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" ) // AppModule wraps around the bank module and the bank keeper to return the right total supply ignoring bonded tokens diff --git a/x/feeshare/keeper/genesis_test.go b/x/feeshare/keeper/genesis_test.go index bd750d5f..66acf5a9 100644 --- a/x/feeshare/keeper/genesis_test.go +++ b/x/feeshare/keeper/genesis_test.go @@ -6,9 +6,10 @@ import ( "github.com/stretchr/testify/suite" - sdk "github.com/cosmos/cosmos-sdk/types" app_test "github.com/terra-money/core/v2/app/app_test" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/terra-money/core/v2/x/feeshare/types" ) diff --git a/x/feeshare/keeper/grpc_query_test.go b/x/feeshare/keeper/grpc_query_test.go index f995e01c..c393685a 100644 --- a/x/feeshare/keeper/grpc_query_test.go +++ b/x/feeshare/keeper/grpc_query_test.go @@ -1,9 +1,10 @@ package keeper_test import ( + "github.com/terra-money/core/v2/x/feeshare/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/terra-money/core/v2/x/feeshare/types" ) func (s *IntegrationTestSuite) TestFeeShares() { diff --git a/x/tokenfactory/bindings/custom_msg_test.go b/x/tokenfactory/bindings/custom_msg_test.go index e874fb55..1994bdac 100644 --- a/x/tokenfactory/bindings/custom_msg_test.go +++ b/x/tokenfactory/bindings/custom_msg_test.go @@ -9,6 +9,7 @@ import ( "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmvmtypes "github.com/CosmWasm/wasmvm/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/terra-money/core/v2/app" diff --git a/x/tokenfactory/bindings/custom_query_test.go b/x/tokenfactory/bindings/custom_query_test.go index 0d39ca32..5b3f80ef 100644 --- a/x/tokenfactory/bindings/custom_query_test.go +++ b/x/tokenfactory/bindings/custom_query_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/require" wasmvmtypes "github.com/CosmWasm/wasmvm/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/terra-money/core/v2/app" @@ -54,7 +55,7 @@ func TestQuery(t *testing.T) { }, }, paramsRes) - // Query full denom name throught wasm binding + // Query full denom name thought wasm binding query = bindings.TokenQuery{ FullDenom: &bindings.FullDenom{ CreatorAddr: reflect.String(), diff --git a/x/tokenfactory/bindings/helpers_test.go b/x/tokenfactory/bindings/helpers_test.go index 14588744..78d5882b 100644 --- a/x/tokenfactory/bindings/helpers_test.go +++ b/x/tokenfactory/bindings/helpers_test.go @@ -13,18 +13,21 @@ import ( "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/ed25519" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" dbm "github.com/cometbft/cometbft-db" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/terra-money/core/v2/app" "github.com/terra-money/core/v2/app/wasmconfig" tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types" + + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" ) func CreateTestInput() (*app.TerraApp, sdk.Context) { diff --git a/x/tokenfactory/bindings/message_plugin.go b/x/tokenfactory/bindings/message_plugin.go index 5083b676..75ec0d04 100644 --- a/x/tokenfactory/bindings/message_plugin.go +++ b/x/tokenfactory/bindings/message_plugin.go @@ -6,6 +6,7 @@ import ( errorsmod "cosmossdk.io/errors" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmvmtypes "github.com/CosmWasm/wasmvm/types" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" diff --git a/x/tokenfactory/bindings/query_plugin.go b/x/tokenfactory/bindings/query_plugin.go index 5ed33256..085d1a1a 100644 --- a/x/tokenfactory/bindings/query_plugin.go +++ b/x/tokenfactory/bindings/query_plugin.go @@ -6,6 +6,7 @@ import ( errorsmod "cosmossdk.io/errors" wasmvmtypes "github.com/CosmWasm/wasmvm/types" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" diff --git a/x/tokenfactory/bindings/wasm.go b/x/tokenfactory/bindings/wasm.go index dbeb99e5..3025c240 100644 --- a/x/tokenfactory/bindings/wasm.go +++ b/x/tokenfactory/bindings/wasm.go @@ -5,8 +5,9 @@ import ( wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" tokenfactorykeeper "github.com/terra-money/core/v2/x/tokenfactory/keeper" + + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" ) func RegisterCustomPlugins( diff --git a/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go index 8eef3ff0..1b8d504d 100644 --- a/x/tokenfactory/client/cli/query.go +++ b/x/tokenfactory/client/cli/query.go @@ -6,9 +6,10 @@ import ( "fmt" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" "github.com/terra-money/core/v2/x/tokenfactory/types" ) diff --git a/x/tokenfactory/client/cli/query_test.go b/x/tokenfactory/client/cli/query_test.go index 8dc576db..36fa4ccf 100644 --- a/x/tokenfactory/client/cli/query_test.go +++ b/x/tokenfactory/client/cli/query_test.go @@ -7,10 +7,11 @@ import ( "cosmossdk.io/math" "github.com/stretchr/testify/suite" - sdk "github.com/cosmos/cosmos-sdk/types" app "github.com/terra-money/core/v2/app/app_test" "github.com/terra-money/core/v2/app/config" "github.com/terra-money/core/v2/x/tokenfactory/types" + + sdk "github.com/cosmos/cosmos-sdk/types" ) type QueryTestSuite struct { diff --git a/x/tokenfactory/keeper/admins.go b/x/tokenfactory/keeper/admins.go index a43ef577..9509a1d4 100644 --- a/x/tokenfactory/keeper/admins.go +++ b/x/tokenfactory/keeper/admins.go @@ -1,8 +1,9 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/terra-money/core/v2/x/tokenfactory/types" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // GetAuthorityMetadata returns the authority metadata for a specific denom diff --git a/x/tokenfactory/keeper/before_send_test.go b/x/tokenfactory/keeper/before_send_test.go index adf97c02..170f2272 100644 --- a/x/tokenfactory/keeper/before_send_test.go +++ b/x/tokenfactory/keeper/before_send_test.go @@ -11,6 +11,7 @@ import ( wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" wasmvmtypes "github.com/CosmWasm/wasmvm/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" ) diff --git a/x/tokenfactory/keeper/genesis_test.go b/x/tokenfactory/keeper/genesis_test.go index 2739bd94..ac4ca5e8 100644 --- a/x/tokenfactory/keeper/genesis_test.go +++ b/x/tokenfactory/keeper/genesis_test.go @@ -1,9 +1,10 @@ package keeper_test import ( + "github.com/terra-money/core/v2/x/tokenfactory/types" + sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/terra-money/core/v2/x/tokenfactory/types" ) func (s *KeeperTestSuite) TestGenesis() { diff --git a/x/tokenfactory/keeper/migrator.go b/x/tokenfactory/keeper/migrator.go index 5719a14c..5bc613ad 100644 --- a/x/tokenfactory/keeper/migrator.go +++ b/x/tokenfactory/keeper/migrator.go @@ -1,10 +1,11 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/terra-money/core/v2/x/tokenfactory/exported" v2 "github.com/terra-money/core/v2/x/tokenfactory/migrations/v2" v3 "github.com/terra-money/core/v2/x/tokenfactory/migrations/v3" + + sdk "github.com/cosmos/cosmos-sdk/types" ) type Migrator struct { diff --git a/x/tokenfactory/keeper/msg_server.go b/x/tokenfactory/keeper/msg_server.go index 52336979..2e80acf7 100644 --- a/x/tokenfactory/keeper/msg_server.go +++ b/x/tokenfactory/keeper/msg_server.go @@ -4,6 +4,7 @@ import ( "context" sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" diff --git a/x/tokenfactory/migrations/v2/store.go b/x/tokenfactory/migrations/v2/store.go index fec6da55..be59c86d 100644 --- a/x/tokenfactory/migrations/v2/store.go +++ b/x/tokenfactory/migrations/v2/store.go @@ -1,11 +1,12 @@ package v2 import ( - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/terra-money/core/v2/app/config" "github.com/terra-money/core/v2/x/tokenfactory/exported" "github.com/terra-money/core/v2/x/tokenfactory/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) func MigrateStore(ctx sdk.Context, legacySubspace exported.Subspace, cdc codec.BinaryCodec) error { diff --git a/x/tokenfactory/migrations/v3/store.go b/x/tokenfactory/migrations/v3/store.go index 999b01c0..aee3f6b0 100644 --- a/x/tokenfactory/migrations/v3/store.go +++ b/x/tokenfactory/migrations/v3/store.go @@ -1,11 +1,12 @@ package v3 import ( + "github.com/terra-money/core/v2/x/tokenfactory/exported" + "github.com/terra-money/core/v2/x/tokenfactory/types" + "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terra-money/core/v2/x/tokenfactory/exported" - "github.com/terra-money/core/v2/x/tokenfactory/types" ) // MigrateStore migrates the x/tokenfactory module state from the consensus version 2 to diff --git a/x/tokenfactory/module.go b/x/tokenfactory/module.go index eb20159d..eca0d84c 100644 --- a/x/tokenfactory/module.go +++ b/x/tokenfactory/module.go @@ -14,14 +14,15 @@ import ( "fmt" abci "github.com/cometbft/cometbft/abci/types" + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" "github.com/terra-money/core/v2/x/tokenfactory/client/cli" "github.com/terra-money/core/v2/x/tokenfactory/exported" diff --git a/x/tokenfactory/types/denoms.go b/x/tokenfactory/types/denoms.go index 65839985..a6fc4e08 100644 --- a/x/tokenfactory/types/denoms.go +++ b/x/tokenfactory/types/denoms.go @@ -4,6 +4,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/tokenfactory/types/genesis.go b/x/tokenfactory/types/genesis.go index aef9370c..408dc5f9 100644 --- a/x/tokenfactory/types/genesis.go +++ b/x/tokenfactory/types/genesis.go @@ -2,6 +2,7 @@ package types import ( errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/tokenfactory/types/msgs.go b/x/tokenfactory/types/msgs.go index 09e256cb..dac80532 100644 --- a/x/tokenfactory/types/msgs.go +++ b/x/tokenfactory/types/msgs.go @@ -2,6 +2,7 @@ package types import ( errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" diff --git a/x/tokenfactory/types/msgs_test.go b/x/tokenfactory/types/msgs_test.go index 9b555330..26c1cf36 100644 --- a/x/tokenfactory/types/msgs_test.go +++ b/x/tokenfactory/types/msgs_test.go @@ -4,12 +4,14 @@ import ( fmt "fmt" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/terra-money/core/v2/x/tokenfactory/types" "github.com/cometbft/cometbft/crypto/ed25519" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) diff --git a/x/tokenfactory/types/params_test.go b/x/tokenfactory/types/params_test.go index a33a4557..194b1355 100644 --- a/x/tokenfactory/types/params_test.go +++ b/x/tokenfactory/types/params_test.go @@ -6,8 +6,9 @@ import ( "cosmossdk.io/math" "github.com/stretchr/testify/require" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/terra-money/core/v2/x/tokenfactory/types" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestCreateNewParms(t *testing.T) {