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

Porting: gov module #7

Merged
merged 56 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
20c7bab
add: port gov module
Raneet10 Oct 11, 2023
5fabe14
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 14, 2024
6ae10dc
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 15, 2024
2529319
chg: implement WeightedVoteOptions with constraints
marcello33 Feb 15, 2024
e1a6c2f
chg: better TODOs descriptions
marcello33 Feb 15, 2024
246fce5
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 15, 2024
f159c6d
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 16, 2024
ae5a857
chg: POS-2135: fix some tests
marcello33 Feb 19, 2024
8d85eb1
chg: POS-2135: fix more tests
marcello33 Feb 19, 2024
0dc2578
chg: POS-2135: update an address format
marcello33 Feb 19, 2024
f53183e
chg: fix few more tests
marcello33 Feb 19, 2024
705b5e8
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 19, 2024
4010477
chg: fix few more tests
marcello33 Feb 19, 2024
1b93e32
chg: fix some tests / temp revert some others to properly tune params…
marcello33 Feb 21, 2024
ae2226d
chg: fix TestHooks
marcello33 Feb 21, 2024
ae826fb
chg: fix burn related methods / fix tests
marcello33 Feb 21, 2024
36d79e4
chg: fix query for WeightedVoteOptions / better comments
marcello33 Feb 21, 2024
8ea74f0
chg: fix all tests in gov module
marcello33 Feb 21, 2024
89cac52
chg: fix a staking integration test
marcello33 Feb 21, 2024
c92a5e0
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 21, 2024
e85fe55
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 22, 2024
c793367
chg: POS-2142: edit gov readme
marcello33 Feb 22, 2024
d4fc81d
chg: use AccAddressFromHex in tests instead of addressCodec
marcello33 Feb 22, 2024
28f9940
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 22, 2024
756fcf2
chg: enable one test / provide better context for the only skipped test
marcello33 Feb 22, 2024
9b9609a
chg: use hex acc addresses in gov tests
marcello33 Feb 23, 2024
ba0eac3
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 23, 2024
2031f34
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 26, 2024
3ecf8d5
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 26, 2024
069cbf0
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 26, 2024
f00a504
chg: return empty string on ProposalType normalization
marcello33 Feb 26, 2024
d6ffea2
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 26, 2024
d22489d
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 27, 2024
7ca5b40
chg: remove TextProposals / add comment for Msgs auto-execution
marcello33 Feb 28, 2024
3b03e87
chg: re-enable textProposals / TBD with team
marcello33 Feb 28, 2024
8a1af2d
chg: remove comment
marcello33 Feb 28, 2024
90360da
chg: better context for HV2 TODOs
marcello33 Feb 29, 2024
4abf435
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Feb 29, 2024
13af779
chg: filter out non valid proposals msgs types and content
marcello33 Feb 29, 2024
e2011fb
chg: fix typeUrls
marcello33 Feb 29, 2024
f126f22
chg: filter out not supported messages at time of proposals submit / …
marcello33 Mar 1, 2024
72ea82b
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Mar 7, 2024
9f8955c
chg: go mod tidy
marcello33 Mar 7, 2024
39fd8a9
chg: address PR comments: filtering dedicated file / test msg types /…
marcello33 Mar 7, 2024
0223595
chg: register interfaces in gov test app
marcello33 Mar 8, 2024
21f52a1
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Mar 8, 2024
a3097b1
chg: better context for comments
marcello33 Mar 8, 2024
efc6cf5
chg: comment for future improvements
marcello33 Mar 12, 2024
3f551ab
chg: consistent example of gov tx for submit proposal
marcello33 Mar 12, 2024
ec29c6e
chg: add msgServers in testApp to allow additional MsgUpdateParams types
marcello33 Mar 12, 2024
f72216e
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Mar 15, 2024
268611f
chg: fix tests after merge
marcello33 Mar 15, 2024
942d844
chg: update go deps for sdk and simapp
marcello33 Mar 15, 2024
39dd6b9
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2129-gov
marcello33 Mar 15, 2024
1d959cc
chg: comment
marcello33 Apr 8, 2024
e2147a2
chg: comment in README for further actions
marcello33 Apr 8, 2024
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
3 changes: 1 addition & 2 deletions api/cosmos/gov/v1beta1/gov.pulsar.go

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

2 changes: 1 addition & 1 deletion api/cosmos/staking/v1beta1/staking.pulsar.go

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

2 changes: 1 addition & 1 deletion api/cosmos/staking/v1beta1/tx.pulsar.go

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

