diff --git a/CHANGELOG.md b/CHANGELOG.md index a75f6041..61aa71aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ - Migrate `x/gov` fork from Atom One to Atom One SDK [#248](https://github.com/atomone-hub/atomone/pull/248) - Add governors to `x/gov` module [#258](https://github.com/atomone-hub/atomone/pull/258) -- Prevent Oversight DAO from vetoing proposals that include a change to the Oversight DAO address [#275](https://github.com/atomone-hub/atomone/pull/275) +- Prevent Oversight DAO from vetoing proposals that include a change to the Oversight DAO address [#275](https://github.com/atomone-hub/atomone/pull/275) [#299](https://github.com/atomone-hub/atomone/pull/299) ### STATE BREAKING diff --git a/x/coredaos/keeper/msg_server.go b/x/coredaos/keeper/msg_server.go index 54215bb9..bef644c9 100644 --- a/x/coredaos/keeper/msg_server.go +++ b/x/coredaos/keeper/msg_server.go @@ -385,7 +385,7 @@ func (ms MsgServer) VetoProposal(goCtx context.Context, msg *types.MsgVetoPropos return nil, err } - if updateParamsMsg.Params.OversightDaoAddress != "" && updateParamsMsg.Params.OversightDaoAddress != params.OversightDaoAddress { + if updateParamsMsg.Params.OversightDaoAddress != params.OversightDaoAddress { logger.Error( "proposal contains a change of the oversight DAO address, vetoing it would prevent the replacement of the current oversight DAO", "proposal", proposal.Id, diff --git a/x/coredaos/keeper/msg_server_test.go b/x/coredaos/keeper/msg_server_test.go index 86a10916..79dd54a3 100644 --- a/x/coredaos/keeper/msg_server_test.go +++ b/x/coredaos/keeper/msg_server_test.go @@ -709,6 +709,20 @@ func TestMsgServerVetoProposal(t *testing.T) { Status: govtypesv1.StatusVotingPeriod, Messages: proposalWithChangeOversightDAOMsgs, } + proposalWithEmptyOversightDAOMsgs, err := sdktx.SetMsgs([]sdk.Msg{&types.MsgUpdateParams{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Params: types.Params{ + OversightDaoAddress: "", + }, + }}) + require.NoError(t, err) + proposalWithEmptyOversightDAO := govtypesv1.Proposal{ + Title: "Test Proposal", + Summary: "A proposal to set empty oversight DAO address", + Id: 5, + Status: govtypesv1.StatusVotingPeriod, + Messages: proposalWithEmptyOversightDAOMsgs, + } tests := []struct { name string msg *types.MsgVetoProposal @@ -840,6 +854,18 @@ func TestMsgServerVetoProposal(t *testing.T) { }, setOversightDAO: true, }, + { + name: "veto proposal with disablement of oversight DAO", + msg: &types.MsgVetoProposal{ + Vetoer: oversightDAOAcc, + ProposalId: 5, + }, + expectedErr: "proposal with ID 5 contains a change of the oversight DAO address, vetoing it would prevent the replacement of the current oversight DAO: oversight DAO cannot veto this proposal", + setupMocks: func(ctx sdk.Context, m *testutil.Mocks) { + m.GovKeeper.EXPECT().GetProposal(ctx, uint64(5)).Return(proposalWithEmptyOversightDAO, true) + }, + setOversightDAO: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {