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

feat: add MsgWithdrawProposal to group module #10893

Merged
merged 234 commits into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from 232 commits
Commits
Show all changes
234 commits
Select commit Hold shift + click to select a range
32cb63a
remove Request suffix from Msg types
likhita-809 Oct 29, 2021
fe6a8d5
wip
likhita-809 Nov 8, 2021
246484e
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 8, 2021
e274069
wip
likhita-809 Nov 9, 2021
4203f24
wip
likhita-809 Nov 9, 2021
743520c
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 9, 2021
3f4179e
wip
likhita-809 Nov 9, 2021
acad315
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 17, 2021
be27cba
wip
likhita-809 Nov 18, 2021
71c2dee
run go mod tidy
likhita-809 Nov 18, 2021
a864359
small change
likhita-809 Nov 18, 2021
18794db
wip
likhita-809 Nov 22, 2021
3851900
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 22, 2021
36b07b3
wip
likhita-809 Nov 22, 2021
efb22ee
fix something
likhita-809 Nov 22, 2021
1edaf8c
wip
likhita-809 Nov 23, 2021
3d5c37d
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 23, 2021
87054b8
wip
likhita-809 Nov 23, 2021
164a153
wip
likhita-809 Nov 23, 2021
0f6028b
run go mod tidy
likhita-809 Nov 23, 2021
d4156a2
wip
likhita-809 Nov 23, 2021
c473327
wip
likhita-809 Nov 23, 2021
491ff91
fix tests
likhita-809 Nov 23, 2021
8bcbbf7
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 24, 2021
ec93341
add keeper tests
likhita-809 Nov 25, 2021
624726b
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 25, 2021
ac4e247
address comments
likhita-809 Nov 25, 2021
f8a74b6
use single MsgServiceRouter
likhita-809 Nov 25, 2021
308852e
address review comments
likhita-809 Nov 25, 2021
f5fdbea
fix something
likhita-809 Nov 25, 2021
2c405d3
Update import
blushi Nov 25, 2021
100c4f4
delete conditions.go file
likhita-809 Nov 25, 2021
977c94e
Merge branch 'likhita/group-server-implementation' of https://github.…
likhita-809 Nov 25, 2021
ca772c6
fix something
likhita-809 Nov 25, 2021
020e58f
add func to run TestSuite
likhita-809 Nov 25, 2021
140fbb8
Set accKeeper in group keeper
blushi Nov 25, 2021
abbe3ba
update keeper_test
likhita-809 Nov 25, 2021
8ed012a
Merge branch 'likhita/group-server-implementation' of https://github.…
likhita-809 Nov 25, 2021
bf9a57f
Fix timeout duration in test
blushi Nov 25, 2021
d11be84
Fix get group account
blushi Nov 25, 2021
edaa1c7
fix failed test case in keeper
likhita-809 Nov 26, 2021
177ac08
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 26, 2021
50f3241
Fix some tests
blushi Nov 26, 2021
2c3a4c0
Merge branch 'likhita/group-server-implementation' of github.com:cosm…
blushi Nov 26, 2021
66db140
Rm unneeded set policy
blushi Nov 26, 2021
410e96d
Fix more tests related to ctx not being cached
blushi Nov 26, 2021
d76908e
Fix keeper_tests
blushi Nov 29, 2021
8c1f888
Rm derivation key
blushi Nov 29, 2021
334c667
Merge branch 'master' into likhita/group-server-implementation
blushi Nov 29, 2021
2f7f72c
proto-gen
blushi Nov 29, 2021
00b8cdb
go mod tidy
blushi Nov 29, 2021
9c614ab
Merge branch 'likhita/group-server-implementation' of https://github.…
likhita-809 Nov 30, 2021
f44a1e6
add genesis proto files
likhita-809 Nov 30, 2021
ae4f551
add genesis import/export
likhita-809 Nov 30, 2021
952743d
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 30, 2021
0782451
proto-gen
likhita-809 Nov 30, 2021
1e6cc91
few changes to genesis files
likhita-809 Dec 1, 2021
10cefb7
Update proto wip
blushi Dec 1, 2021
1501297
Merge branch 'master' into likhita/group-server-implementation
blushi Dec 1, 2021
8a0f415
Fix tests
blushi Dec 1, 2021
52fad21
proto lint
blushi Dec 1, 2021
318d527
go mod tidy
blushi Dec 1, 2021
799d411
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 2, 2021
5921731
Merge branch 'likhita/add-group-genesis' of https://github.com/cosmos…
likhita-809 Dec 2, 2021
22d706e
add genesis tests
likhita-809 Dec 2, 2021
7c3f392
Merge branch 'likhita/add-group-genesis' of https://github.com/cosmos…
likhita-809 Dec 2, 2021
fef1c22
fix failing tests
likhita-809 Dec 2, 2021
b60e179
go mdo tidy
likhita-809 Dec 2, 2021
e2e26d0
Use existing TestMsg
blushi Dec 2, 2021
bdfa1f8
Merge branch 'master' into likhita/group-server-implementation
blushi Dec 2, 2021
12a2f32
go mod
blushi Dec 2, 2021
5422f59
Update x/group/keeper/msg_server.go
blushi Dec 2, 2021
6c8886d
Address review comments
blushi Dec 2, 2021
de9584d
Merge branch 'likhita/group-server-implementation' of github.com:cosm…
blushi Dec 2, 2021
b6442dc
tidy
blushi Dec 2, 2021
1b91a39
group module changes for genesis
likhita-809 Dec 2, 2021
9995ce1
remove unused imports
likhita-809 Dec 2, 2021
48c10a1
Merge branch 'master' into likhita/group-server-implementation
likhita-809 Dec 6, 2021
a4a8d8d
register group in stores
likhita-809 Dec 6, 2021
58ae1ac
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 6, 2021
7cdeccc
Use BigEndian
blushi Dec 8, 2021
9bbcaba
Merge branch 'master' into likhita/group-server-implementation
blushi Dec 8, 2021
8994138
address review comments
likhita-809 Dec 8, 2021
3876313
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 8, 2021
daa70d9
small change
likhita-809 Dec 8, 2021
f911eda
Merge branch 'master' into likhita/group-server-implementation
blushi Dec 9, 2021
4ecc776
Merge branch 'likhita/group-server-implementation' into likhita/add-g…
blushi Dec 9, 2021
65d962d
Fix tests
blushi Dec 9, 2021
81dd664
Use derivation for group acc addr
blushi Dec 9, 2021
ecb2cbc
Merge branch 'likhita/add-group-genesis' into marie/9901-group-sim
blushi Dec 9, 2021
f00433e
Add simulation WIP
blushi Dec 9, 2021
503c6b0
Fix operations and wire up random gen
blushi Dec 9, 2021
26435ec
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 10, 2021
b38c26d
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 10, 2021
6c72bd5
go mod tidy
likhita-809 Dec 10, 2021
82130f8
Decoder tests WIP
blushi Dec 10, 2021
9f0b1e9
Merge branch 'master' into likhita/group-server-implementation
blushi Dec 10, 2021
0cde5c3
Merge branch 'likhita/group-server-implementation' into marie/9901-gr…
blushi Dec 10, 2021
fa6ed11
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 11, 2021
d473d87
fix something
likhita-809 Dec 11, 2021
140804c
fix something
likhita-809 Dec 11, 2021
026d396
fix some tests
likhita-809 Dec 14, 2021
4165132
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 14, 2021
81f7f9a
go mod tidy
likhita-809 Dec 14, 2021
ef71946
fix tests
atheeshp Dec 15, 2021
6ea57af
fix test
atheeshp Dec 15, 2021
6b34c6c
fix tests
likhita-809 Dec 15, 2021
e3f6b6b
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 15, 2021
8298b4a
refactor keeper test
likhita-809 Dec 15, 2021
7aa07b3
Merge branch 'master' into marie/9901-group-sim
blushi Dec 16, 2021
55450e2
Fix simapp
blushi Dec 16, 2021
d1cf191
Add group sim tests wip
blushi Dec 16, 2021
a902aa3
tidy
blushi Dec 16, 2021
3afe8e9
fix tests
likhita-809 Dec 16, 2021
cf8bb27
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 16, 2021
ef4959e
go mod tidy
likhita-809 Dec 16, 2021
33dcaf2
revert keeper_test
likhita-809 Dec 16, 2021
fc80e7d
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 16, 2021
3c1cb40
Merge branch 'master' into likhita/add-group-genesis
likhita-809 Dec 17, 2021
82264ba
address review comment
likhita-809 Dec 17, 2021
c8ffac7
Merge branch 'likhita/add-group-genesis' of https://github.com/cosmos…
likhita-809 Dec 17, 2021
51487d1
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 19, 2021
e1305ca
go mod tidy
likhita-809 Dec 20, 2021
3b3737e
add genesis validation and related tests
likhita-809 Dec 22, 2021
910c9d9
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 22, 2021
53db0f4
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 22, 2021
05d4a1e
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Dec 23, 2021
ba3b5cb
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Jan 3, 2022
a99f140
go mod tidy
likhita-809 Jan 3, 2022
5ed1c54
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Jan 3, 2022
582e6ca
Merge branch 'master' into likhita/add-group-genesis
likhita-809 Jan 4, 2022
d369722
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Jan 5, 2022
4be1df8
Merge branch 'likhita/add-group-genesis' of https://github.com/cosmos…
likhita-809 Jan 5, 2022
08984fb
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Jan 5, 2022
e7cd038
rename group account to group policy in group genesis
likhita-809 Jan 5, 2022
c53d6d9
address few comments
likhita-809 Jan 5, 2022
2042000
add `MsgWithdrawProposal` (WIP)
atheeshp Jan 6, 2022
79f293e
address review comments
likhita-809 Jan 6, 2022
df98bf6
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Jan 6, 2022
f726f29
fix few tests
likhita-809 Jan 6, 2022
2998fae
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Jan 6, 2022
58eea10
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Jan 6, 2022
753ba43
add `msg_server`and tests
atheeshp Jan 6, 2022
c1ffd12
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 6, 2022
e2c3a41
wip on operations test
blushi Jan 6, 2022
5b189e1
Wrap up operations
blushi Jan 6, 2022
f9935ad
Merge branch 'master' into marie/9901-group-sim
blushi Jan 6, 2022
0d3a14d
Merge branch 'likhita/add-group-genesis' into marie/9901-group-sim
blushi Jan 6, 2022
51c0d4b
Fix SimulateMsgCreateProposal
blushi Jan 7, 2022
b13667e
Fix rand
blushi Jan 7, 2022
8ad58fb
Return no op for proposals that cannot pass
blushi Jan 7, 2022
95ceeca
Fix SimulateMsgVote
blushi Jan 7, 2022
eb3dbcf
add cli & tests
atheeshp Jan 10, 2022
42178c9
make proto-gen
atheeshp Jan 10, 2022
18123a6
add changelog
atheeshp Jan 10, 2022
c6634ea
Merge branch 'master' into marie/9901-group-sim
blushi Jan 11, 2022
697a627
Add logs
blushi Jan 13, 2022
253af3a
Merge branch 'master' into marie/9901-group-sim
blushi Jan 13, 2022
713bb12
Return no-op if group/group policy modified
blushi Jan 13, 2022
6ed7d36
Fix group msgs tests
blushi Jan 13, 2022
4397cb3
Rm unused
blushi Jan 13, 2022
9cdf0e8
Fix params test
blushi Jan 13, 2022
8abec3d
Fix no op
blushi Jan 13, 2022
c6fd43e
Filter member that already voted
blushi Jan 13, 2022
1653193
Fix non determinism in genesis
blushi Jan 14, 2022
dda857f
Clean up
blushi Jan 14, 2022
4bf6498
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 18, 2022
68584a4
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 19, 2022
c248c0c
update changes
atheeshp Jan 19, 2022
cb01bed
go mod tidy
atheeshp Jan 19, 2022
71bdd7f
Merge branch 'master' into marie/9901-group-sim
blushi Jan 19, 2022
c61d5a8
Update x/group/simulation/operations.go
blushi Jan 19, 2022
dcc37bb
Update x/group/simulation/operations.go
blushi Jan 19, 2022
2b33115
Update x/group/simulation/operations.go
blushi Jan 19, 2022
9c34681
Update x/group/simulation/operations.go
blushi Jan 19, 2022
bfa87c5
Update x/group/simulation/operations.go
blushi Jan 19, 2022
4ea9242
Apply suggestions from code review
blushi Jan 19, 2022
43dccdc
review changes
atheeshp Jan 19, 2022
ee55bf7
review changes
atheeshp Jan 19, 2022
844bf2e
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 19, 2022
7fa623c
fix tests
atheeshp Jan 19, 2022
9322f83
fix tests
atheeshp Jan 19, 2022
b53b4ea
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 19, 2022
c6f2e14
review changes
atheeshp Jan 19, 2022
2eec4e2
Merge branch 'master' into marie/9901-group-sim
blushi Jan 19, 2022
0c6c2e7
Merge branch 'master' into marie/9901-group-sim
blushi Jan 20, 2022
5a9ac71
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 20, 2022
f2d6f0e
review changes
atheeshp Jan 20, 2022
6cb665f
update docs
atheeshp Jan 20, 2022
5c21a97
Fix msg type name
blushi Jan 20, 2022
18cc425
Update x/group/simulation/decoder.go
blushi Jan 20, 2022
eccfd84
Merge branch 'master' into marie/9901-group-sim
blushi Jan 20, 2022
f6db995
Merge branch 'master' into marie/9901-group-sim
blushi Jan 21, 2022
0af0bb3
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 21, 2022
6377622
add msg tests
atheeshp Jan 21, 2022
df92ff9
Merge branch 'marie/9901-group-sim' of github.com:cosmos/cosmos-sdk i…
atheeshp Jan 21, 2022
40265d2
update simulations
atheeshp Jan 21, 2022
181205e
update tests
atheeshp Jan 21, 2022
7bf7608
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 24, 2022
aa8de8f
Merge branch 'ap/withdraw-proposal-sims' of github.com:cosmos/cosmos-…
atheeshp Jan 24, 2022
cd5cf33
Merge branch 'master' into ap/withdraw-proposal
atheeshp Jan 25, 2022
f08a2ec
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 25, 2022
bd0e7bb
Merge branch 'ap/withdraw-proposal' of github.com:cosmos/cosmos-sdk i…
atheeshp Jan 25, 2022
e945fc6
fix sims
atheeshp Jan 25, 2022
e920e9b
fix sim
atheeshp Jan 25, 2022
c5311dd
fix test
atheeshp Jan 25, 2022
79a44a9
udpate tests
atheeshp Jan 25, 2022
523eaf9
Merge branch 'master' into ap/withdraw-proposal
atheeshp Jan 25, 2022
1f4edf4
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 25, 2022
2a3253c
fix tests
atheeshp Jan 25, 2022
4d5dfe8
Merge branch 'ap/withdraw-proposal' of github.com:cosmos/cosmos-sdk i…
atheeshp Jan 25, 2022
0b9ccd4
update tests
atheeshp Jan 25, 2022
4e8941f
update tests
atheeshp Jan 25, 2022
6a2f3c3
fix tests
atheeshp Jan 25, 2022
fcb07ef
Merge branch 'master' into ap/withdraw-proposal
atheeshp Jan 25, 2022
d410b3b
review change
atheeshp Jan 25, 2022
4fd5fb0
Merge branch 'ap/withdraw-proposal' of github.com:cosmos/cosmos-sdk i…
atheeshp Jan 25, 2022
0c3ef62
fix tests
atheeshp Jan 25, 2022
968557e
update tests
atheeshp Jan 25, 2022
a2ebb2a
Update x/group/simulation/operations.go
atheeshp Jan 26, 2022
15c0e7e
Merge branch 'master' into ap/withdraw-proposal
atheeshp Jan 26, 2022
f2737a7
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 27, 2022
9ee10b9
Merge branch 'master' into ap/withdraw-proposal
atheeshp Jan 27, 2022
1511673
Merge branch 'master' into ap/withdraw-proposal
atheeshp Jan 28, 2022
342c5a4
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 31, 2022
62ebd0d
make proto-gen
atheeshp Jan 31, 2022
701bf6c
update sim
atheeshp Jan 31, 2022
d6c052a
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Jan 31, 2022
8e32cf7
Merge branch 'ap/withdraw-proposal' of github.com:cosmos/cosmos-sdk i…
atheeshp Jan 31, 2022
fc37d74
Merge branch 'master' into ap/withdraw-proposal
atheeshp Feb 1, 2022
6e6ebd1
Merge branch 'master' of github.com:cosmos/cosmos-sdk into ap/withdra…
atheeshp Feb 3, 2022
dbe961b
update tests
atheeshp Feb 3, 2022
b8cc814
Merge branch 'master' into ap/withdraw-proposal
amaury1093 Feb 3, 2022
d3a0a3f
Merge branch 'master' into ap/withdraw-proposal
blushi Feb 4, 2022
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
522 changes: 490 additions & 32 deletions api/cosmos/group/v1beta1/events.pulsar.go

