Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(gov): move args in gov new proposal constructor #14782

Merged
merged 6 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x/gov/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat
submitTime := ctx.BlockHeader().Time
depositPeriod := keeper.GetParams(ctx).MaxDepositPeriod

proposal, err := v1.NewProposal(messages, proposalID, metadata, submitTime, submitTime.Add(*depositPeriod), title, summary, proposer)
proposal, err := v1.NewProposal(messages, proposalID, submitTime, submitTime.Add(*depositPeriod), metadata, title, summary, proposer)
if err != nil {
return v1.Proposal{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion x/gov/keeper/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (suite *KeeperTestSuite) TestGetProposalsFiltered() {

for _, s := range status {
for i := 0; i < 50; i++ {
p, err := v1.NewProposal(TestProposal, proposalID, "", time.Now(), time.Now(), "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
p, err := v1.NewProposal(TestProposal, proposalID, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
suite.Require().NoError(err)

p.Status = s
Expand Down
4 changes: 2 additions & 2 deletions x/gov/migrations/v4/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ func TestMigrateStore(t *testing.T) {
// Create 2 proposals
prop1Content, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Test", "description"), authtypes.NewModuleAddress("gov").String())
require.NoError(t, err)
proposal1, err := v1.NewProposal([]sdk.Msg{prop1Content}, 1, "some metadata for the legacy content", propTime, propTime, "Test", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
proposal1, err := v1.NewProposal([]sdk.Msg{prop1Content}, 1, propTime, propTime, "some metadata for the legacy content", "Test", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
require.NoError(t, err)
prop1Bz, err := cdc.Marshal(&proposal1)
require.NoError(t, err)
store.Set(v1gov.ProposalKey(proposal1.Id), prop1Bz)

proposal2, err := v1.NewProposal(getTestProposal(), 2, "some metadata for the legacy content", propTime, propTime, "Test", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
proposal2, err := v1.NewProposal(getTestProposal(), 2, propTime, propTime, "some metadata for the legacy content", "Test", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
proposal2.Status = v1.StatusVotingPeriod
require.NoError(t, err)
prop2Bz, err := cdc.Marshal(&proposal2)
Expand Down
8 changes: 4 additions & 4 deletions x/gov/simulation/operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestSimulateMsgCancelProposal(t *testing.T) {
submitTime := ctx.BlockHeader().Time
depositPeriod := suite.GovKeeper.GetParams(ctx).MaxDepositPeriod

proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, "", submitTime, submitTime.Add(*depositPeriod), "title", "summary", proposer)
proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "title", "summary", proposer)
require.NoError(t, err)

suite.GovKeeper.SetProposal(ctx, proposal)
Expand Down Expand Up @@ -210,7 +210,7 @@ func TestSimulateMsgDeposit(t *testing.T) {
submitTime := ctx.BlockHeader().Time
depositPeriod := suite.GovKeeper.GetParams(ctx).MaxDepositPeriod

proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, "", submitTime, submitTime.Add(*depositPeriod), "text proposal", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "text proposal", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
require.NoError(t, err)

suite.GovKeeper.SetProposal(ctx, proposal)
Expand Down Expand Up @@ -256,7 +256,7 @@ func TestSimulateMsgVote(t *testing.T) {
submitTime := ctx.BlockHeader().Time
depositPeriod := suite.GovKeeper.GetParams(ctx).MaxDepositPeriod

proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, "", submitTime, submitTime.Add(*depositPeriod), "text proposal", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "text proposal", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
require.NoError(t, err)

suite.GovKeeper.ActivateVotingPeriod(ctx, proposal)
Expand Down Expand Up @@ -299,7 +299,7 @@ func TestSimulateMsgVoteWeighted(t *testing.T) {
submitTime := ctx.BlockHeader().Time
depositPeriod := suite.GovKeeper.GetParams(ctx).MaxDepositPeriod

proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, "", submitTime, submitTime.Add(*depositPeriod), "text proposal", "test", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "text proposal", "test", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
require.NoError(t, err)

suite.GovKeeper.ActivateVotingPeriod(ctx, proposal)
Expand Down
2 changes: 1 addition & 1 deletion x/gov/types/v1/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
)

// NewProposal creates a new Proposal instance
func NewProposal(messages []sdk.Msg, id uint64, metadata string, submitTime, depositEndTime time.Time, title, summary string, proposer sdk.AccAddress) (Proposal, error) {
func NewProposal(messages []sdk.Msg, id uint64, submitTime, depositEndTime time.Time, metadata, title, summary string, proposer sdk.AccAddress) (Proposal, error) {
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved
msgs, err := sdktx.SetMsgs(messages)
if err != nil {
return Proposal{}, err
Expand Down
2 changes: 1 addition & 1 deletion x/gov/types/v1/proposals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestNestedAnys(t *testing.T) {
testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal")
msgContent, err := v1.NewLegacyContent(testProposal, "cosmos1govacct")
require.NoError(t, err)
proposal, err := v1.NewProposal([]sdk.Msg{msgContent}, 1, "", time.Now(), time.Now(), "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
proposal, err := v1.NewProposal([]sdk.Msg{msgContent}, 1, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
require.NoError(t, err)

require.NotPanics(t, func() { _ = proposal.String() })
Expand Down