5 changes: 3 additions & 2 deletions proto/cosmos/gov/v1beta1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ message WeightedVoteOption {
];
}

// TextProposal defines a standard text proposal whose changes need to be
// manually updated in case of approval.
// TODO HV2: TextProposals are disabled in heimdall. Remove it and re-implement all tests?

// TextProposal defines a standard text proposal whose changes need to be manually updated in case of approval.
message TextProposal {
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
option (amino.name) = "cosmos-sdk/TextProposal";
Expand Down
4 changes: 3 additions & 1 deletion proto/cosmos/staking/v1beta1/staking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ message Description {
string details = 5;
}

// HV2: heimdall uses a different version of `Validator` in staking module, which will implement the ValidatorI

// Validator defines a validator, together with the total amount of the
// Validator's bond shares and their exchange rate to coins. Slashing results in
// a decrease in the exchange rate, allowing correct calculation of future
Expand All @@ -91,7 +93,7 @@ message Validator {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// operator_address defines the address of the validator's operator; bech encoded in JSON.
// operator_address defines the address of the validator's operator; hex encoded in JSON.
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// consensus_pubkey is the consensus public key of the validator, as a Protobuf Any.
google.protobuf.Any consensus_pubkey = 2 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"];
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/staking/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ message MsgCreateValidator {
];
// Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated.
// The validator address bytes and delegator address bytes refer to the same account while creating validator (defer
// only in bech32 notation).
// only in hex notation).
string delegator_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString", deprecated = true];
string validator_address = 5 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"];
google.protobuf.Any pubkey = 6 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"];
Expand Down
4 changes: 4 additions & 0 deletions proto/cosmos/upgrade/v1beta1/upgrade.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ message Plan {
google.protobuf.Any upgraded_client_state = 5 [deprecated = true];
}

// HV2: this was deleted from heimdall's gov/types/proposal.go.
// Did not remove it as it's only used in tests. Also it's marked as deprecated.
// Furthermore it's part of upgrade module heimdall won't use

// SoftwareUpgradeProposal is a gov Content type for initiating a software
// upgrade.
// Deprecated: This legacy proposal is deprecated in favor of Msg-based gov
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/gov/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,8 @@ func (s *E2ETestSuite) TestNewCmdWeightedVote() {
for _, tc := range testCases {
tc := tc
s.Run(tc.name, func() {
cmd := cli.NewCmdWeightedVote()
// TODO HV2: changed from NewCmdWeightedVote to NewCmdVote. Fix tests accordingly.
cmd := cli.NewCmdVote()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if weighted voting is not supported in Heimdall, would it nevertheless be simpler to leave this as NewCmdWeightedVote so that we spend less time re-doing the tests? (at the end of the day, this is test code)
Or are you planning on testing something else than what is tested in vanilla SDK v0.50.x?

This would also apply to file x/feegrant/client/cli/tx_test.go below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I agree. Changed it in the very beginning with the purpose of implementing some tests, but both are actually covered in the vanilla SDK. Reverted here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

clientCtx := val.ClientCtx
var txResp sdk.TxResponse

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/staking/keeper/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func initFixture(t testing.TB) *fixture {

stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[types.StoreKey]), accountKeeper, bankKeeper, authority.String(), addresscodec.NewHexCodec(), addresscodec.NewHexCodec())
// TODO HV2: init processors with proper supply.AccountProcessor (supply module has been merged with bank module upstream)
authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts, nil, []authtypes.AccountProcessor{})
authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts, nil /*[]authtypes.AccountProcessor{}*/)
bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper, nil)
stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper, nil)

Expand Down
2 changes: 1 addition & 1 deletion types/staking.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
DefaultBondDenom = "matic"

// DefaultPowerReduction is the default amount of staking tokens required for 1 unit of consensus-engine power
DefaultPowerReduction = sdkmath.NewIntFromUint64(1000000)
DefaultPowerReduction = sdkmath.NewIntFromUint64(1000000000000000000)
)

// TokensToConsensusPower - convert input tokens to potential consensus-engine power
Expand Down
3 changes: 2 additions & 1 deletion x/feegrant/client/cli/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,8 @@ func (s *CLITestSuite) msgVote(clientCtx client.Context, from, id, vote string,
}, commonArgs...)

args = append(args, extraArgs...)
cmd := govcli.NewCmdWeightedVote()
// TODO HV2: changed from NewCmdWeightedVote to NewCmdVote. Fix tests accordingly.
cmd := govcli.NewCmdVote()

out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)

Expand Down
Loading
Loading