From 9b1dac77fe0cfb72a5f6e1659c9e01f04fc3a1aa Mon Sep 17 00:00:00 2001 From: Chandragupta Singh Date: Fri, 3 Nov 2023 17:07:55 +0530 Subject: [PATCH 1/7] icq added in mm --- app/app.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/app.go b/app/app.go index 895fd73e8..e92aa34e2 100644 --- a/app/app.go +++ b/app/app.go @@ -306,6 +306,7 @@ var ( ibcfee.AppModuleBasic{}, liquidationsV2.AppModuleBasic{}, auctionsV2.AppModuleBasic{}, + icq.AppModuleBasic{}, ibchooks.AppModuleBasic{}, packetforward.AppModuleBasic{}, ) From 4be12e39755a1ab1e221e4ef88e6e5e64d8c270f Mon Sep 17 00:00:00 2001 From: Chandragupta Singh Date: Sun, 5 Nov 2023 22:07:44 +0530 Subject: [PATCH 2/7] icq capability fix, ibc-apps replaced --- app/app.go | 8 ++++---- cmd/comdex/migrate.go | 2 +- go.mod | 6 +++--- go.sum | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/app.go b/app/app.go index e92aa34e2..e0753e836 100644 --- a/app/app.go +++ b/app/app.go @@ -24,9 +24,9 @@ import ( consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - packetforward "github.com/strangelove-ventures/packet-forward-middleware/v7/router" - packetforwardkeeper "github.com/strangelove-ventures/packet-forward-middleware/v7/router/keeper" - packetforwardtypes "github.com/strangelove-ventures/packet-forward-middleware/v7/router/types" + packetforward "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router" + packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/keeper" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types" "github.com/rakyll/statik/fs" @@ -889,7 +889,7 @@ func New( app.IbcKeeper.ChannelKeeper, // may be replaced with middleware app.IbcKeeper.ChannelKeeper, &app.IbcKeeper.PortKeeper, - app.ScopedICQKeeper, + scopedICQKeeper, app.GRPCQueryRouter(), // NewQuerierWrapper(baseApp), // in-case of strangelove-ventures icq ) diff --git a/cmd/comdex/migrate.go b/cmd/comdex/migrate.go index 7f6b135a7..540a58460 100644 --- a/cmd/comdex/migrate.go +++ b/cmd/comdex/migrate.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/x/genutil/types" // bump47: uncomment below 1 - packetforwardtypes "github.com/strangelove-ventures/packet-forward-middleware/v7/router/types" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types" ) func Migrate(appState types.AppMap, clientCtx client.Context) types.AppMap { diff --git a/go.mod b/go.mod index 68dee2bc5..b7760336b 100644 --- a/go.mod +++ b/go.mod @@ -12,8 +12,8 @@ require ( github.com/cometbft/cometbft-db v0.8.0 github.com/cosmos/cosmos-sdk v0.47.5 github.com/cosmos/gogoproto v1.4.10 - github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0-20230726182236-3a9d46a7c2a4 - github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230726182236-3a9d46a7c2a4 + github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0 + github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79 github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -28,12 +28,12 @@ require ( ) require ( + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0 github.com/cosmos/ibc-go/v7 v7.2.0 github.com/cosmos/ics23/go v0.10.0 // indirect github.com/golangci/golangci-lint v1.51.2 github.com/rakyll/statik v0.1.7 github.com/spf13/pflag v1.0.5 - github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f gopkg.in/yaml.v2 v2.4.0 mvdan.cc/gofumpt v0.5.0 ) diff --git a/go.sum b/go.sum index e11b81db1..a48c03ea1 100644 --- a/go.sum +++ b/go.sum @@ -1097,10 +1097,12 @@ github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONAp github.com/cosmos/iavl v0.20.0-alpha4/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38= github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= -github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0-20230726182236-3a9d46a7c2a4 h1:AKzCfYLsVG9DtNzjya12u+OO0sUQpcXlecqnD/2rqGg= -github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0-20230726182236-3a9d46a7c2a4/go.mod h1:/P6l2bWo2AR3rrsfs0DHuFZO3Imzb93sxFD3ihrIgw4= -github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230726182236-3a9d46a7c2a4 h1:NuFmpHnENcTtZDEQf2vZzZluk5rQl3f7J4tqo9FlH/c= -github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230726182236-3a9d46a7c2a4/go.mod h1:JwHFbo1oX/ht4fPpnPvmhZr+dCkYK1Vihw+vZE9umR4= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0 h1:i9esYyZ5ExpZOgxrLMQhY2jDTVYiaD8yUeqXN9QBgbk= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0/go.mod h1:fctjEnz9xaBFOlmYYPdKL8Hs1Y3GUKilSwsJdqBb5QU= +github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0 h1:mMHedP3Q+mz5gpOWNz0P+X8hxPdamylrBKc/P2cFakA= +github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0/go.mod h1:/P6l2bWo2AR3rrsfs0DHuFZO3Imzb93sxFD3ihrIgw4= +github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79 h1:pCxyhIxgWTabAQC5UerkITraHG3SwajdLKKMCFDWCv4= +github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79/go.mod h1:JwHFbo1oX/ht4fPpnPvmhZr+dCkYK1Vihw+vZE9umR4= github.com/cosmos/ibc-go/v7 v7.2.0 h1:dx0DLUl7rxdyZ8NiT6UsrbzKOJx/w7s+BOaewFRH6cg= github.com/cosmos/ibc-go/v7 v7.2.0/go.mod h1:OOcjKIRku/j1Xs1RgKK0yvKRrJ5iFuZYMetR1n3yMlc= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -2807,8 +2809,6 @@ github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= -github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f h1:NJdZ+YJ9Vf2t286L20IjFK0SxGpobF1xIp5ZQlxWetk= -github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f/go.mod h1:DJNSVK8NCYHM+aZHCFkcAqPwjzwHYAjhjSMlhAGtJ3c= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= From dd4a4e855b8f0c3a3a85683f8039bb88940c5804 Mon Sep 17 00:00:00 2001 From: Chandragupta Singh Date: Mon, 6 Nov 2023 14:57:30 +0530 Subject: [PATCH 3/7] tc commented --- app/upgrades/testnet/v13/upgrade_test.go | 88 ++++++++++++------------ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/app/upgrades/testnet/v13/upgrade_test.go b/app/upgrades/testnet/v13/upgrade_test.go index be9f1a70f..41cbb1b72 100644 --- a/app/upgrades/testnet/v13/upgrade_test.go +++ b/app/upgrades/testnet/v13/upgrade_test.go @@ -1,64 +1,64 @@ package v13_test -import ( - "testing" +// import ( +// "testing" - "github.com/stretchr/testify/suite" +// "github.com/stretchr/testify/suite" - "github.com/comdex-official/comdex/app" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - v13 "github.com/comdex-official/comdex/app/upgrades/testnet/v13" -) +// "github.com/comdex-official/comdex/app" +// wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" +// v13 "github.com/comdex-official/comdex/app/upgrades/testnet/v13" +// ) -type UpgradeTestSuite struct { - app.KeeperTestHelper -} +// type UpgradeTestSuite struct { +// app.KeeperTestHelper +// } -func (s *UpgradeTestSuite) SetupTest() { - s.Setup() -} +// func (s *UpgradeTestSuite) SetupTest() { +// s.Setup() +// } -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(UpgradeTestSuite)) -} +// func TestKeeperTestSuite(t *testing.T) { +// suite.Run(t, new(UpgradeTestSuite)) +// } -// Ensures the test does not error out. -func (s *UpgradeTestSuite) TestUpgrade() { - s.Setup() +// // Ensures the test does not error out. +// func (s *UpgradeTestSuite) TestUpgrade() { +// s.Setup() - preUpgradeChecks(s) +// preUpgradeChecks(s) - upgradeHeight := int64(5) - s.ConfirmUpgradeSucceeded(v13.UpgradeName, upgradeHeight) +// upgradeHeight := int64(5) +// s.ConfirmUpgradeSucceeded(v13.UpgradeName, upgradeHeight) - postUpgradeChecks(s) -} +// postUpgradeChecks(s) +// } -func preUpgradeChecks(s *UpgradeTestSuite) { +// func preUpgradeChecks(s *UpgradeTestSuite) { - mp := s.App.MintKeeper.GetParams(s.Ctx) - s.Require().Equal(mp.BlocksPerYear, uint64(6311520)) +// mp := s.App.MintKeeper.GetParams(s.Ctx) +// s.Require().Equal(mp.BlocksPerYear, uint64(6311520)) - sp := s.App.SlashingKeeper.GetParams(s.Ctx) - s.Require().Equal(sp.SignedBlocksWindow, int64(100)) +// sp := s.App.SlashingKeeper.GetParams(s.Ctx) +// s.Require().Equal(sp.SignedBlocksWindow, int64(100)) -} +// } -func postUpgradeChecks(s *UpgradeTestSuite) { +// func postUpgradeChecks(s *UpgradeTestSuite) { - // Ensure the gov params have MinInitialDepositRatio added - gp := s.App.GovKeeper.GetParams(s.Ctx) - s.Require().Equal(gp.MinInitialDepositRatio, "0.200000000000000000") +// // Ensure the gov params have MinInitialDepositRatio added +// gp := s.App.GovKeeper.GetParams(s.Ctx) +// s.Require().Equal(gp.MinInitialDepositRatio, "0.200000000000000000") - // Ensure the mint params have doubled - mp := s.App.MintKeeper.GetParams(s.Ctx) - s.Require().Equal(mp.BlocksPerYear, uint64(6311520*2)) +// // Ensure the mint params have doubled +// mp := s.App.MintKeeper.GetParams(s.Ctx) +// s.Require().Equal(mp.BlocksPerYear, uint64(6311520*2)) - // Ensure the slashing params have doubled - sp := s.App.SlashingKeeper.GetParams(s.Ctx) - s.Require().Equal(sp.SignedBlocksWindow, int64(100*2)) +// // Ensure the slashing params have doubled +// sp := s.App.SlashingKeeper.GetParams(s.Ctx) +// s.Require().Equal(sp.SignedBlocksWindow, int64(100*2)) - // Ensure the wasm Permissionless - wp := s.App.WasmKeeper.GetParams(s.Ctx) - s.Require().Equal(wp.CodeUploadAccess, wasmtypes.AllowEverybody) -} +// // Ensure the wasm Permissionless +// wp := s.App.WasmKeeper.GetParams(s.Ctx) +// s.Require().Equal(wp.CodeUploadAccess, wasmtypes.AllowEverybody) +// } From a462dd3f0509f7096fa51ffe3b2ca32d97c412b9 Mon Sep 17 00:00:00 2001 From: vishnukumavat Date: Mon, 6 Nov 2023 15:35:09 +0530 Subject: [PATCH 4/7] disallow rewards distribution for disabled pools --- x/liquidity/keeper/rewards.go | 5 +++++ x/rewards/keeper/gauge.go | 5 ++++- x/rewards/types/errors.go | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/x/liquidity/keeper/rewards.go b/x/liquidity/keeper/rewards.go index 8d297ef05..3054cb7b6 100644 --- a/x/liquidity/keeper/rewards.go +++ b/x/liquidity/keeper/rewards.go @@ -1,6 +1,7 @@ package keeper import ( + "fmt" "math" "strconv" "time" @@ -169,6 +170,10 @@ func (k Keeper) GetFarmingRewardsData(ctx sdk.Context, appID uint64, coinsToDist pair := deserializerKit.Pair pool := deserializerKit.Pool + if pool.Disabled { + return nil, sdkerrors.Wrap(types.ErrDisabledPool, fmt.Sprintf("pool is disabled : %d", pool.Id)) + } + asset, err := k.GetAssetWhoseOraclePriceExists(ctx, pair.QuoteCoinDenom, pair.BaseCoinDenom) if err != nil { return nil, err diff --git a/x/rewards/keeper/gauge.go b/x/rewards/keeper/gauge.go index d36965b82..e0a6f1577 100644 --- a/x/rewards/keeper/gauge.go +++ b/x/rewards/keeper/gauge.go @@ -95,10 +95,13 @@ func (k Keeper) ValidateMsgCreateGaugeLiquidityMetaData(ctx sdk.Context, appID u if poolID == kind.LiquidityMetaData.PoolId { return sdkerrors.Wrap(types.ErrSamePoolID, fmt.Sprintf("pool id : %d", poolID)) } - _, found := k.liquidityKeeper.GetPool(ctx, appID, poolID) + pool, found := k.liquidityKeeper.GetPool(ctx, appID, poolID) if !found { return sdkerrors.Wrap(types.ErrInvalidPoolID, fmt.Sprintf("invalid child pool id : %d", poolID)) } + if pool.Disabled { + return sdkerrors.Wrap(types.ErrDisabledPool, fmt.Sprintf("pool is disabled : %d", poolID)) + } } return nil diff --git a/x/rewards/types/errors.go b/x/rewards/types/errors.go index f8c38526e..93c6d7f09 100644 --- a/x/rewards/types/errors.go +++ b/x/rewards/types/errors.go @@ -27,4 +27,5 @@ var ( ErrInvalidAppID = sdkerrors.Register(ModuleName, 1117, "invalid app id") ErrInternalRewardsNotFound = sdkerrors.Register(ModuleName, 1118, "Internal rewards not found") ErrStablemintVaultFound = sdkerrors.Register(ModuleName, 1119, "Can't give reward to stablemint vault") + ErrDisabledPool = sdkerrors.Register(ModuleName, 1120, "diabled pool") ) From 39bfc6fdda6d5709ed61e31643dd8affc6d4c283 Mon Sep 17 00:00:00 2001 From: Chandragupta Singh Date: Mon, 6 Nov 2023 17:46:02 +0530 Subject: [PATCH 5/7] upgrade handler modified --- app/app.go | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/app/app.go b/app/app.go index e0753e836..75c303da8 100644 --- a/app/app.go +++ b/app/app.go @@ -391,10 +391,10 @@ type App struct { // IBC modules // transfer module - Ics20WasmHooks *ibchooks.WasmHooks - HooksICS4Wrapper ibchooks.ICS4Middleware - PacketForwardKeeper *packetforwardkeeper.Keeper - ICQKeeper *icqkeeper.Keeper + Ics20WasmHooks *ibchooks.WasmHooks + HooksICS4Wrapper ibchooks.ICS4Middleware + PacketForwardKeeper *packetforwardkeeper.Keeper + ICQKeeper *icqkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper @@ -1455,6 +1455,10 @@ func (a *App) ModuleAccountsPermissions() map[string][]string { } func (a *App) registerUpgradeHandlers() { + a.UpgradeKeeper.SetUpgradeHandler( + tv13.UpgradeName, + tv13.CreateUpgradeHandlerV13(a.mm, a.configurator, a.cdc, a.keys[capabilitytypes.ModuleName], a.CapabilityKeeper, a.WasmKeeper, a.ParamsKeeper, a.ConsensusParamsKeeper, *a.IbcKeeper, a.GovKeeper, *a.StakingKeeper, a.MintKeeper, a.SlashingKeeper, a.BandoracleKeeper), + ) // When a planned update height is reached, the old binary will panic // writing on disk the height and name of the update that triggered it // This will read that value, and execute the preparations for the upgrade. @@ -1463,19 +1467,6 @@ func (a *App) registerUpgradeHandlers() { panic(err) } - switch { - case upgradeInfo.Name == mv12.UpgradeName: - a.UpgradeKeeper.SetUpgradeHandler( - mv12.UpgradeName, - mv12.CreateUpgradeHandlerV12(a.mm, a.configurator, a.ICQKeeper, a.NewliqKeeper, a.NewaucKeeper, a.BankKeeper, a.CollectorKeeper, a.LendKeeper, a.AuctionKeeper, a.LiquidationKeeper, a.AssetKeeper), - ) - case upgradeInfo.Name == tv13.UpgradeName: - a.UpgradeKeeper.SetUpgradeHandler( - tv13.UpgradeName, - tv13.CreateUpgradeHandlerV13(a.mm, a.configurator, a.cdc, a.keys[capabilitytypes.ModuleName], a.CapabilityKeeper, a.WasmKeeper, a.ParamsKeeper, a.ConsensusParamsKeeper, *a.IbcKeeper, a.GovKeeper, *a.StakingKeeper, a.MintKeeper, a.SlashingKeeper, a.BandoracleKeeper), - ) - } - var storeUpgrades *storetypes.StoreUpgrades storeUpgrades = upgradeHandlers(upgradeInfo, a, storeUpgrades) From 723cec2ccc676f6a349a103105419a7986bd4055 Mon Sep 17 00:00:00 2001 From: Chandragupta Singh Date: Mon, 6 Nov 2023 19:12:57 +0530 Subject: [PATCH 6/7] tc upgrade --- app/upgrades/testnet/v13/upgrade_test.go | 88 ++++++++++++------------ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/app/upgrades/testnet/v13/upgrade_test.go b/app/upgrades/testnet/v13/upgrade_test.go index 41cbb1b72..be9f1a70f 100644 --- a/app/upgrades/testnet/v13/upgrade_test.go +++ b/app/upgrades/testnet/v13/upgrade_test.go @@ -1,64 +1,64 @@ package v13_test -// import ( -// "testing" +import ( + "testing" -// "github.com/stretchr/testify/suite" + "github.com/stretchr/testify/suite" -// "github.com/comdex-official/comdex/app" -// wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" -// v13 "github.com/comdex-official/comdex/app/upgrades/testnet/v13" -// ) + "github.com/comdex-official/comdex/app" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + v13 "github.com/comdex-official/comdex/app/upgrades/testnet/v13" +) -// type UpgradeTestSuite struct { -// app.KeeperTestHelper -// } +type UpgradeTestSuite struct { + app.KeeperTestHelper +} -// func (s *UpgradeTestSuite) SetupTest() { -// s.Setup() -// } +func (s *UpgradeTestSuite) SetupTest() { + s.Setup() +} -// func TestKeeperTestSuite(t *testing.T) { -// suite.Run(t, new(UpgradeTestSuite)) -// } +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(UpgradeTestSuite)) +} -// // Ensures the test does not error out. -// func (s *UpgradeTestSuite) TestUpgrade() { -// s.Setup() +// Ensures the test does not error out. +func (s *UpgradeTestSuite) TestUpgrade() { + s.Setup() -// preUpgradeChecks(s) + preUpgradeChecks(s) -// upgradeHeight := int64(5) -// s.ConfirmUpgradeSucceeded(v13.UpgradeName, upgradeHeight) + upgradeHeight := int64(5) + s.ConfirmUpgradeSucceeded(v13.UpgradeName, upgradeHeight) -// postUpgradeChecks(s) -// } + postUpgradeChecks(s) +} -// func preUpgradeChecks(s *UpgradeTestSuite) { +func preUpgradeChecks(s *UpgradeTestSuite) { -// mp := s.App.MintKeeper.GetParams(s.Ctx) -// s.Require().Equal(mp.BlocksPerYear, uint64(6311520)) + mp := s.App.MintKeeper.GetParams(s.Ctx) + s.Require().Equal(mp.BlocksPerYear, uint64(6311520)) -// sp := s.App.SlashingKeeper.GetParams(s.Ctx) -// s.Require().Equal(sp.SignedBlocksWindow, int64(100)) + sp := s.App.SlashingKeeper.GetParams(s.Ctx) + s.Require().Equal(sp.SignedBlocksWindow, int64(100)) -// } +} -// func postUpgradeChecks(s *UpgradeTestSuite) { +func postUpgradeChecks(s *UpgradeTestSuite) { -// // Ensure the gov params have MinInitialDepositRatio added -// gp := s.App.GovKeeper.GetParams(s.Ctx) -// s.Require().Equal(gp.MinInitialDepositRatio, "0.200000000000000000") + // Ensure the gov params have MinInitialDepositRatio added + gp := s.App.GovKeeper.GetParams(s.Ctx) + s.Require().Equal(gp.MinInitialDepositRatio, "0.200000000000000000") -// // Ensure the mint params have doubled -// mp := s.App.MintKeeper.GetParams(s.Ctx) -// s.Require().Equal(mp.BlocksPerYear, uint64(6311520*2)) + // Ensure the mint params have doubled + mp := s.App.MintKeeper.GetParams(s.Ctx) + s.Require().Equal(mp.BlocksPerYear, uint64(6311520*2)) -// // Ensure the slashing params have doubled -// sp := s.App.SlashingKeeper.GetParams(s.Ctx) -// s.Require().Equal(sp.SignedBlocksWindow, int64(100*2)) + // Ensure the slashing params have doubled + sp := s.App.SlashingKeeper.GetParams(s.Ctx) + s.Require().Equal(sp.SignedBlocksWindow, int64(100*2)) -// // Ensure the wasm Permissionless -// wp := s.App.WasmKeeper.GetParams(s.Ctx) -// s.Require().Equal(wp.CodeUploadAccess, wasmtypes.AllowEverybody) -// } + // Ensure the wasm Permissionless + wp := s.App.WasmKeeper.GetParams(s.Ctx) + s.Require().Equal(wp.CodeUploadAccess, wasmtypes.AllowEverybody) +} From 2d03063a4482e7839602217517b7413a93f9cb19 Mon Sep 17 00:00:00 2001 From: vishnukumavat Date: Mon, 6 Nov 2023 19:20:44 +0530 Subject: [PATCH 7/7] reject swap fee distribution for disabled pools --- x/liquidity/keeper/pool.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/liquidity/keeper/pool.go b/x/liquidity/keeper/pool.go index 4a985efb2..df74a5393 100644 --- a/x/liquidity/keeper/pool.go +++ b/x/liquidity/keeper/pool.go @@ -685,6 +685,10 @@ func (k Keeper) TransferFundsForSwapFeeDistribution(ctx sdk.Context, appID, requ return sdk.Coin{}, types.ErrInvalidPoolID } + if requestedPool.Disabled { + return sdk.Coin{}, types.ErrDisabledPool + } + pair, found := k.GetPair(ctx, appID, requestedPool.PairId) if !found { return sdk.Coin{}, types.ErrInvalidPairID