From ea17c5a2e543dd294c18a922cc78a25f6783917c Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Wed, 26 Oct 2022 03:35:47 +0000 Subject: [PATCH] fix: add x/distribution's module account into blockedAddr (#752) * Fix the whitelist * Revert the divergence in the tests * Update CHANGELOG.md --- CHANGELOG.md | 1 + simapp/app.go | 2 +- x/bank/keeper/genesis_test.go | 2 +- x/bank/simulation/operations_test.go | 12 ++++++------ 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b50bb8381..a68230d594 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -120,6 +120,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/foundation) [\#730](https://github.com/line/lbm-sdk/pull/730) prune stale x/foundation proposals at voting period end * (cli) [\#734](https://github.com/line/lbm-sdk/pull/734) add restrictions on the number of args in the CLIs * (client) [\#737](https://github.com/line/lbm-sdk/pull/737) check multisig key list to prevent unexpected key deletion +* (simapp) [\#752](https://github.com/line/lbm-sdk/pull/752) add x/distribution's module account into blockedAddr ### Breaking Changes * (proto) [\#564](https://github.com/line/lbm-sdk/pull/564) change gRPC path to original cosmos path diff --git a/simapp/app.go b/simapp/app.go index 4b6346141f..feacad8440 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -191,7 +191,7 @@ var ( // module accounts that are allowed to receive tokens allowedReceivingModAcc = map[string]bool{ - distrtypes.ModuleName: true, + // govtypes.ModuleName: true, // TODO: uncomment it when authority is ready } ) diff --git a/x/bank/keeper/genesis_test.go b/x/bank/keeper/genesis_test.go index 9d35e6cb5d..797b93d88d 100644 --- a/x/bank/keeper/genesis_test.go +++ b/x/bank/keeper/genesis_test.go @@ -39,7 +39,7 @@ func (suite *IntegrationTestSuite) TestExportGenesis() { func (suite *IntegrationTestSuite) getTestBalancesAndSupply() ([]types.Balance, sdk.Coins) { addr2, _ := sdk.AccAddressFromBech32("link1f9xjhxm0plzrh9cskf4qee4pc2xwp0n0p662v8") - addr1, _ := sdk.AccAddressFromBech32("link1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8j3y7jh") // distribution module address + addr1, _ := sdk.AccAddressFromBech32("link1t5u0jfg3ljsjrh2m9e47d4ny2hea7eehndz0n9") addr1Balance := sdk.Coins{sdk.NewInt64Coin("testcoin3", 10)} addr2Balance := sdk.Coins{sdk.NewInt64Coin("testcoin1", 32), sdk.NewInt64Coin("testcoin2", 34)} diff --git a/x/bank/simulation/operations_test.go b/x/bank/simulation/operations_test.go index bba4a6d862..1f03d5b447 100644 --- a/x/bank/simulation/operations_test.go +++ b/x/bank/simulation/operations_test.go @@ -143,13 +143,13 @@ func (suite *SimTestSuite) TestSimulateModuleAccountMsgSend() { r = rand.New(s) operationMsg, futureOperations, err := op(r, suite.app.BaseApp, suite.ctx, accounts, "") - suite.Require().NoError(err) + suite.Require().Error(err) var msg types.MsgSend types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) - suite.Require().True(operationMsg.OK) - suite.Require().Empty(operationMsg.Comment) + suite.Require().False(operationMsg.OK) + suite.Require().Equal(operationMsg.Comment, "invalid transfers") suite.Require().Equal(types.TypeMsgSend, msg.Type()) suite.Require().Equal(types.ModuleName, msg.Route()) suite.Require().Len(futureOperations, 0) @@ -173,13 +173,13 @@ func (suite *SimTestSuite) TestSimulateMsgMultiSendToModuleAccount() { op := simulation.SimulateMsgMultiSendToModuleAccount(suite.app.AccountKeeper, suite.app.BankKeeper, mAccCount) operationMsg, futureOperations, err := op(r, suite.app.BaseApp, suite.ctx, accounts, "") - suite.Require().NoError(err) + suite.Require().Error(err) var msg types.MsgMultiSend types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) - suite.Require().True(operationMsg.OK) // sending tokens to a module account should fail - suite.Require().Empty(operationMsg.Comment) + suite.Require().False(operationMsg.OK) // sending tokens to a module account should fail + suite.Require().Equal(operationMsg.Comment, "invalid transfers") suite.Require().Equal(types.TypeMsgMultiSend, msg.Type()) suite.Require().Equal(types.ModuleName, msg.Route()) suite.Require().Len(futureOperations, 0)