Large diffs are not rendered by default.

1,261 changes: 1,101 additions & 160 deletions api/cosmos/group/v1beta1/tx.pulsar.go

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions api/cosmos/group/v1beta1/tx_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

168 changes: 88 additions & 80 deletions api/cosmos/group/v1beta1/types.pulsar.go

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions proto/cosmos/group/v1beta1/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ message EventCreateProposal {
uint64 proposal_id = 1;
}

// EventWithdrawProposal is an event emitted when a proposal is withdrawn.
message EventWithdrawProposal {

// proposal_id is the unique ID of the proposal.
uint64 proposal_id = 1;
}

// EventVote is an event emitted when a voter votes on a proposal.
message EventVote {

Expand Down
15 changes: 15 additions & 0 deletions proto/cosmos/group/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ service Msg {
// CreateProposal submits a new proposal.
rpc CreateProposal(MsgCreateProposal) returns (MsgCreateProposalResponse);

// WithdrawProposal aborts a proposal.
rpc WithdrawProposal(MsgWithdrawProposal) returns (MsgWithdrawProposalResponse);

// Vote allows a voter to vote on a proposal.
rpc Vote(MsgVote) returns (MsgVoteResponse);

Expand Down Expand Up @@ -258,6 +261,18 @@ message MsgCreateProposalResponse {
uint64 proposal_id = 1;
}

// MsgWithdrawProposal is the Msg/WithdrawProposal request type.
message MsgWithdrawProposal {
// proposal is the unique ID of the proposal.
uint64 proposal_id = 1;

// address is the admin of the group policy or one of the proposer of the proposal.
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type.
message MsgWithdrawProposalResponse {}

// MsgVote is the Msg/Vote request type.
message MsgVote {
option (cosmos.msg.v1.signer) = "voter";
Expand Down
3 changes: 1 addition & 2 deletions proto/cosmos/group/v1beta1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,9 @@ message Proposal {
// Final status of a proposal when the group was modified before the final tally.
STATUS_ABORTED = 3 [(gogoproto.enumvalue_customname) = "ProposalStatusAborted"];

// TODO: do we want to support a withdrawn operation?
// A proposal can be deleted before the voting start time by the owner. When this happens the final status
// is Withdrawn.
// STATUS_WITHDRAWN = 4 [(gogoproto.enumvalue_customname) = "Withdrawn"];
STATUS_WITHDRAWN = 4 [(gogoproto.enumvalue_customname) = "ProposalStatusWithdrawn"];
}

// Status represents the high level position in the life cycle of the proposal. Initial value is Submitted.
Expand Down
51 changes: 51 additions & 0 deletions x/group/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,57 @@ Parameters:
return cmd
}

// MsgWithdrawProposalCmd creates a CLI command for Msg/WithdrawProposal.
func MsgWithdrawProposalCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "withdraw-proposal [proposal-id] [group-policy-admin-or-proposer]",
Short: "Withdraw a submitted proposal",
Long: `Withdraw a submitted proposal.

Parameters:
proposal-id: unique ID of the proposal.
group-policy-admin-or-proposer: either admin of the group policy or one the proposer of the proposal.
(note: --from flag will be ignored here)
`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
err := cmd.Flags().Set(flags.FlagFrom, args[1])
if err != nil {
return err
}

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

proposalID, err := strconv.ParseUint(args[0], 10, 64)
if err != nil {
return err
}

msg := &group.MsgWithdrawProposal{
ProposalId: proposalID,
Address: clientCtx.GetFromAddress().String(),
}

if err != nil {
return err
}

if err = msg.ValidateBasic(); err != nil {
return fmt.Errorf("message validation failed: %w", err)
}

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}

flags.AddTxFlagsToCmd(cmd)

return cmd
}

// MsgVoteCmd creates a CLI command for Msg/Vote.
func MsgVoteCmd() *cobra.Command {
cmd := &cobra.Command{
Expand Down
164 changes: 159 additions & 5 deletions x/group/client/testutil/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,16 @@ func (s *IntegrationTestSuite) SetupSuite() {
}

// create a group
validMembers := fmt.Sprintf(`{"members": [{
"address": "%s",
"weight": "3",
"metadata": "%s"
}]}`, val.Address.String(), validMetadata)
validMembers := fmt.Sprintf(`
{
"members": [
{
"address": "%s",
"weight": "3",
"metadata": "%s"
}
]
}`, val.Address.String(), validMetadata)
validMembersFile := testutil.WriteToNewTempFile(s.T(), validMembers)
out, err := cli.ExecTestCLICmd(val.ClientCtx, client.MsgCreateGroupCmd(),
append(
Expand Down Expand Up @@ -1505,6 +1510,155 @@ func (s *IntegrationTestSuite) TestTxVote() {
}
}

func (s *IntegrationTestSuite) TestTxWithdrawProposal() {
val := s.network.Validators[0]
clientCtx := val.ClientCtx

var commonFlags = []string{
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
}

ids := make([]string, 2)

validTxFileName := getTxSendFileName(s, s.groupPolicies[1].Address, val.Address.String())
for i := 0; i < 2; i++ {
out, err := cli.ExecTestCLICmd(val.ClientCtx, client.MsgCreateProposalCmd(),
append(
[]string{
s.groupPolicies[1].Address,
val.Address.String(),
validTxFileName,
"",
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
},
commonFlags...,
),
)
s.Require().NoError(err, out.String())

var txResp sdk.TxResponse
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String())
s.Require().Equal(uint32(0), txResp.Code, out.String())
ids[i] = s.getProposalIdFromTxResponse(txResp)
}

testCases := []struct {
name string
args []string
expectErr bool
expectErrMsg string
respType proto.Message
expectedCode uint32
}{
{
"correct data",
append(
[]string{
ids[0],
val.Address.String(),
},
commonFlags...,
),
false,
"",
&sdk.TxResponse{},
0,
},
{
"already withdrawn proposal",
append(
[]string{
ids[0],
val.Address.String(),
},
commonFlags...,
),
true,
"cannot withdraw a proposal with the status of STATUS_WITHDRAWN",
&sdk.TxResponse{},
0,
},
{
"proposal not found",
append(
[]string{
"222",
"wrongAdmin",
},
commonFlags...,
),
true,
"not found",
&sdk.TxResponse{},
0,
},
{
"invalid proposal",
append(
[]string{
"abc",
val.Address.String(),
},
commonFlags...,
),
true,
"invalid syntax",
&sdk.TxResponse{},
0,
},
{
"wrong admin",
append(
[]string{
ids[1],
"wrongAdmin",
},
commonFlags...,
),
true,
"key not found",
&sdk.TxResponse{},
0,
},
}

for _, tc := range testCases {
tc := tc

s.Run(tc.name, func() {
cmd := client.MsgWithdrawProposalCmd()

out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
if tc.expectErr {
s.Require().Contains(out.String(), tc.expectErrMsg)
} else {
s.Require().NoError(err, out.String())
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String())

txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code, out.String())
}
})
}
}

func (s *IntegrationTestSuite) getProposalIdFromTxResponse(txResp sdk.TxResponse) string {
s.Require().Greater(len(txResp.Logs), 0)
s.Require().NotNil(txResp.Logs[0].Events)
events := txResp.Logs[0].Events
createProposalEvent, _ := sdk.TypedEventToEvent(&group.EventCreateProposal{})

for _, e := range events {
if e.Type == createProposalEvent.Type {
return strings.ReplaceAll(e.Attributes[0].Value, "\"", "")
}
}

return ""
}

func (s *IntegrationTestSuite) TestTxExec() {
val := s.network.Validators[0]
clientCtx := val.ClientCtx
Expand Down
2 changes: 2 additions & 0 deletions x/group/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgUpdateGroupPolicyDecisionPolicy{}, "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicy", nil)
cdc.RegisterConcrete(&MsgUpdateGroupPolicyMetadata{}, "cosmos-sdk/MsgUpdateGroupPolicyMetadata", nil)
cdc.RegisterConcrete(&MsgCreateProposal{}, "cosmos-sdk/group/MsgCreateProposal", nil)
cdc.RegisterConcrete(&MsgWithdrawProposal{}, "cosmos-sdk/group/MsgWithdrawProposal", nil)
cdc.RegisterConcrete(&MsgVote{}, "cosmos-sdk/group/MsgVote", nil)
cdc.RegisterConcrete(&MsgExec{}, "cosmos-sdk/group/MsgExec", nil)
}
Expand All @@ -37,6 +38,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
&MsgUpdateGroupPolicyDecisionPolicy{},
&MsgUpdateGroupPolicyMetadata{},
&MsgCreateProposal{},
&MsgWithdrawProposal{},
&MsgVote{},
&MsgExec{},
)
Expand Down
Loading