diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 1e410cb4..29fffef6 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -263,16 +263,6 @@ func NewAppKeeper( appKeepers.StakingKeeper, ) - // register the staking hooks - // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - appKeepers.StakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks( - appKeepers.DistrKeeper.Hooks(), - appKeepers.SlashingKeeper.Hooks(), - appKeepers.CoreDaosKeeper.StakingHooks(), - ), - ) - evidenceKeeper := evidencekeeper.NewKeeper( appCodec, runtime.NewKVStoreService(appKeepers.keys[evidencetypes.StoreKey]), @@ -284,6 +274,17 @@ func NewAppKeeper( // If evidence needs to be handled for the app, set routes in router here and seal appKeepers.EvidenceKeeper = *evidenceKeeper + // register the staking hooks + // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks + appKeepers.StakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks( + appKeepers.DistrKeeper.Hooks(), + appKeepers.SlashingKeeper.Hooks(), + appKeepers.GovKeeper.StakingHooks(), + appKeepers.CoreDaosKeeper.StakingHooks(), + ), + ) + // ICA Host keeper appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper( appCodec, diff --git a/app/modules.go b/app/modules.go index 19644a28..bf7d35df 100644 --- a/app/modules.go +++ b/app/modules.go @@ -191,8 +191,8 @@ func orderInitBlockers() []string { authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, - govtypes.ModuleName, stakingtypes.ModuleName, + govtypes.ModuleName, photontypes.ModuleName, slashingtypes.ModuleName, minttypes.ModuleName, diff --git a/docs/architecture/adr-006-governors.md b/docs/architecture/adr-006-governors.md new file mode 100644 index 00000000..f9e45b2b --- /dev/null +++ b/docs/architecture/adr-006-governors.md @@ -0,0 +1,121 @@ +# ADR 004: Governors System + +## Changelog + +- 2025-01-17: Initial version + +## Status + +Implemented (https://github.com/atomone-hub/atomone/pull/73) + +## Abstract + +This ADR proposes an enhanced governance model introducing “*Governors*” as a +special class of participants within the governance module. Unlike traditional +Cosmos-SDK governance, users can delegate their governance power to active +governors who meet specific eligibility criteria (e.g., minimum governance +self-delegation) while staking delegations to validators are not counted towards +determining their governance voting power (no validator inheritance). +The proposed changes alters vote tallying adding a separate and governance-specific +delegation mechanism to the one in `x/staking`, while trying to minimize impact on +tally and overall chain performance, and also define rules for transitioning +between governor statuses. The aim is to give the governance system a flexible +structure, enabling representative governance while maintaining the separation +of powers between validators and governors. + +## Context + +While the standard Cosmos-SDK governance module allows validators to vote on +proposals with all their delegated tokens unless delegators override their votes, +AtomOne removes this feature to prevent validators from having undue influence and +segregate the role of validator to securing the network. However, this approach +leads to the necessity for all users to be actively involved in governance, which +is not necessarily ideal. As of now, the governance module primarily relies on +on direct token voting (where each delegator votes with their own staked tokens). +However, as on-chain governance grows more complex, certain community members +might still prefer to delegate their voting power to specialized actors (governors) +that represent their political views. This shift requires formalizing participant +roles and creating processes for delegating power, ensuring alignment with the +network’s interests and enabling accurate tally calculations. + +## Decision + +1. Introduction of `Governor` Entities: + - A `Governor` is created through a `MsgCreateGovernor` transaction. + - The system enforces a minimum governance self-delegation requirement + before an account can achieve active governor status, which in practice + translates to a minimum stake requirement. + - The system tracks each governor’s address, description, status (e.g., active), + and last status change time (to limit frequent status toggles). + +2. Delegation and Undelegation: + - Users (delegators) can delegate their governance power to a governor via + `MsgDelegateGovernor`. Only a single governor can be chosen at a time, and + the delegation is always for the full voting power of the delegator. + - If a delegator wishes to delegate to a different governor, they may do so + directly, automatically redelegating from any existing governor, and this + can be done at any time with no restrictions, except for active governors + themselves which are force to delegate their governance power to themselves. + - A user can also choose to undelegate from a governor with + `MsgUndelegateGovernor`, reverting to direct voting only. + +3. Tally Logic: + - Each delegator’s staked tokens contribute to the total voting power of their + chosen governor since governance delegations are for the full voting power. + - During tallying, the system aggregates all delegated voting power plus any + governor’s own staked tokens (minus any deducted shares for direct votes by + delegators). + - Only votes from active governors or direct votes made by delegators are + counted. If a delegator votes directly, the corresponding shares are deducted + from the governor’s aggregated shares to avoid double counting (similarly + to how it's done in canonical Cosmos-SDK governance for validators). + +4. Transitioning Governor Status: + - A governor can switch their status (e.g., from inactive to active) by meeting + the min self-delegation threshold and updating their status with a + `MsgUpdateGovernorStatus`. Governors that set themselves to inactive are allowed + to delegate their governance voting power to another governor. A status change + can however only occur after a waiting period (`GovernorStatusChangePeriod`). + - Attempts to rapidly change status are disallowed; changes can only occur + after the specified waiting period (`GovernorStatusChangePeriod`). + +5. Parameters: + - `MinGovernorSelfDelegation`: The minimum number of tokens a governor must + stake to achieve or maintain active status. + - `GovernorStatusChangePeriod`: The time a governor must wait since the last + status change before being allowed to change status again. + +## Consequences + +### Positive + +- Allows specialized participants (governors) to manage governance responsibilities, +potentially improving governance participation. +- Reduces complexity for casual stakers by letting them delegate governance +authority without having to participate actively every proposal, while always retaining +the option to vote directly. +- Retain segregation from the staking delegations system allowing governance and +staking delegations to be managed independently. This however does not prevent a +validator from also being a governor, but the two roles are kept separate. + +### Negative + +- Introduces more complexity in the governance codebase and state, with potential +performance implications for tallying and querying. +- Requires users to learn how to delegate to or become a governor, which in itself +may be a hurdle for some users. +- Requires clients and frontends to adapt to the new governance model, potentially +requiring changes to existing interfaces. + +### Neutral + +- The fundamental governance mechanisms (e.g., proposals, deposit structures) +remain largely the same. +- Governor-based delegation is optional; delegators can still vote independently +if they prefer. + +## References + +- [GIST following discussions during AtomOne Constitution Working Group](https://gist.github.com/giunatale/95e9b43f6e265ba32b29e2769f7b8a37) +- [Governors System PR](https://github.com/atomone-hub/atomone/pull/73) +- [Governors Initial Implementation Draft PR](https://github.com/atomone-hub/atomone/pull/16) diff --git a/go.mod b/go.mod index 554b6f1e..d82c1894 100644 --- a/go.mod +++ b/go.mod @@ -50,6 +50,7 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20250414145226-207652e42e2e google.golang.org/grpc v1.72.0 google.golang.org/protobuf v1.36.6 + gopkg.in/yaml.v2 v2.4.0 gotest.tools/v3 v3.5.2 pgregory.net/rapid v1.2.0 ) @@ -241,7 +242,6 @@ require ( google.golang.org/api v0.222.0 // indirect google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250422160041-2d3770c4ea7f // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.11 // indirect sigs.k8s.io/yaml v1.4.0 // indirect diff --git a/proto/atomone/gov/v1/genesis.proto b/proto/atomone/gov/v1/genesis.proto index 20860a74..351348fb 100644 --- a/proto/atomone/gov/v1/genesis.proto +++ b/proto/atomone/gov/v1/genesis.proto @@ -56,4 +56,9 @@ message GenesisState { // If unset or set to 0, the quorum for the next law proposal will be set to // the params.LawMinQuorum value. string law_participation_ema = 14 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // governors defines all the governors present at genesis. + repeated Governor governors = 15; + // governance_delegations defines all the governance delegations present at genesis. + repeated GovernanceDelegation governance_delegations = 16; } diff --git a/proto/atomone/gov/v1/gov.proto b/proto/atomone/gov/v1/gov.proto index b5b5889c..e298829e 100644 --- a/proto/atomone/gov/v1/gov.proto +++ b/proto/atomone/gov/v1/gov.proto @@ -373,6 +373,14 @@ message Params { // Achievable quorum for law proposals QuorumRange law_quorum_range = 28 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // Defines the duration of time that need to elapse between governor status changes. + google.protobuf.Duration governor_status_change_period = 29 [(gogoproto.stdduration) = true]; + + // Defines the minimum amound of bonded tokens, aka the "self-delegation" (because active governors + // must have the governance VP from the base account automatically delegated to them), that a governor + // must have to be considered active. + string min_governor_self_delegation = 30 [(cosmos_proto.scalar) = "cosmos.Int" ]; } message QuorumRange { @@ -382,3 +390,77 @@ message QuorumRange { // Minimum achievable quorum string min = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; } + +// Governor defines a governor, together with the total amount of delegated +// validator's bond shares for a set amount of validators. When a delegator +// delegates a percentage of its x/gov power to a governor, the resulting +// shares from each delegators delegations in x/staking are added to the +// governor's total shares. +message Governor { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // governor_address defines the address of the governor; bech32-encoded. + string governor_address = 1; + // status is the status of the governor (active/inactive). + GovernorStatus status = 2; + // description defines the description terms for the governor. + GovernorDescription description = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // last_status_change_time is the time when the governor's status was last changed. + google.protobuf.Timestamp last_status_change_time = 4 [(gogoproto.stdtime) = true]; +} + +// GovernorStatus is the status of a governor. +enum GovernorStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // UNSPECIFIED defines an invalid governor status. + GOVERNOR_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "Unspecified"]; + // ACTIVE defines a governor that is active. + GOVERNOR_STATUS_ACTIVE = 1 [(gogoproto.enumvalue_customname) = "Active"]; + // INACTIVE defines a governor that is inactive. + GOVERNOR_STATUS_INACTIVE = 2 [(gogoproto.enumvalue_customname) = "Inactive"]; +} + +// Description defines a governor description. +message GovernorDescription { + option (gogoproto.equal) = true; + + // moniker defines a human-readable name for the governor. + string moniker = 1; + // identity defines an optional identity signature (ex. UPort or Keybase). + string identity = 2; + // website defines an optional website link. + string website = 3; + // security_contact defines an optional email for security contact. + string security_contact = 4; + // details define other optional details. + string details = 5; +} + +// GovernorValShares holds the number of virtual shares from the +// specific validator that a governor can use to vote on proposals. +message GovernorValShares { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string governor_address = 1; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + // shares define the delegation shares available from this validator. + string shares = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; +} + +// GovernanceDelegation defines a delegation of governance voting power from a +// delegator to a governor. +message GovernanceDelegation { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string governor_address = 2; +} diff --git a/proto/atomone/gov/v1/query.proto b/proto/atomone/gov/v1/query.proto index 48efe852..00103f59 100644 --- a/proto/atomone/gov/v1/query.proto +++ b/proto/atomone/gov/v1/query.proto @@ -81,10 +81,35 @@ service Query { option (google.api.http).get = "/atomone/gov/v1/quorums"; } - // ParticipationEMAs queries the state of the proposal participation exponential moving averages. + // ParticipationEMAs queries the state of the proposal participation exponential moving averages. rpc ParticipationEMAs(QueryParticipationEMAsRequest) returns (QueryParticipationEMAsResponse) { option (google.api.http).get = "/atomone/gov/v1/participationemas"; } + + // Governor queries governor information based on governor address. + rpc Governor(QueryGovernorRequest) returns (QueryGovernorResponse) { + option (google.api.http).get = "/atomone/gov/v1/governors/{governor_address}"; + } + + // Governors queries all governors. + rpc Governors(QueryGovernorsRequest) returns (QueryGovernorsResponse) { + option (google.api.http).get = "/atomone/gov/v1/governors"; + } + + // GovernanceDelegations queries all delegations of a governor. + rpc GovernanceDelegations(QueryGovernanceDelegationsRequest) returns (QueryGovernanceDelegationsResponse) { + option (google.api.http).get = "/atomone/gov/v1/governors/{governor_address}/delegations"; + } + + // GovernanceDelegation queries a delegation + rpc GovernanceDelegation(QueryGovernanceDelegationRequest) returns (QueryGovernanceDelegationResponse) { + option (google.api.http).get = "/atomone/gov/v1/delegations/{delegator_address}"; + } + + // GovernorValShares queries all governor virtual validator shares resulting from all governance delegations. + rpc GovernorValShares(QueryGovernorValSharesRequest) returns (QueryGovernorValSharesResponse) { + option (google.api.http).get = "/atomone/gov/v1/vshares/{governor_address}"; + } } // QueryConstitutionRequest is the request type for the Query/Constitution RPC method @@ -283,3 +308,78 @@ message QueryParticipationEMAsResponse { // law_participation_ema defines the requestedparticipation EMA for law proposals. string law_participation_ema = 3 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; } + +// QueryGovernorRequest is the request type for the Query/Governor RPC method. +message QueryGovernorRequest { + // gvernor_address defines the address of the governor. + string governor_address = 1 [(cosmos_proto.scalar) = "atomone.GovernorAddressString"]; +} + +// QueryGovernorResponse is the response type for the Query/Governor RPC method. +message QueryGovernorResponse { + // governor defines the requested governor. + Governor governor = 1; +} + +// QueryGovernorsRequest is the request type for the Query/Governors RPC method. +message QueryGovernorsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryGovernorsResponse is the response type for the Query/Governors RPC method. +message QueryGovernorsResponse { + // governors defines the requested governors. + repeated Governor governors = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryGovernanceDelegationsRequest is the request type for the Query/GovernanceDelegations RPC method. +message QueryGovernanceDelegationsRequest { + // governor_address defines the address of the governor. + string governor_address = 1 [(cosmos_proto.scalar) = "atomone.GovernorAddressString"]; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryGovernanceDelegationsResponse is the response type for the Query/GovernanceDelegations RPC method. +message QueryGovernanceDelegationsResponse { + // delegations defines the requested delegations. + repeated GovernanceDelegation delegations = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryGovernanceDelegationRequest is the request type for the Query/GovernanceDelegation RPC method. +message QueryGovernanceDelegationRequest { + // delegator_address defines the address of the delegator. + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// QueryGovernanceDelegationResponse is the response type for the Query/GovernanceDelegation RPC method. +message QueryGovernanceDelegationResponse { + // governor_address defines the address of the governor. + string governor_address = 1; +} + +// QueryGovernorValSharesRequest is the request type for the Query/GovernorValShares RPC method. +message QueryGovernorValSharesRequest { + // governor_address defines the address of the governor. + string governor_address = 1 [(cosmos_proto.scalar) = "atomone.GovernorAddressString"]; + + // pagination defines the pagination in the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryGovernorValSharesResponse is the response type for the Query/GovernorValShares RPC method. +message QueryGovernorValSharesResponse { + // val_shares defines the requested validator shares. + repeated GovernorValShares val_shares = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/proto/atomone/gov/v1/tx.proto b/proto/atomone/gov/v1/tx.proto index f05db7f9..6e1b8786 100644 --- a/proto/atomone/gov/v1/tx.proto +++ b/proto/atomone/gov/v1/tx.proto @@ -48,6 +48,23 @@ service Msg { // new constitution amendment. The authority is defined in the keeper. rpc ProposeConstitutionAmendment(MsgProposeConstitutionAmendment) returns (MsgProposeConstitutionAmendmentResponse); + + // CreateGovernor defines a method to create a new governor. + rpc CreateGovernor(MsgCreateGovernor) returns (MsgCreateGovernorResponse); + + // EditGovernor defines a method to edit an existing governor. + // It also sets its status. + rpc EditGovernor(MsgEditGovernor) returns (MsgEditGovernorResponse); + + // UpdateGovernorStatus defines a method to update the status of a governor. + rpc UpdateGovernorStatus(MsgUpdateGovernorStatus) returns (MsgUpdateGovernorStatusResponse); + + // DelegateGovernor defines a method to delegate a non-zero percentange of + // governance voting power from a delegator to a governor. + rpc DelegateGovernor(MsgDelegateGovernor) returns (MsgDelegateGovernorResponse); + + // UndelegateGovernor defines a method to undelegate governance voting power + rpc UndelegateGovernor(MsgUndelegateGovernor) returns (MsgUndelegateGovernorResponse); } // MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -220,4 +237,82 @@ message MsgProposeConstitutionAmendment { // MsgProposeConstitutionAmendmentResponse defines the response structure for executing a // MsgProposeConstitutionAmendment message. -message MsgProposeConstitutionAmendmentResponse {} \ No newline at end of file +message MsgProposeConstitutionAmendmentResponse {} + +// MsgCreateGovernor defines a SDK message for creating a new governor. +message MsgCreateGovernor { + option (cosmos.msg.v1.signer) = "address"; + option (amino.name) = "atomone/MsgCreateGovernor"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the base account address that is creating the governor. + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + GovernorDescription description = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgCreateGovernorrResponse defines the Msg/CreateGovernor response type. +message MsgCreateGovernorResponse {} + +// MsgEditGovernor defines a SDK message for editing an existing governor. +message MsgEditGovernor { + option (cosmos.msg.v1.signer) = "address"; + option (amino.name) = "cosmos-sdk/MsgEditGovernor"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the base account address that is editing the corresponding governor. + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + GovernorDescription description = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgEditGovernorResponse defines the Msg/EditGovernor response type. +message MsgEditGovernorResponse {} + +// MsgUpdateGovernorStatus defines a SDK message for updating the status of a governor. +message MsgUpdateGovernorStatus { + option (cosmos.msg.v1.signer) = "address"; + option (amino.name) = "cosmos-sdk/MsgUpdateGovernorStatus"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the base account address that is editing the corresponding governor. + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + GovernorStatus status = 2; +} + +// MsgUpdateGovernorStatusResponse defines the Msg/UpdateGovernorStatus response type. +message MsgUpdateGovernorStatusResponse {} + +// MsgDelegateGovernor defines a SDK message for performing a delegation of governance voting power +// from a delegator to a governor. +message MsgDelegateGovernor { + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "atomone/MsgDelegateGovernor"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string governor_address = 2; +} + +// MsgDelegateGovernorResponse defines the Msg/Delegate response type. +message MsgDelegateGovernorResponse {} + +// MsgUndelegateGovernor defines a SDK message for undelegating governance voting power +message MsgUndelegateGovernor { + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgUndelegateGovernor"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgUndelegateGovernorResponse defines the Msg/UndelegateGovernor response type. +message MsgUndelegateGovernorResponse {} diff --git a/tests/e2e/e2e_coredaos_test.go b/tests/e2e/e2e_coredaos_test.go index 01ec4cc1..ed4ce907 100644 --- a/tests/e2e/e2e_coredaos_test.go +++ b/tests/e2e/e2e_coredaos_test.go @@ -6,7 +6,6 @@ import ( coredaostypes "github.com/atomone-hub/atomone/x/coredaos/types" govtypesv1 "github.com/atomone-hub/atomone/x/gov/types/v1" - govtypesv1beta1 "github.com/atomone-hub/atomone/x/gov/types/v1beta1" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -30,7 +29,7 @@ func (s *IntegrationTestSuite) testCoreDAOs() { submitGovFlags := []string{configFile(proposalParamChangeFilename)} depositGovFlags := []string{strconv.Itoa(proposalCounter), s.queryGovMinDeposit(chainAAPIEndpoint).String()} voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} - s.submitGovProposal(chainAAPIEndpoint, senderAddress.String(), proposalCounter, "atomone.coredaos.v1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, senderAddress.String(), proposalCounter, "atomone.coredaos.v1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) newParams := s.queryCoreDAOsParams(chainAAPIEndpoint) s.Require().Equal(newParams.Params.SteeringDaoAddress, steeringDAOAddress.String()) @@ -161,7 +160,7 @@ func (s *IntegrationTestSuite) submitVotingPeriodLawProposal(c *chain) int { depositGovFlags = append(depositGovFlags, depositString) senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress() sender := senderAddress.String() - s.submitGovCommand(chainAAPIEndpoint, sender, proposalCounter, "submit-proposal", submitGovFlags, govtypesv1beta1.StatusDepositPeriod) - s.submitGovCommand(chainAAPIEndpoint, sender, proposalCounter, "deposit", depositGovFlags, govtypesv1beta1.StatusVotingPeriod) + s.submitGovCommand(chainAAPIEndpoint, sender, proposalCounter, "submit-proposal", submitGovFlags, govtypesv1.StatusDepositPeriod) + s.submitGovCommand(chainAAPIEndpoint, sender, proposalCounter, "deposit", depositGovFlags, govtypesv1.StatusVotingPeriod) return proposalCounter } diff --git a/tests/e2e/e2e_exec_test.go b/tests/e2e/e2e_exec_test.go index 18243d3f..902b902c 100644 --- a/tests/e2e/e2e_exec_test.go +++ b/tests/e2e/e2e_exec_test.go @@ -12,6 +12,7 @@ import ( rpchttp "github.com/cometbft/cometbft/rpc/client/http" + "cosmossdk.io/math" "cosmossdk.io/x/feegrant" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" @@ -473,11 +474,18 @@ func (s *IntegrationTestSuite) runGovExec(c *chain, valIdx int, submitterAddr, g // }) // } -func (s *IntegrationTestSuite) execDelegate(c *chain, valIdx int, amount, valOperAddress, delegatorAddr, home string) { //nolint:unparam +func (s *IntegrationTestSuite) execDelegate(c *chain, valIdx int, amount sdk.Coin, valOperAddress, delegatorAddr string) { //nolint:unparam ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() + chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp")) + existingDelegation := math.LegacyZeroDec() + res, err := s.queryDelegation(chainAAPIEndpoint, valOperAddress, delegatorAddr) + if err == nil { + existingDelegation = res.GetDelegationResponse().GetDelegation().GetShares() + } + s.T().Logf("Executing atomoned tx staking delegate %s", c.id) atomoneCommand := []string{ @@ -486,17 +494,31 @@ func (s *IntegrationTestSuite) execDelegate(c *chain, valIdx int, amount, valOpe stakingtypes.ModuleName, "delegate", valOperAddress, - amount, + amount.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, delegatorAddr), fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), + fmt.Sprintf("--%s=%s", flags.FlagGas, "250000"), // default 200000 isn't enough fmt.Sprintf("--%s=%s", flags.FlagFees, standardFees.String()), "--keyring-backend=test", - fmt.Sprintf("--%s=%s", flags.FlagHome, home), "--output=json", "-y", } s.executeAtomoneTxCommand(ctx, c, atomoneCommand, valIdx, s.defaultExecValidation(c, valIdx, nil)) + + // Validate delegation successful + chainAAPIEndpoint = fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp")) + s.Require().Eventually( + func() bool { + res, err := s.queryDelegation(chainAAPIEndpoint, valOperAddress, delegatorAddr) + s.Require().NoError(err) + amt := res.GetDelegationResponse().GetDelegation().GetShares() + + return amt.Equal(existingDelegation.Add(math.LegacyNewDecFromInt(amount.Amount))) + }, + 20*time.Second, + time.Second, + ) s.T().Logf("%s successfully delegated %s to %s", delegatorAddr, amount, valOperAddress) } @@ -572,7 +594,7 @@ func (s *IntegrationTestSuite) execRedelegate(c *chain, valIdx int, amount, orig amount, fmt.Sprintf("--%s=%s", flags.FlagFrom, delegatorAddr), fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - fmt.Sprintf("--%s=%s", flags.FlagGas, "300000"), // default 200000 isn't enough + fmt.Sprintf("--%s=%s", flags.FlagGas, "350000"), // default 200000 isn't enough fmt.Sprintf("--%s=%s", flags.FlagFees, standardFees.String()), "--keyring-backend=test", fmt.Sprintf("--%s=%s", flags.FlagHome, home), diff --git a/tests/e2e/e2e_gov_test.go b/tests/e2e/e2e_gov_test.go index 204d3193..26ea1631 100644 --- a/tests/e2e/e2e_gov_test.go +++ b/tests/e2e/e2e_gov_test.go @@ -20,7 +20,6 @@ import ( dynamicfeetypes "github.com/atomone-hub/atomone/x/dynamicfee/types" govtypes "github.com/atomone-hub/atomone/x/gov/types" govtypesv1 "github.com/atomone-hub/atomone/x/gov/types/v1" - govtypesv1beta1 "github.com/atomone-hub/atomone/x/gov/types/v1beta1" photontypes "github.com/atomone-hub/atomone/x/photon/types" ) @@ -48,7 +47,7 @@ func (s *IntegrationTestSuite) testGovSoftwareUpgrade() { depositGovFlags := []string{strconv.Itoa(proposalCounter), s.queryGovMinDeposit(chainAAPIEndpoint).String()} voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes=0.8,no=0.1,abstain=0.1"} - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "SoftwareUpgrade", submitGovFlags, depositGovFlags, voteGovFlags, "weighted-vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "SoftwareUpgrade", submitGovFlags, depositGovFlags, voteGovFlags, "weighted-vote", govtypesv1.StatusPassed) res := s.queryUpgradePlan(chainAAPIEndpoint) s.Require().Equal("v2", res.Plan.Name) @@ -96,14 +95,14 @@ func (s *IntegrationTestSuite) testGovCancelSoftwareUpgrade() { submitGovFlags := []string{configFile(proposalSoftwareUpgradeFilename)} depositGovFlags := []string{strconv.Itoa(proposalCounter), s.queryGovMinDeposit(chainAAPIEndpoint).String()} voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "SoftwareUpgrade", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "SoftwareUpgrade", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) proposalCounter++ s.writeGovCancelUpgradeProposal(s.chainA) submitGovFlags = []string{configFile(proposalCancelUpgradeFilename)} depositGovFlags = []string{strconv.Itoa(proposalCounter), s.queryGovMinDeposit(chainAAPIEndpoint).String()} voteGovFlags = []string{strconv.Itoa(proposalCounter), "yes"} - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "CancelUpgrade", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "CancelUpgrade", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) s.verifyChainPassesUpgradeHeight(s.chainA, 0, proposalHeight) s.T().Logf("Successfully canceled upgrade at height %d", proposalHeight) @@ -136,7 +135,7 @@ func (s *IntegrationTestSuite) testGovCommunityPoolSpend() { submitGovFlags := []string{configFile(proposalCommunitySpendFilename)} depositGovFlags := []string{strconv.Itoa(proposalCounter), s.queryGovMinDeposit(chainAAPIEndpoint).String()} voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "CommunityPoolSpend", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "CommunityPoolSpend", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) // Check that sender is refunded with the proposal deposit s.Require().Eventually( @@ -175,9 +174,9 @@ func (s *IntegrationTestSuite) testGovCommunityPoolSpend() { // Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query proposalCounter++ submitGovFlags := []string{configFile(proposalCommunitySpendFilename)} - depositGovFlags := []string{strconv.Itoa(proposalCounter), s.queryGovMinDeposit(chainAAPIEndpoint).String()} + depositGovFlags := []string{strconv.Itoa(proposalCounter), deposit.String()} voteGovFlags := []string{strconv.Itoa(proposalCounter), "no"} - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "CommunityPoolSpend", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusRejected) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "CommunityPoolSpend", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusRejected) // Check that sender is not refunded with the proposal deposit s.Require().Eventually( @@ -220,7 +219,7 @@ func (s *IntegrationTestSuite) testGovParamChange() { submitGovFlags := []string{configFile(proposalParamChangeFilename)} depositGovFlags := []string{strconv.Itoa(proposalCounter), s.queryGovMinDeposit(chainAAPIEndpoint).String()} voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "cosmos.staking.v1beta1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "cosmos.staking.v1beta1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) newParams := s.queryStakingParams(chainAAPIEndpoint) s.Assert().NotEqual(oldMaxValidator, newParams.Params.MaxValidators) @@ -243,7 +242,7 @@ func (s *IntegrationTestSuite) testGovParamChange() { submitGovFlags := []string{configFile(proposalParamChangeFilename)} depositGovFlags := []string{strconv.Itoa(proposalCounter), s.queryGovMinDeposit(chainAAPIEndpoint).String()} voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "atomone.photon.v1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "atomone.photon.v1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) newParams := s.queryPhotonParams(chainAAPIEndpoint) s.Assert().True(newParams.Params.MintDisabled, "expected photon param mint disabled to be true") @@ -254,7 +253,7 @@ func (s *IntegrationTestSuite) testGovParamChange() { depositGovFlags = []string{strconv.Itoa(proposalCounter), s.queryGovMinDeposit(chainAAPIEndpoint).String()} voteGovFlags = []string{strconv.Itoa(proposalCounter), "yes"} s.writePhotonParamChangeProposal(s.chainA, params.Params) - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "atomone.photon.v1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "atomone.photon.v1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) newParams = s.queryPhotonParams(chainAAPIEndpoint) s.Require().False(newParams.Params.MintDisabled, "expected photon param mint disabled to be false") @@ -275,7 +274,7 @@ func (s *IntegrationTestSuite) testGovParamChange() { submitGovFlags := []string{configFile(proposalParamChangeFilename)} depositGovFlags := []string{strconv.Itoa(proposalCounter), s.queryGovMinDeposit(chainAAPIEndpoint).String()} voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "atomone.dynamicfee.v1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "atomone.dynamicfee.v1.MsgUpdateParams", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) newParams := s.queryDynamicfeeParams(chainAAPIEndpoint) s.Require().Equal(newParams.Params.Alpha, oldAlpha.Add(math.LegacyNewDec(1))) @@ -297,7 +296,7 @@ func (s *IntegrationTestSuite) testGovConstitutionAmendment() { submitGovFlags := []string{configFile(proposalConstitutionAmendmentFilename)} depositGovFlags := []string{strconv.Itoa(proposalCounter), s.queryGovMinDeposit(chainAAPIEndpoint).String()} voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "gov/MsgSubmitProposal", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "gov/MsgSubmitProposal", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) s.Require().Eventually( func() bool { @@ -320,7 +319,7 @@ func (s *IntegrationTestSuite) testGovTextProposal() { voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress() sender := senderAddress.String() - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "Text", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "Text", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) }) } @@ -344,14 +343,16 @@ func (s *IntegrationTestSuite) testGovDynamicQuorum() { voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress() sender := senderAddress.String() - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "Text", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "Text", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) quorumsAfter := s.queryGovQuorums(chainAAPIEndpoint) endQuorum := math.LegacyMustNewDecFromStr(quorumsAfter.GetQuorum()) endQuorumPEma := (endQuorum.Sub(quorumMin)).Quo(quorumMax.Sub(quorumMin)) expectedParticipation := endQuorumPEma.Sub(quorumPEma.Mul(math.LegacyMustNewDecFromStr("0.8"))).Quo(math.LegacyMustNewDecFromStr("0.2")) proposal, _ := s.queryGovProposal(chainAAPIEndpoint, proposalCounter) stakingPool := s.queryStakingPool(chainAAPIEndpoint) - votes := proposal.Proposal.FinalTallyResult.Yes.ToLegacyDec() + yesCount, ok := math.NewIntFromString(proposal.Proposal.FinalTallyResult.YesCount) + s.Require().True(ok, "Failed to parse yes count from proposal tally result") + votes := yesCount.ToLegacyDec() totalVP := stakingPool.Pool.BondedTokens.ToLegacyDec() actualParticipation := votes.Quo(totalVP) @@ -382,14 +383,16 @@ func (s *IntegrationTestSuite) testGovDynamicQuorum() { sender := senderAddress.String() s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "gov/MsgSubmitProposal", submitGovFlags, depositGovFlags, voteGovFlags, - "vote", govtypesv1beta1.StatusPassed) + "vote", govtypesv1.StatusPassed) quorumsAfter := s.queryGovQuorums(chainAAPIEndpoint) endLawQuorum := math.LegacyMustNewDecFromStr(quorumsAfter.GetLawQuorum()) endLawQuorumPEma := (endLawQuorum.Sub(lawQuorumMin)).Quo(lawQuorumMax.Sub(lawQuorumMin)) expectedParticipation := endLawQuorumPEma.Sub(lawQuorumPEma.Mul(math.LegacyMustNewDecFromStr("0.8"))).Quo(math.LegacyMustNewDecFromStr("0.2")) proposal, _ := s.queryGovProposal(chainAAPIEndpoint, proposalCounter) stakingPool := s.queryStakingPool(chainAAPIEndpoint) - votes := proposal.Proposal.FinalTallyResult.Yes.ToLegacyDec() + yesCount, ok := math.NewIntFromString(proposal.Proposal.FinalTallyResult.YesCount) + s.Require().True(ok, "Failed to parse yes count from proposal tally result") + votes := yesCount.ToLegacyDec() totalVP := stakingPool.Pool.BondedTokens.ToLegacyDec() actualParticipation := votes.Quo(totalVP) @@ -420,14 +423,16 @@ func (s *IntegrationTestSuite) testGovDynamicQuorum() { voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"} senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress() sender := senderAddress.String() - s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "gov/MsgSubmitProposal", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1beta1.StatusPassed) + s.submitGovProposal(chainAAPIEndpoint, sender, proposalCounter, "gov/MsgSubmitProposal", submitGovFlags, depositGovFlags, voteGovFlags, "vote", govtypesv1.StatusPassed) quorumsAfter := s.queryGovQuorums(chainAAPIEndpoint) endConstitutionAmendmentQuorum := math.LegacyMustNewDecFromStr(quorumsAfter.GetConstitutionAmendmentQuorum()) endConstitutionAmendmentQuorumPEma := (endConstitutionAmendmentQuorum.Sub(constitutionAmendmentQuorumMin)).Quo(constitutionAmendmentQuorumMax.Sub(constitutionAmendmentQuorumMin)) expectedParticipation := endConstitutionAmendmentQuorumPEma.Sub(constitutionAmendmentQuorumPEma.Mul(math.LegacyMustNewDecFromStr("0.8"))).Quo(math.LegacyMustNewDecFromStr("0.2")) proposal, _ := s.queryGovProposal(chainAAPIEndpoint, proposalCounter) stakingPool := s.queryStakingPool(chainAAPIEndpoint) - votes := proposal.Proposal.FinalTallyResult.Yes.ToLegacyDec() + yesCount, ok := math.NewIntFromString(proposal.Proposal.FinalTallyResult.YesCount) + s.Require().True(ok, "Failed to parse yes count from proposal tally result") + votes := yesCount.ToLegacyDec() totalVP := stakingPool.Pool.BondedTokens.ToLegacyDec() actualParticipation := votes.Quo(totalVP) @@ -437,16 +442,120 @@ func (s *IntegrationTestSuite) testGovDynamicQuorum() { }) } +// testGovGovernors tests passing a text proposal and vote with governors. +func (s *IntegrationTestSuite) testGovGovernors() { + s.Run("governors", func() { + chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp")) + senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress() + sender := senderAddress.String() + s.writeGovTextProposal(s.chainA) + + // create a governor + acc1Addr, _ := s.chainA.genesisAccounts[1].keyInfo.GetAddress() + governorAddr := govtypes.GovernorAddress(acc1Addr).String() + // a governor must have a delegation of at least 10atone + valAddr, _ := s.chainA.validators[0].keyInfo.GetAddress() + validatorAddr := sdk.ValAddress(valAddr).String() + govDelegatorAddr := acc1Addr.String() + govDelegation := sdk.NewInt64Coin("uatone", 10_000_000) + s.execDelegate(s.chainA, 0, govDelegation, validatorAddr, govDelegatorAddr) + // run create-governor + s.runGovExec(s.chainA, 0, govDelegatorAddr, "create-governor", []string{ + govDelegatorAddr, "moniker", "identity", "website", "security-contact", "details", + }) + // check governor is created + s.Require().Eventually( + func() bool { + governor, err := s.queryGovGovernor(chainAAPIEndpoint, governorAddr) + s.Require().NoError(err) + return governor.Governor != nil + }, + 15*time.Second, + time.Second, + ) + + // delegate to this governor + // first create a delegator + acc2Addr, _ := s.chainA.genesisAccounts[2].keyInfo.GetAddress() + delegatorAddr := acc2Addr.String() + delDelegation := sdk.NewInt64Coin("uatone", 10_000_000) + s.execDelegate(s.chainA, 0, delDelegation, validatorAddr, delegatorAddr) + // then delegate to governor + s.runGovExec(s.chainA, 0, delegatorAddr, "delegate-governor", []string{ + delegatorAddr, governorAddr, + }) + // check governor delegation is created + s.Require().Eventually( + func() bool { + resp, err := s.queryGovGovernorDelegation(chainAAPIEndpoint, delegatorAddr) + s.Require().NoError(err) + return resp.GovernorAddress == governorAddr + }, + 15*time.Second, + time.Second, + ) + // assert governor valshares + resp, err := s.queryGovGovernorValShares(chainAAPIEndpoint, governorAddr) + s.Require().NoError(err) + s.Require().Len(resp.ValShares, 1, "expected 1 valshare") + s.Require().Equal(governorAddr, resp.ValShares[0].GovernorAddress) + s.Require().Equal(validatorAddr, resp.ValShares[0].ValidatorAddress) + validator, err := s.queryValidator(chainAAPIEndpoint, validatorAddr) + s.Require().NoError(err) + totalDelegations := delDelegation.Add(govDelegation) + expectedShares, err := validator.SharesFromTokens(totalDelegations.Amount) + s.Require().NoError(err) + s.Require().True(expectedShares.Equal(resp.ValShares[0].Shares), "want shares %s, got %s", expectedShares, resp.ValShares[0].Shares) + + // Create a governance proposal + proposalCounter++ + submitGovFlags := []string{configFile(proposalTextFilename)} + s.submitGovCommand(chainAAPIEndpoint, sender, proposalCounter, "submit-proposal", submitGovFlags, govtypesv1.StatusVotingPeriod) + + // Vote with governor + voteFlags := []string{strconv.Itoa(proposalCounter), "yes"} + s.submitGovCommand(chainAAPIEndpoint, govDelegatorAddr, proposalCounter, "vote", voteFlags, govtypesv1.StatusRejected) + + // assert tally result + prop, err := s.queryGovProposal(chainAAPIEndpoint, proposalCounter) + s.Require().NoError(err) + expectedTally := &govtypesv1.TallyResult{ + YesCount: totalDelegations.Amount.String(), + NoCount: "0", + AbstainCount: "0", + } + s.Require().Equal(expectedTally, prop.Proposal.FinalTallyResult) + }) +} + +func (s *IntegrationTestSuite) submitLegacyGovProposal(chainAAPIEndpoint, sender string, proposalID int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string, withDeposit bool) { + s.T().Logf("Submitting Gov Proposal: %s", proposalType) + // min deposit of 1000uatone is required in e2e tests, otherwise the gov antehandler causes the proposal to be dropped + sflags := submitFlags + initialDeposit := s.queryGovMinInitialDeposit(chainAAPIEndpoint) + if withDeposit { + sflags = append(sflags, "--deposit="+initialDeposit.String()) + } + deposit := s.queryGovMinDeposit(chainAAPIEndpoint) + depositString := deposit.String() + depositFlags = append(depositFlags, depositString) + s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "submit-legacy-proposal", sflags, govtypesv1.StatusDepositPeriod) + s.T().Logf("Depositing Gov Proposal: %s", proposalType) + s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "deposit", depositFlags, govtypesv1.StatusVotingPeriod) + s.T().Logf("Voting Gov Proposal: %s", proposalType) + s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, voteCommand, voteFlags, govtypesv1.StatusPassed) +} + // NOTE: in SDK >= v0.47 the submit-proposal does not have a --deposit flag // Instead, the deposit is added to the "deposit" field of the proposal JSON (usually stored as a file) // you can use `atomoned tx gov draft-proposal` to create a proposal file that you can use // min initial deposit of 100uatone is required in e2e tests, otherwise the proposal would be dropped -func (s *IntegrationTestSuite) submitGovProposal(chainAAPIEndpoint, sender string, proposalID int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string, expectedStatusAfterVote govtypesv1beta1.ProposalStatus) { +func (s *IntegrationTestSuite) submitGovProposal(chainAAPIEndpoint, sender string, proposalID int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string, expectedStatusAfterVote govtypesv1.ProposalStatus) { s.T().Logf("Submitting Gov Proposal: %s", proposalType) sflags := submitFlags - s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "submit-proposal", sflags, govtypesv1beta1.StatusDepositPeriod) + s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "submit-proposal", sflags, govtypesv1.StatusDepositPeriod) s.T().Logf("Depositing Gov Proposal: %s", proposalType) - s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "deposit", depositFlags, govtypesv1beta1.StatusVotingPeriod) + s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "deposit", depositFlags, govtypesv1.StatusVotingPeriod) s.T().Logf("Voting Gov Proposal: %s", proposalType) s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, voteCommand, voteFlags, expectedStatusAfterVote) } @@ -493,7 +602,7 @@ func (s *IntegrationTestSuite) verifyChainPassesUpgradeHeight(c *chain, valIdx i ) } -func (s *IntegrationTestSuite) submitGovCommand(chainAAPIEndpoint, sender string, proposalID int, govCommand string, proposalFlags []string, expectedStatus govtypesv1beta1.ProposalStatus) { +func (s *IntegrationTestSuite) submitGovCommand(chainAAPIEndpoint, sender string, proposalID int, govCommand string, proposalFlags []string, expectedStatus govtypesv1.ProposalStatus) { s.runGovExec(s.chainA, 0, sender, govCommand, proposalFlags) s.T().Logf("Waiting for proposal status %s", expectedStatus.String()) @@ -627,6 +736,23 @@ func (s *IntegrationTestSuite) writePhotonParamChangeProposal(c *chain, params p s.Require().NoError(err) } +// writeGovTextProposal creates a text proposal JSON file with full required deposit. +func (s *IntegrationTestSuite) writeGovTextProposal(c *chain) { + template := ` + { + "deposit": "%s", + "metadata": "The metadata", + "title": "A text proposal", + "summary": "The summary" + } + ` + chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[c.id][0].GetHostPort("1317/tcp")) + deposit := s.queryGovMinDeposit(chainAAPIEndpoint) + propMsgBody := fmt.Sprintf(template, deposit) + err := writeFile(filepath.Join(c.validators[0].configDir(), "config", proposalTextFilename), []byte(propMsgBody)) + s.Require().NoError(err) +} + func (s *IntegrationTestSuite) writeGovConstitutionAmendmentProposal(c *chain, amendment string) { govModuleAddress := authtypes.NewModuleAddress(govtypes.ModuleName).String() // escape newlines in amendment diff --git a/tests/e2e/e2e_rest_regression_test.go b/tests/e2e/e2e_rest_regression_test.go index 2ff9e3d2..54f5595a 100644 --- a/tests/e2e/e2e_rest_regression_test.go +++ b/tests/e2e/e2e_rest_regression_test.go @@ -38,7 +38,7 @@ const ( authParamsModuleQueryPath = "/cosmos/auth/v1beta1/params" distributionCommPoolModuleQueryPath = "/cosmos/distribution/v1beta1/community_pool" evidenceModuleQueryPath = "/cosmos/evidence/v1beta1/evidence" - govPropsModuleQueryPath = "/atomone/gov/v1beta1/proposals" + govPropsModuleQueryPath = "/atomone/gov/v1/proposals" mintParamsModuleQueryPath = "/cosmos/mint/v1beta1/params" slashingParamsModuleQueryPath = "/cosmos/slashing/v1beta1/params" stakingParamsModuleQueryPath = "/cosmos/staking/v1beta1/params" diff --git a/tests/e2e/e2e_staking_test.go b/tests/e2e/e2e_staking_test.go index 83bb5e0f..116fd6b7 100644 --- a/tests/e2e/e2e_staking_test.go +++ b/tests/e2e/e2e_staking_test.go @@ -35,7 +35,7 @@ func (s *IntegrationTestSuite) testStaking() { delegation := sdk.NewCoin(uatoneDenom, delegationAmount) // 500 atom // Alice delegate uatone to Validator A - s.execDelegate(s.chainA, 0, delegation.String(), validatorAddressA, delegatorAddress.String(), atomoneHomePath) + s.execDelegate(s.chainA, 0, delegation, validatorAddressA, delegatorAddress.String()) // Validate delegation successful s.Require().Eventually( @@ -60,8 +60,8 @@ func (s *IntegrationTestSuite) testStaking() { s.Require().Eventually( func() bool { res, err := s.queryDelegation(chainEndpoint, validatorAddressB, delegatorAddress.String()) - amt := res.GetDelegationResponse().GetDelegation().GetShares() s.Require().NoError(err) + amt := res.GetDelegationResponse().GetDelegation().GetShares() return amt.Equal(math.LegacyNewDecFromInt(redelegationAmount)) }, @@ -78,8 +78,8 @@ func (s *IntegrationTestSuite) testStaking() { s.Require().Eventually( func() bool { res, err := s.queryDelegation(chainEndpoint, validatorAddressA, delegatorAddress.String()) - amt := res.GetDelegationResponse().GetDelegation().GetShares() s.Require().NoError(err) + amt := res.GetDelegationResponse().GetDelegation().GetShares() currDelegationAmount = amt.TruncateInt() currDelegation = sdk.NewCoin(uatoneDenom, currDelegationAmount) @@ -125,8 +125,8 @@ func (s *IntegrationTestSuite) testStaking() { s.Require().Eventually( func() bool { resDel, err := s.queryDelegation(chainEndpoint, validatorAddressA, delegatorAddress.String()) - amt := resDel.GetDelegationResponse().GetDelegation().GetShares() s.Require().NoError(err) + amt := resDel.GetDelegationResponse().GetDelegation().GetShares() // expect that no unbonding delegations are found for validator A _, err = s.queryUnbondingDelegation(chainEndpoint, validatorAddressA, delegatorAddress.String()) diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index fa0da5fe..4bb0d85c 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -65,6 +65,7 @@ func (s *IntegrationTestSuite) TestGov() { s.testGovConstitutionAmendment() s.testGovDynamicQuorum() s.testGovTextProposal() + s.testGovGovernors() } func (s *IntegrationTestSuite) TestIBC_hermesRelayer() { diff --git a/tests/e2e/e2e_vesting_test.go b/tests/e2e/e2e_vesting_test.go index 9a976f6b..6eb5e892 100644 --- a/tests/e2e/e2e_vesting_test.go +++ b/tests/e2e/e2e_vesting_test.go @@ -61,8 +61,8 @@ func (s *IntegrationTestSuite) testDelayedVestingAccount(api string) { s.Require().Equal(vestingBalance.AmountOf(uatoneDenom), balance.Amount) // Delegate coins should succeed - s.execDelegate(chain, valIdx, vestingDelegationAmount.String(), valOpAddr, - vestingDelayedAcc.String(), atomoneHomePath) + s.execDelegate(chain, valIdx, vestingDelegationAmount, valOpAddr, + vestingDelayedAcc.String()) // Validate delegation successful s.Require().Eventually( @@ -125,8 +125,8 @@ func (s *IntegrationTestSuite) testContinuousVestingAccount(api string) { s.Require().Equal(vestingBalance.AmountOf(uatoneDenom), balance.Amount) // Delegate coins should succeed - s.execDelegate(chain, valIdx, vestingDelegationAmount.String(), - valOpAddr, continuousVestingAcc.String(), atomoneHomePath) + s.execDelegate(chain, valIdx, vestingDelegationAmount, + valOpAddr, continuousVestingAcc.String()) // Validate delegation successful s.Require().Eventually( @@ -253,8 +253,8 @@ func (s *IntegrationTestSuite) testPeriodicVestingAccount(api string) { //nolint } // Delegate coins should succeed - s.execDelegate(chain, valIdx, vestingDelegationAmount.String(), valOpAddr, - periodicVestingAddr, atomoneHomePath) + s.execDelegate(chain, valIdx, vestingDelegationAmount, valOpAddr, + periodicVestingAddr) // Validate delegation successful s.Require().Eventually( diff --git a/tests/e2e/genesis_test.go b/tests/e2e/genesis_test.go index cff4f151..29ea9933 100644 --- a/tests/e2e/genesis_test.go +++ b/tests/e2e/genesis_test.go @@ -203,11 +203,13 @@ func modifyGenesis(cdc codec.Codec, path, moniker, amountStr string, addrAll []s maxConstitutionAmendmentQuorum := "0.8" minLawQuorum := "0.2" maxLawQuorum := "0.8" + minGovernorSelfDelegation, _ := math.NewIntFromString("10000000") depositAmount := sdk.NewInt64Coin(uatoneDenom, 1_000_000_000) // 1,000atone initialDepositAmount := sdk.NewInt64Coin(uatoneDenom, 100_000_000) // 100atone maxDepositPeriod := 10 * time.Minute votingPeriod := 15 * time.Second + governorStatusChangePeriod := 30 * time.Second govGenState := govv1.NewGenesisState(1, participationEma, participationEma, participationEma, @@ -229,6 +231,7 @@ func modifyGenesis(cdc codec.Codec, path, moniker, amountStr string, addrAll []s maxQuorum, minQuorum, maxConstitutionAmendmentQuorum, minConstitutionAmendmentQuorum, maxLawQuorum, minLawQuorum, + governorStatusChangePeriod, minGovernorSelfDelegation.String(), ), ) govGenState.Constitution = "This is a test constitution" diff --git a/tests/e2e/query_test.go b/tests/e2e/query_test.go index e3170efb..daefd683 100644 --- a/tests/e2e/query_test.go +++ b/tests/e2e/query_test.go @@ -25,7 +25,6 @@ import ( dynamicfeetypes "github.com/atomone-hub/atomone/x/dynamicfee/types" govtypesv1 "github.com/atomone-hub/atomone/x/gov/types/v1" - govtypesv1beta1 "github.com/atomone-hub/atomone/x/gov/types/v1beta1" photontypes "github.com/atomone-hub/atomone/x/photon/types" ) @@ -120,7 +119,6 @@ func (s *IntegrationTestSuite) queryBankSupply(endpoint string) sdk.Coins { func (s *IntegrationTestSuite) queryDelegation(endpoint string, validatorAddr string, delegatorAddr string) (stakingtypes.QueryDelegationResponse, error) { var res stakingtypes.QueryDelegationResponse - body, err := httpGet(fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s", endpoint, validatorAddr, delegatorAddr)) if err != nil { return res, err @@ -174,10 +172,10 @@ func (s *IntegrationTestSuite) queryDelegatorTotalRewards(endpoint, delegatorAdd return res, nil } -func (s *IntegrationTestSuite) queryGovProposal(endpoint string, proposalID int) (govtypesv1beta1.QueryProposalResponse, error) { - var govProposalResp govtypesv1beta1.QueryProposalResponse +func (s *IntegrationTestSuite) queryGovProposal(endpoint string, proposalID int) (govtypesv1.QueryProposalResponse, error) { + var govProposalResp govtypesv1.QueryProposalResponse - path := fmt.Sprintf("%s/atomone/gov/v1beta1/proposals/%d", endpoint, proposalID) + path := fmt.Sprintf("%s/atomone/gov/v1/proposals/%d", endpoint, proposalID) body, err := httpGet(path) if err != nil { @@ -238,6 +236,54 @@ func (s *IntegrationTestSuite) queryGovParams(endpoint string, param string) gov return res } +func (s *IntegrationTestSuite) queryGovGovernor(endpoint string, govAddr string) (govtypesv1.QueryGovernorResponse, error) { + var resp govtypesv1.QueryGovernorResponse + + path := fmt.Sprintf("%s/atomone/gov/v1/governors/%s", endpoint, govAddr) + + body, err := httpGet(path) + if err != nil { + return resp, fmt.Errorf("failed to execute HTTP request: %w", err) + } + if err := s.cdc.UnmarshalJSON(body, &resp); err != nil { + return resp, err + } + + return resp, nil +} + +func (s *IntegrationTestSuite) queryGovGovernorDelegation(endpoint string, delAddr string) (govtypesv1.QueryGovernanceDelegationResponse, error) { + var resp govtypesv1.QueryGovernanceDelegationResponse + + path := fmt.Sprintf("%s/atomone/gov/v1/delegations/%s", endpoint, delAddr) + + body, err := httpGet(path) + if err != nil { + return resp, fmt.Errorf("failed to execute HTTP request: %w", err) + } + if err := s.cdc.UnmarshalJSON(body, &resp); err != nil { + return resp, err + } + + return resp, nil +} + +func (s *IntegrationTestSuite) queryGovGovernorValShares(endpoint string, govAddr string) (govtypesv1.QueryGovernorValSharesResponse, error) { + var resp govtypesv1.QueryGovernorValSharesResponse + + path := fmt.Sprintf("%s/atomone/gov/v1/vshares/%s", endpoint, govAddr) + + body, err := httpGet(path) + if err != nil { + return resp, fmt.Errorf("failed to execute HTTP request: %w", err) + } + if err := s.cdc.UnmarshalJSON(body, &resp); err != nil { + return resp, err + } + + return resp, nil +} + func (s *IntegrationTestSuite) queryAccount(endpoint, address string) (acc sdk.AccountI) { resp, err := http.Get(fmt.Sprintf("%s/cosmos/auth/v1beta1/accounts/%s", endpoint, address)) s.Require().NoError(err) diff --git a/x/gov/README.md b/x/gov/README.md index c36b80b4..e4da1975 100644 --- a/x/gov/README.md +++ b/x/gov/README.md @@ -13,20 +13,27 @@ June 2016. The module enables Cosmos SDK based blockchain to support an on-chain governance system. In this system, holders of the native staking token of the chain can vote -on proposals on a 1 token 1 vote basis. Next is a list of features the module -currently supports: +on proposals on a 1 token 1 vote basis. Specialized participants called +"*governors*" can hold delegated voting power to streamline governance. Next is a +list of features the module currently supports: * **Proposal submission:** Users can submit proposals with a deposit. Once the - minimum deposit is reached, the proposal enters the voting period. The deposit - system is dynamic and can adjust automatically to discourage excessive - spam or an excessive number of simultaneous active proposals. + minimum deposit is reached, the proposal enters the voting period. The minimum + deposit can be reached by collecting deposits from different users (including + proposer) within deposit period.The deposit system is dynamic and can adjust + automatically to discourage excessive spam or an excessive number of + simultaneous active proposals. * **Vote:** Participants can vote on proposals that reached the dynamic minimum deposit and entered the voting period. * **Claiming deposit:** Users that deposited on proposals can recover their deposits if the proposal was accepted or rejected. If the proposal never entered the voting period (the dynamic minimum deposit was never reached within the - deposit period), or if the minimum quorum has not been reached, the deposit might be burnt - (see [Burnable Params](#burnable-params) section). + deposit period), or if the minimum quorum has not been reached, the deposit might + be burnt (see [Burnable Params](#burnable-params) section). +* **Governors Creation and Delegations** Users can self-elect themselves as + governors if certain criterias are met. Other users can delegate their voting + power to these governors that can vote in their stead. However delegators + always retain the right to vote directly. This module is in use in [AtomOne](https://github.com/atomone-hub/atomone). Features that may be added in the future are described in [Future Improvements](#future-improvements). @@ -57,10 +64,10 @@ staking token of the chain. - [Quorum](#quorum) - [Dynamic Quorum](#dynamic-quorum) - [Threshold](#threshold) - - [No inheritance](#no-inheritance) - - [Validator’s punishment for non-voting](#validators-punishment-for-non-voting) - - [Governance address](#governance-address) + - [No inheritance for validartors](#no-inheritance-for-validartors) + - [Validator’s or governor's punishment for non-voting](#validators-or-governors-punishment-for-non-voting) - [Burnable Params](#burnable-params) + - [Governors and delegations](#governors-and-delegations) - [State](#state) - [Proposals](#proposals) - [Writing a module that uses governance](#writing-a-module-that-uses-governance) @@ -69,6 +76,7 @@ staking token of the chain. - [VotingParams](#votingparams) - [TallyParams](#tallyparams) - [Deposit](#deposit-1) + - [Governors](#governors) - [Stores](#stores) - [Proposal Processing Queue](#proposal-processing-queue) - [Legacy Proposal](#legacy-proposal) @@ -76,10 +84,16 @@ staking token of the chain. - [Constitution](#constitution) - [Law and Constitution Amendment Proposals](#law-and-constitution-amendment-proposals) - [Last Min Deposit and Last Min Initial Deposit](#last-min-deposit-and-last-min-initial-deposit) + - [Governance Delegations](#governance-delegations) - [Messages](#messages) - [Proposal Submission](#proposal-submission-1) - [Deposit](#deposit-2) - [Vote](#vote-1) + - [Governor Creation](#governor-creation) + - [Edit Governor](#edit-governor) + - [Update Governor Status](#update-governor-status) + - [Delegate Governance Voting Power](#delegate-governance-voting-power) + - [Undelegate Governance Voting Power](#undelegate-governance-voting-power) - [Events](#events) - [EndBlocker](#endblocker) - [Handlers](#handlers) @@ -98,6 +112,10 @@ staking token of the chain. - [deposits](#deposits) - [min deposit](#min-deposit) - [min initial deposit](#min-initial-deposit) + - [governor](#governor) + - [governors](#governors-1) + - [governance delegation](#governance-delegation) + - [governance delegations for a governor](#governance-delegations-for-a-governor) - [param](#param) - [params](#params) - [proposal](#proposal) @@ -115,6 +133,11 @@ staking token of the chain. - [submit-legacy-proposal](#submit-legacy-proposal) - [vote](#vote-3) - [weighted-vote](#weighted-vote) + - [create-governor](#create-governor) + - [edit-governor](#edit-governor-1) + - [update-governor-status](#update-governor-status-1) + - [delegate-governor](#delegate-governor) + - [undelegate-governor](#undelegate-governor) - [gRPC](#grpc) - [Proposal](#proposal-1) - [Proposals](#proposals-2) @@ -122,8 +145,12 @@ staking token of the chain. - [Votes](#votes-1) - [Params](#params-1) - [Deposit](#deposit-5) - - [deposits](#deposits-1) + - [Deposits](#deposits-1) - [TallyResult](#tallyresult) + - [Governor](#governor-1) + - [Governors](#governors-2) + - [Delegation](#delegation) + - [Delegations](#delegations) - [REST](#rest) - [proposal](#proposal-2) - [proposals](#proposals-3) @@ -135,6 +162,10 @@ staking token of the chain. - [deposits](#deposits-2) - [proposal deposits](#proposal-deposits) - [tally](#tally-1) + - [governor](#governor-2) + - [governors](#governors-3) + - [delegation](#delegation-1) + - [delegations](#delegations-1) - [Metadata](#metadata) - [Proposal](#proposal-3) - [Vote](#vote-5) @@ -350,27 +381,21 @@ which is modifiable by governance. This means that proposals are accepted if: * The proportion of `Yes` votes, excluding `Abstain` votes, at the end of the voting period is superior to 2/3. -#### No inheritance +#### No inheritance for validartors If a delegator does not vote, the vote of the delegated validator - if applicable - will not be inherited. Similarly, a validator's voting power is only equal to its own stake. -#### Validator’s punishment for non-voting +Governance delegations are allowed to active governors only. -At present, validators are not punished for failing to vote. +#### Validator’s or governor's punishment for non-voting -#### Governance address - -Later, we may add permissioned keys that could only sign txs from certain modules. -For the MVP, the `Governance address` will be the main validator address generated -at account creation. This address corresponds to a different PrivKey than the CometBFT -PrivKey which is responsible for signing consensus messages. Validators thus do not -have to sign governance transactions with the sensitive CometBFT PrivKey. +At present, validators or governors are not punished for failing to vote. #### Burnable Params -There are three parameters that define if the deposit of a proposal should +There are two parameters that define if the deposit of a proposal should be burned or returned to the depositors. * `BurnDepositNoThreshold` burns the proposal deposit at the end of the voting @@ -381,6 +406,19 @@ be burned or returned to the depositors. > Note: These parameters are modifiable via governance. +### Governors and delegations + +A governor is a specialized role within the governance system who can +receive delegated voting power from other users. A user can register as a +governor by meeting certain governance self-delegation requirements, and since +governors auto delegate their governance power to themselves that translates to +a staking requirement. + +Delegators can assign their staked tokens’ governance voting power to a +governor. During tally, direct delegator votes and governors’ aggregated votes +are taken into account. Any direct votes from a delegator reduce the effective +voting power of that delegator’s chosen governor by the relevant stake. + ## State ### Proposals @@ -504,6 +542,12 @@ const ( https://github.com/atomone-hub/atomone/blob/b9631ed2e3b781cd82a14316f6086802d8cb4dcf/proto/atomone/gov/v1/gov.proto#L37-L49 ``` +### Governors + +```protobuf reference +https://github.com/atomone-hub/atomone/blob/f25a8a4a8af752a8d04ad8ee7e850c9cf32ff447/proto/atomone/gov/v1/gov.proto#L285-331 +``` + ## Stores :::note @@ -764,6 +808,24 @@ passage of time (for decreases) as detailed in [ADR-003](../../docs/architecture https://github.com/atomone-hub/atomone/blob/fb05dcaba40c7a1531a6806487fcd47a3e4aaef4/proto/atomone/gov/v1/gov.proto#L51-L60 ``` +### Governance Delegations + +Governance delegations are tracked via the `GovernanceDelegation` object, +and express a mapping from a delegator to a governor. + +```protobuf reference +https://github.com/atomone-hub/atomone/blob/f25a8a4a8af752a8d04ad8ee7e850c9cf32ff447/proto/atomone/gov/v1/gov.proto#L349-L357 +``` + +When a governance delegation is performed, the governance voting power of a +governor is updated via adding the corresponding number of "virtual shares" +that result from the underlying staking delegation from the corresponding +validator. This is tracked via the `GovernorValShares` object. + +```protobuf reference +https://github.com/atomone-hub/atomone/blob/f25a8a4a8af752a8d04ad8ee7e850c9cf32ff447/proto/atomone/gov/v1/gov.proto#L333-L347 +``` + ## Messages ### Proposal Submission @@ -965,6 +1027,55 @@ Next is a pseudocode outline of the way `MsgVote` transactions are handled: store(Governance, , txGovVote.Vote) // Voters can vote multiple times. Re-voting overrides previous vote. This is ok because tallying is done once at the end. ``` +### Governor Creation + +Governors can be created by sending a `MsgCreateGovernor` transaction. + +```protobuf reference +https://github.com/atomone-hub/atomone/blob/539ee0ea3b33211ce90a9c6679911893f72b8d26/proto/atomone/gov/v1/tx.proto#L242-L253 +``` + +**State modifications:** + +* Create a new governor account from the sender base account. The minimum self-delegation + required to become a governor is checked during the creation process. + +### Edit Governor + +Governors can edit their details by sending a `MsgEditGovernor` transaction. + +```protobuf reference +https://github.com/atomone-hub/atomone/blob/539ee0ea3b33211ce90a9c6679911893f72b8d26/proto/atomone/gov/v1/tx.proto#L258-L269 +``` + +### Update Governor Status + +Governors can set their status to inactive or active by sending a +`MsgUpdateGovernorStatus` transaction. However for the transition to active the minimum +self-delegation required to become a governor need also to be satisfied. + +```protobuf reference +https://github.com/atomone-hub/atomone/blob/539ee0ea3b33211ce90a9c6679911893f72b8d26/proto/atomone/gov/v1/tx.proto#L274-L285 +``` + +### Delegate Governance Voting Power + +Stakers can delegate their governance voting power to a governor by sending a +`MsgDelegateGovernancePower` transaction. + +```protobuf reference +https://github.com/atomone-hub/atomone/blob/539ee0ea3b33211ce90a9c6679911893f72b8d26/proto/atomone/gov/v1/tx.proto#L290-L301 +``` + +### Undelegate Governance Voting Power + +Stakers can undelegate their governance voting power from a governor by sending a +`MsgUndelegateGovernancePower` transaction. + +```protobuf reference +https://github.com/atomone-hub/atomone/blob/539ee0ea3b33211ce90a9c6679911893f72b8d26/proto/atomone/gov/v1/tx.proto#L306-L315 +``` + ## Events The governance module emits the following events: @@ -1058,6 +1169,8 @@ Some older fields have been deprecated but remain in `gov.proto` for backward co | quorum_range | object (QuorumRange) | _See below_ | | constitution_amendment_quorum_range | object (QuorumRange) | _See below_ | | law_quorum_range | object (QuorumRange) | _See below_ | +| governor_status_change_period | string (time ns) | "24192000000000000" (2419200s) | +| min_governor_self_delegation | string (int ) | 1000000000 | ### MinDepositThrottler (dynamic MinDeposit) @@ -1182,7 +1295,6 @@ pagination: total: "0" ``` - ##### min deposit The `min-deposit` command allows users to query the @@ -1231,6 +1343,64 @@ min_initial_deposit: denom: atone ``` +##### governor + +The `governor` command allows users to query a governor for a given address. + +```bash +atomoned query gov governor [address] [flags] +``` + +Example: + +```bash +atomoned query gov governor atonegov1.. +``` + +##### governors + +The `governors` command allows users to query all governors. + +```bash +atomoned query gov governors [flags] +``` + +Example: + +```bash +atomoned query gov governors +``` + +##### governance delegation + +The `delegation` command allows users to query a governance delegation for a +given delegator, if it exists. + +```bash +atomoned query gov delegation [delegator-addr] [flags] +``` + +Example: + +```bash +atomoned query gov delegation atone1.. +``` + +##### governance delegations for a governor + +The `delegations` command allows users to query all governance delegations for +a given governor. + +```bash +atomoned query gov delegations [governor-addr] [flags] +``` + +Example: + +```bash +atomoned query gov delegations atonegov1.. +``` + ##### param The `param` command allows users to query a given parameter for the `gov` module. @@ -1664,6 +1834,80 @@ Example: atomoned tx gov weighted-vote 1 yes=0.5,no=0.5 --from atone1.. ``` +##### create-governor + +The `create-governor` command allows users to create a governor. + +```bash +atomoned tx gov create-governor [base-address] [moniker] [identity] [website] [security-contact] [details] [flags] +``` + +Example: + +```bash +atomoned tx gov create-governor atone1.. "NewGovernor" "ABC123DEF5678" "www.mywebsite.com" "" "-" --from atone1.. +``` + +##### edit-governor + +The `edit-governor` command allows users to edit a governor. + +```bash +atomoned tx gov edit-governor [base-address] [moniker] [identity] [website] [security-contact] [details] [flags] +``` + +Example: + +```bash +atomoned tx gov edit-governor atone1.. "EditedGovernor" "ABC123DEF5678" "www.mywebsite.com" "" "-" --from atone1.. +``` + +##### update-governor-status + +The `update-governor-status` command allows users to update a governor's status. +The update from inactive to active also requires the minimum self-delegation to +be satisfied. + +```bash +atomoned tx gov update-governor-status [base-address] [status] [flags] +``` + +Example: + +```bash +atomoned tx gov update-governor-status atone1.. active --from atone1.. +``` + +##### delegate-governor + +The `delegate-governor` command allows users to delegate governance voting power +to a governor. + +```bash +atomoned tx gov delegate-governor [delegator-address] [governor-address] [flags] +``` + +Example: + +```bash +atomoned tx gov delegate-governor atone1.. atonegov1.. --from atone1.. +``` + +##### undelegate-governor + +The `undelegate-governor` command allows users to undelegate governance voting power +and return to direct voting only. + +```bash +atomoned tx gov undelegate-governor [delegator-address] [flags] +``` + +Example: + +```bash +atomoned tx gov undelegate-governor atone1.. --from atone1.. +``` + ### gRPC A user can query the `gov` module using gRPC endpoints. @@ -1763,7 +2007,6 @@ Example Output: } ``` - #### Proposals The `Proposals` endpoint allows users to query all proposals with optional filters. @@ -2186,7 +2429,7 @@ Example Output: } ``` -#### deposits +#### Deposits The `Deposits` endpoint allows users to query all deposits for a given proposal. @@ -2322,6 +2565,83 @@ Example Output: } ``` +#### Governor + +The `Governor` endpoint allows users to query a governor for a given address. + +using v1: + +```bash +atomone.gov.v1.Query/Governor +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"governor_address":"atone1.."}' \ + localhost:9090 \ + atomone.gov.v1.Query/Governor +``` + +#### Governors + +The `Governors` endpoint allows users to query all governors. + +Using legacy v1: + +```bash +atomone.gov.v1beta1.Query/Governors +``` + +Example: + +```bash +grpcurl -plaintext \ + localhost:9090 \ + atomone.gov.v1beta1.Query/Governors +``` + +#### Delegation + +The `Delegation` endpoint allows users to query a governance delegation for a +given delegator. + +Using legacy v1: + +```bash +atomone.gov.v1beta1.Query/Delegation +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"delegator_address":"atone1.."}' \ + localhost:9090 \ + atomone.gov.v1beta1.Query/Delegation +``` + +#### Delegations + +The `Delegations` endpoint allows users to query all governance delegations for +a given governor. + +Using legacy v1: + +```bash +atomone.gov.v1beta1.Query/Delegations +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"governor_address":"atonegov1.."}' \ + localhost:9090 \ + atomone.gov.v1beta1.Query/Delegations +``` + ### REST A user can query the `gov` module using REST endpoints. @@ -3044,6 +3364,72 @@ Example Output: ``` +#### governor + +The `governor` endpoint allows users to query a governor for a given address. + +Using v1: + +```bash +/atomone/gov/v1/governors/{governor_address} +``` + +Example: + +```bash +curl localhost:1317/atomone/gov/v1/governors/atonegov1.. +``` + +#### governors + +The `governors` endpoint allows users to query all governors. + +Using v1: + +```bash +/atomone/gov/v1/governors +``` + +Example: + +```bash +curl localhost:1317/atomone/gov/v1/governors +``` + +#### delegation + +The `delegation` endpoint allows users to query a governance delegation for a +given delegator. + +Using v1: + +```bash +/atomone/gov/v1/delegations/{delegator_address} +``` + +Example: + +```bash +curl localhost:1317/atomone/gov/v1/delegations/atone1.. +``` + +#### delegations + +The `delegations` endpoint allows users to query all governance delegations for +a given governor. + +Using v1: + +```bash +/atomone/gov/v1/governors/{governor_address}/delegations +``` + +Example: + +```bash +curl localhost:1317/atomone/gov/v1/governors/atonegov1../delegations +``` + ## Metadata The gov module has two locations for metadata where users can provide further @@ -3106,12 +3492,6 @@ governance module. Future improvements may include: If a `SoftwareUpgradeProposal` linked to an open bounty is accepted by governance, the funds that were reserved are automatically transferred to the submitter. -* **Complex delegation:** Delegators could choose other representatives than - their validators. Ultimately, the chain of representatives would always end - up to a validator, but delegators could inherit the vote of their chosen - representative before they inherit the vote of their validator. In other - words, they would only inherit the vote of their validator if their other - appointed representative did not vote. * **Better process for proposal review:** There would be two parts to `proposal.Deposit`, one for anti-spam (same as in MVP) and an other one to reward third party auditors. diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index d15e2958..a704ff1a 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -44,6 +44,11 @@ func GetQueryCmd() *cobra.Command { GetCmdConstitution(), GetCmdQueryMinDeposit(), GetCmdQueryMinInitialDeposit(), + GetCmdQueryGovernor(), + GetCmdQueryGovernors(), + GetCmdQueryGovernanceDelegation(), + GetCmdQueryGovernanceDelegations(), + GetCmdQueryGovernorValShares(), ) return govQueryCmd @@ -829,3 +834,222 @@ $ %s query gov min-initial-deposit }, } } + +// GetCmdQueryGovernor implements the query governor command. +func GetCmdQueryGovernor() *cobra.Command { + cmd := &cobra.Command{ + Use: "governor [address]", + Args: cobra.ExactArgs(1), + Short: "Query details of a single governor", + Long: strings.TrimSpace( + fmt.Sprintf(`Query details for a governor by its address. + +Example: +$ %s query gov governor cosmosgov1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + addr, err := types.GovernorAddressFromBech32(args[0]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := v1.NewQueryClient(clientCtx) + + res, err := queryClient.Governor( + cmd.Context(), + &v1.QueryGovernorRequest{GovernorAddress: addr.String()}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res.Governor) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryGovernors implements the query governors command. +func GetCmdQueryGovernors() *cobra.Command { + cmd := &cobra.Command{ + Use: "governors", + Short: "Query all governors", + Long: strings.TrimSpace( + fmt.Sprintf(`Query all governors. + +Example: +$ %s query gov governors +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := v1.NewQueryClient(clientCtx) + + res, err := queryClient.Governors( + cmd.Context(), + &v1.QueryGovernorsRequest{}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryGovernanceDelegation implements the query governance delegation command. +func GetCmdQueryGovernanceDelegation() *cobra.Command { + cmd := &cobra.Command{ + Use: "delegation [address]", + Args: cobra.ExactArgs(1), + Short: "Query governance delegation for a delegator", + Long: strings.TrimSpace( + fmt.Sprintf(`Query details for a governance delegation by a delegator. + +Example: +$ %s query gov delegation cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + addr, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := v1.NewQueryClient(clientCtx) + + res, err := queryClient.GovernanceDelegation( + cmd.Context(), + &v1.QueryGovernanceDelegationRequest{DelegatorAddress: addr.String()}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryGovernanceDelegations implements the query governance delegations command. +func GetCmdQueryGovernanceDelegations() *cobra.Command { + cmd := &cobra.Command{ + Use: "delegations [governor_address]", + Short: "Query all governance delegations for a governor", + Long: strings.TrimSpace( + fmt.Sprintf(`Query all governance delegations for a governor. + +Example: +$ %s query gov delegations cosmosgov1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk +`, + version.AppName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + addr, err := types.GovernorAddressFromBech32(args[0]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := v1.NewQueryClient(clientCtx) + + res, err := queryClient.GovernanceDelegations( + cmd.Context(), + &v1.QueryGovernanceDelegationsRequest{GovernorAddress: addr.String()}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryGovernorValShares implements the query governor validator shares command. +func GetCmdQueryGovernorValShares() *cobra.Command { + cmd := &cobra.Command{ + Use: "vshares [governor_address]", + Args: cobra.ExactArgs(1), + Short: "Query governor virtual validators shares", + Long: strings.TrimSpace( + fmt.Sprintf(`Query details for a governor virtual validators shares by its address. + +Example: +$ %s query gov vshares cosmosgov1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + addr, err := types.GovernorAddressFromBech32(args[0]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := v1.NewQueryClient(clientCtx) + + res, err := queryClient.GovernorValShares( + cmd.Context(), + &v1.QueryGovernorValSharesRequest{GovernorAddress: addr.String()}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index f1362de3..059ebb0e 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -74,6 +74,11 @@ func NewTxCmd(legacyPropCmds []*cobra.Command) *cobra.Command { NewCmdSubmitProposal(), NewCmdDraftProposal(), NewCmdGenerateConstitutionAmendment(), + CreateGovernorCmd(), + EditGovernorCmd(), + UpdateGovernorStatusCmd(), + DelegateGovernorCmd(), + UndelegateGovernorCmd(), // Deprecated cmdSubmitLegacyProp, @@ -470,3 +475,159 @@ $ %s tx gov generate-constitution-amendment path/to/updated/constitution.md return cmd } + +// CreateGovernorCmd creates a new Governor +func CreateGovernorCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-governor [address] [moniker] [identity] [website] [security-contact] [details]", + Short: "Create a new Governor", + Args: cobra.ExactArgs(6), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + address, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + description := v1.GovernorDescription{ + Moniker: args[1], + Identity: args[2], + Website: args[3], + SecurityContact: args[4], + Details: args[5], + } + + msg := v1.NewMsgCreateGovernor(address, description) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// EditGovernorCmd edits a Governor +func EditGovernorCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "edit-governor [address] [moniker] [identity] [website] [security-contact] [details]", + Short: "Edit a Governor.", + Args: cobra.ExactArgs(6), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + address, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + description := v1.GovernorDescription{ + Moniker: args[1], + Identity: args[2], + Website: args[3], + SecurityContact: args[4], + Details: args[5], + } + + msg := v1.NewMsgEditGovernor(address, description) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// UpdateGovernorStatusCmd updates the status of a Governor +func UpdateGovernorStatusCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-governor-status [address] [status]", + Short: "Update the status of a Governor", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + address, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + status, err := v1.GovernorStatusFromString(args[1]) + if err != nil { + return err + } + + msg := v1.NewMsgUpdateGovernorStatus(address, status) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// DelegateGovernorCmd delegates or redelegates to a Governor +func DelegateGovernorCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "delegate-governor [delegator-address] [governor-address]", + Short: "Delegate governance power to a Governor. Triggers a redelegation if a governance delegation already exists", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + delegatorAddress, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + governorAddress, err := types.GovernorAddressFromBech32(args[1]) + if err != nil { + return err + } + + msg := v1.NewMsgDelegateGovernor(delegatorAddress, governorAddress) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// UndelegateGovernorCmd undelegates from a Governor +func UndelegateGovernorCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "undelegate-governor [delegator-address]", + Short: "Undelegate tokens from a Governor", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + delegatorAddress, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + msg := v1.NewMsgUndelegateGovernor(delegatorAddress) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/gov/genesis.go b/x/gov/genesis.go index 0b5d03fd..6be8fe29 100644 --- a/x/gov/genesis.go +++ b/x/gov/genesis.go @@ -108,6 +108,50 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k } else { k.SetLastMinInitialDeposit(ctx, data.Params.MinInitialDepositThrottler.FloorValue, ctx.BlockTime()) } + + // set governors + for _, governor := range data.Governors { + // check that base account exists + accAddr := sdk.AccAddress(governor.GetAddress()) + acc := ak.GetAccount(ctx, accAddr) + if acc == nil { + panic(fmt.Sprintf("account %s does not exist", accAddr.String())) + } + + k.SetGovernor(ctx, *governor) + if governor.IsActive() { + err := k.DelegateToGovernor(ctx, accAddr, governor.GetAddress()) + if err != nil { + panic(fmt.Sprintf("failed to delegate to governor %s: %v", governor.GetAddress().String(), err)) + } + } + } + // set governance delegations + for _, delegation := range data.GovernanceDelegations { + delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + govAddr := types.MustGovernorAddressFromBech32(delegation.GovernorAddress) + // check delegator exists + acc := ak.GetAccount(ctx, delAddr) + if acc == nil { + panic(fmt.Sprintf("account %s does not exist", delAddr.String())) + } + // check governor exists + _, found := k.GetGovernor(ctx, govAddr) + if !found { + panic(fmt.Sprintf("governor %s does not exist", govAddr.String())) + } + + // if account is active governor and delegation is not to self, error + delGovAddr := types.GovernorAddress(delAddr) + if _, found = k.GetGovernor(ctx, delGovAddr); found && !delGovAddr.Equals(govAddr) { + panic(fmt.Sprintf("account %s is an active governor and cannot delegate", delAddr.String())) + } + + err := k.DelegateToGovernor(ctx, delAddr, govAddr) + if err != nil { + panic(fmt.Sprintf("failed to delegate to governor %s: %v", govAddr.String(), err)) + } + } } // ExportGenesis - output genesis parameters @@ -119,6 +163,7 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v1.GenesisState { proposals := k.GetProposals(ctx) params := k.GetParams(ctx) constitution := k.GetConstitution(ctx) + governors := k.GetAllGovernors(ctx) var proposalsDeposits v1.Deposits var proposalsVotes v1.Votes @@ -141,6 +186,12 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v1.GenesisState { Time: &blockTime, } + var governanceDelegations []*v1.GovernanceDelegation + for _, g := range governors { + delegations := k.GetAllGovernanceDelegationsByGovernor(ctx, g.GetAddress()) + governanceDelegations = append(governanceDelegations, delegations...) + } + return &v1.GenesisState{ StartingProposalId: startingProposalID, Deposits: proposalsDeposits, @@ -153,5 +204,7 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v1.GenesisState { ParticipationEma: participationEma, ConstitutionAmendmentParticipationEma: constitutionAmendmentParticipationEma, LawParticipationEma: lawParticipationEma, + Governors: governors, + GovernanceDelegations: governanceDelegations, } } diff --git a/x/gov/keeper/delegation.go b/x/gov/keeper/delegation.go new file mode 100644 index 00000000..3fa6db9b --- /dev/null +++ b/x/gov/keeper/delegation.go @@ -0,0 +1,228 @@ +package keeper + +import ( + "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/atomone-hub/atomone/x/gov/types" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" +) + +// SetGovernanceDelegation sets a governance delegation in the store +func (k Keeper) SetGovernanceDelegation(ctx sdk.Context, delegation v1.GovernanceDelegation) { + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(&delegation) + delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + store.Set(types.GovernanceDelegationKey(delAddr), b) + + // Set the reverse mapping from governor to delegation + // mainly for querying all delegations for a governor + // TODO: see if we can avoid duplicate storage + govAddr := types.MustGovernorAddressFromBech32(delegation.GovernorAddress) + store.Set(types.GovernanceDelegationsByGovernorKey(govAddr, delAddr), b) +} + +// GetGovernanceDelegation gets a governance delegation from the store +func (k Keeper) GetGovernanceDelegation(ctx sdk.Context, delegatorAddr sdk.AccAddress) (v1.GovernanceDelegation, bool) { + store := ctx.KVStore(k.storeKey) + b := store.Get(types.GovernanceDelegationKey(delegatorAddr)) + if b == nil { + return v1.GovernanceDelegation{}, false + } + var delegation v1.GovernanceDelegation + k.cdc.MustUnmarshal(b, &delegation) + return delegation, true +} + +// RemoveGovernanceDelegation removes a governance delegation from the store +func (k Keeper) RemoveGovernanceDelegation(ctx sdk.Context, delegatorAddr sdk.AccAddress) { + // need to remove from both the delegator and governor mapping + store := ctx.KVStore(k.storeKey) + delegation, found := k.GetGovernanceDelegation(ctx, delegatorAddr) + if !found { + return + } + delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + store.Delete(types.GovernanceDelegationKey(delAddr)) + + govAddr := types.MustGovernorAddressFromBech32(delegation.GovernorAddress) + store.Delete(types.GovernanceDelegationsByGovernorKey(govAddr, delAddr)) +} + +// SetGovernorValShares sets a governor validator shares in the store +func (k Keeper) SetGovernorValShares(ctx sdk.Context, share v1.GovernorValShares) { + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(&share) + govAddr := types.MustGovernorAddressFromBech32(share.GovernorAddress) + valAddr, err := sdk.ValAddressFromBech32(share.ValidatorAddress) + if err != nil { + panic(err) + } + store.Set(types.ValidatorSharesByGovernorKey(govAddr, valAddr), b) +} + +// GetGovernorValShares gets a governor validator shares from the store +func (k Keeper) GetGovernorValShares(ctx sdk.Context, governorAddr types.GovernorAddress, validatorAddr sdk.ValAddress) (v1.GovernorValShares, bool) { + store := ctx.KVStore(k.storeKey) + b := store.Get(types.ValidatorSharesByGovernorKey(governorAddr, validatorAddr)) + if b == nil { + return v1.GovernorValShares{}, false + } + var share v1.GovernorValShares + k.cdc.MustUnmarshal(b, &share) + return share, true +} + +// IterateGovernorValShares iterates over all governor validator shares +func (k Keeper) IterateGovernorValShares(ctx sdk.Context, governorAddr types.GovernorAddress, cb func(index int64, share v1.GovernorValShares) (stop bool)) { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.ValidatorSharesByGovernorKey(governorAddr, []byte{})) + defer iterator.Close() + + for i := int64(0); iterator.Valid(); iterator.Next() { + var share v1.GovernorValShares + k.cdc.MustUnmarshal(iterator.Value(), &share) + if cb(i, share) { + break + } + i++ + } +} + +// IterateGovernorDelegations iterates over all governor delegations +func (k Keeper) IterateGovernorDelegations(ctx sdk.Context, governorAddr types.GovernorAddress, cb func(index int64, delegation v1.GovernanceDelegation) (stop bool)) { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.GovernanceDelegationsByGovernorKey(governorAddr, []byte{})) + defer iterator.Close() + + for i := int64(0); iterator.Valid(); iterator.Next() { + var delegation v1.GovernanceDelegation + k.cdc.MustUnmarshal(iterator.Value(), &delegation) + if cb(i, delegation) { + break + } + i++ + } +} + +// RemoveGovernorValShares removes a governor validator shares from the store +func (k Keeper) RemoveGovernorValShares(ctx sdk.Context, governorAddr types.GovernorAddress, validatorAddr sdk.ValAddress) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ValidatorSharesByGovernorKey(governorAddr, validatorAddr)) +} + +// GetAllGovernanceDelegationsByGovernor gets all governance delegations for a specific governor +func (k Keeper) GetAllGovernanceDelegationsByGovernor(ctx sdk.Context, governorAddr types.GovernorAddress) (delegations []*v1.GovernanceDelegation) { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.GovernanceDelegationsByGovernorKey(governorAddr, []byte{})) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var delegation v1.GovernanceDelegation + k.cdc.MustUnmarshal(iterator.Value(), &delegation) + delegations = append(delegations, &delegation) + } + return delegations +} + +// GetAllGovernorValShares gets all governor validators shares +func (k Keeper) GetAllGovernorValShares(ctx sdk.Context, governorAddr types.GovernorAddress) []v1.GovernorValShares { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.ValidatorSharesByGovernorKey(governorAddr, []byte{})) + defer iterator.Close() + + var shares []v1.GovernorValShares + for ; iterator.Valid(); iterator.Next() { + var share v1.GovernorValShares + k.cdc.MustUnmarshal(iterator.Value(), &share) + shares = append(shares, share) + } + return shares +} + +// IncreaseGovernorShares increases the governor validator shares in the store +func (k Keeper) IncreaseGovernorShares(ctx sdk.Context, governorAddr types.GovernorAddress, validatorAddr sdk.ValAddress, shares math.LegacyDec) { + valShares, found := k.GetGovernorValShares(ctx, governorAddr, validatorAddr) + if !found { + valShares = v1.NewGovernorValShares(governorAddr, validatorAddr, shares) + } else { + valShares.Shares = valShares.Shares.Add(shares) + } + k.SetGovernorValShares(ctx, valShares) +} + +// DecreaseGovernorShares decreases the governor validator shares in the store +func (k Keeper) DecreaseGovernorShares(ctx sdk.Context, governorAddr types.GovernorAddress, validatorAddr sdk.ValAddress, shares math.LegacyDec) { + share, found := k.GetGovernorValShares(ctx, governorAddr, validatorAddr) + if !found { + panic("cannot decrease shares for a non-existent governor delegation") + } + share.Shares = share.Shares.Sub(shares) + if share.Shares.IsNegative() { + panic("negative shares") + } + if share.Shares.IsZero() { + k.RemoveGovernorValShares(ctx, governorAddr, validatorAddr) + } else { + k.SetGovernorValShares(ctx, share) + } +} + +// UndelegateFromGovernor decreases all governor validator shares in the store +// and then removes the governor delegation for the given delegator +func (k Keeper) UndelegateFromGovernor(ctx sdk.Context, delegatorAddr sdk.AccAddress) error { + delegation, found := k.GetGovernanceDelegation(ctx, delegatorAddr) + if !found { + return types.ErrGovernanceDelegationNotFound.Wrapf("governance delegation for delegator %s does not exist", delegatorAddr.String()) + } + govAddr := types.MustGovernorAddressFromBech32(delegation.GovernorAddress) + // iterate all delegations of delegator and decrease shares + err := k.sk.IterateDelegations(ctx, delegatorAddr, func(_ int64, delegation stakingtypes.DelegationI) (stop bool) { + valAddr, err := sdk.ValAddressFromBech32(delegation.GetValidatorAddr()) + if err != nil { + panic(err) // This should never happen + } + k.DecreaseGovernorShares(ctx, govAddr, valAddr, delegation.GetShares()) + return false + }) + if err != nil { + return sdkerrors.ErrInvalidRequest.Wrapf("failed to iterate delegations: %v", err) + } + // remove the governor delegation + k.RemoveGovernanceDelegation(ctx, delegatorAddr) + return nil +} + +// DelegateGovernor creates a governor delegation for the given delegator +// and increases all governor validator shares in the store +func (k Keeper) DelegateToGovernor(ctx sdk.Context, delegatorAddr sdk.AccAddress, governorAddr types.GovernorAddress) error { + delegation := v1.NewGovernanceDelegation(delegatorAddr, governorAddr) + k.SetGovernanceDelegation(ctx, delegation) + // iterate all delegations of delegator and increase shares + err := k.sk.IterateDelegations(ctx, delegatorAddr, func(_ int64, delegation stakingtypes.DelegationI) (stop bool) { + valAddr, err := sdk.ValAddressFromBech32(delegation.GetValidatorAddr()) + if err != nil { + panic(err) // This should never happen + } + k.IncreaseGovernorShares(ctx, governorAddr, valAddr, delegation.GetShares()) + return false + }) + if err != nil { + return sdkerrors.ErrInvalidRequest.Wrapf("failed to iterate delegations: %v", err) + } + return nil +} + +// RedelegateGovernor re-delegates all governor validator shares from one governor to another +func (k Keeper) RedelegateToGovernor(ctx sdk.Context, delegatorAddr sdk.AccAddress, dstGovernorAddr types.GovernorAddress) error { + // undelegate from the source governor + if err := k.UndelegateFromGovernor(ctx, delegatorAddr); err != nil { + return err + } + // delegate to the destination governor + return k.DelegateToGovernor(ctx, delegatorAddr, dstGovernorAddr) +} diff --git a/x/gov/keeper/delegation_test.go b/x/gov/keeper/delegation_test.go new file mode 100644 index 00000000..42269008 --- /dev/null +++ b/x/gov/keeper/delegation_test.go @@ -0,0 +1,180 @@ +package keeper_test + +import ( + "testing" + + "cosmossdk.io/math" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" + "github.com/stretchr/testify/assert" +) + +func TestGovernanceDelegate(t *testing.T) { + assert := assert.New(t) + govKeeper, mocks, _, ctx := setupGovKeeper(t, mockAccountKeeperExpectations) + s := newFixture(t, ctx, 2, 3, 2, govKeeper, mocks) + // Setup the delegators + s.delegate(s.delAddrs[0], s.valAddrs[0], 1) + s.delegate(s.delAddrs[0], s.valAddrs[1], 2) + s.delegate(s.delAddrs[1], s.valAddrs[0], 5) + s.delegate(s.delAddrs[2], s.valAddrs[1], 8) + + // Delegate to active governor + err := govKeeper.DelegateToGovernor(ctx, s.delAddrs[0], s.activeGovernors[0].GetAddress()) + assert.NoError(err) + err = govKeeper.DelegateToGovernor(ctx, s.delAddrs[1], s.activeGovernors[0].GetAddress()) + assert.NoError(err) + // Delegate to inactive governor + err = govKeeper.DelegateToGovernor(ctx, s.delAddrs[2], s.inactiveGovernor.GetAddress()) + assert.NoError(err) + + // Assert GetGovernanceDelegation + deleg1, found := govKeeper.GetGovernanceDelegation(ctx, s.delAddrs[0]) + if assert.True(found, "deleg1 not found") { + assert.Equal(deleg1.DelegatorAddress, s.delAddrs[0].String()) + assert.Equal(deleg1.GovernorAddress, s.activeGovernors[0].GovernorAddress) + } + deleg2, found := govKeeper.GetGovernanceDelegation(ctx, s.delAddrs[1]) + if assert.True(found, "deleg2 not found") { + assert.Equal(deleg2.DelegatorAddress, s.delAddrs[1].String()) + assert.Equal(deleg2.GovernorAddress, s.activeGovernors[0].GovernorAddress) + } + deleg3, found := govKeeper.GetGovernanceDelegation(ctx, s.delAddrs[2]) + if assert.True(found, "deleg3 not found") { + assert.Equal(deleg3.DelegatorAddress, s.delAddrs[2].String()) + assert.Equal(deleg3.GovernorAddress, s.inactiveGovernor.GovernorAddress) + } + + // Assert IterateGovernorDelegations + var delegs []v1.GovernanceDelegation + govKeeper.IterateGovernorDelegations(ctx, s.activeGovernors[0].GetAddress(), + func(i int64, d v1.GovernanceDelegation) bool { + delegs = append(delegs, d) + return false + }) + assert.ElementsMatch(delegs, []v1.GovernanceDelegation{deleg1, deleg2}) + delegs = nil + govKeeper.IterateGovernorDelegations(ctx, s.inactiveGovernor.GetAddress(), + func(i int64, d v1.GovernanceDelegation) bool { + delegs = append(delegs, d) + return false + }) + assert.ElementsMatch(delegs, []v1.GovernanceDelegation{deleg3}) + + // Assert GetAllGovernanceDelegationsByGovernor + allDelegs := govKeeper.GetAllGovernanceDelegationsByGovernor(ctx, s.activeGovernors[0].GetAddress()) + assert.ElementsMatch(allDelegs, []*v1.GovernanceDelegation{&deleg1, &deleg2}) + allDelegs = govKeeper.GetAllGovernanceDelegationsByGovernor(ctx, s.inactiveGovernor.GetAddress()) + assert.ElementsMatch(allDelegs, []*v1.GovernanceDelegation{&deleg3}) + + // Assert GetGovernorValShares + valShare1, found := govKeeper.GetGovernorValShares(ctx, s.activeGovernors[0].GetAddress(), s.valAddrs[0]) + if assert.True(found, "valShare1 not found") { + assert.Equal(valShare1, v1.GovernorValShares{ + GovernorAddress: s.activeGovernors[0].GovernorAddress, + ValidatorAddress: s.valAddrs[0].String(), + Shares: math.LegacyNewDec(1 + 5), + }) + } + valShare2, found := govKeeper.GetGovernorValShares(ctx, s.activeGovernors[0].GetAddress(), s.valAddrs[1]) + if assert.True(found, "valShare2 not found") { + assert.Equal(valShare2, v1.GovernorValShares{ + GovernorAddress: s.activeGovernors[0].GovernorAddress, + ValidatorAddress: s.valAddrs[1].String(), + Shares: math.LegacyNewDec(2), + }) + } + _, found = govKeeper.GetGovernorValShares(ctx, s.inactiveGovernor.GetAddress(), s.valAddrs[0]) + assert.False(found) + valShare3, found := govKeeper.GetGovernorValShares(ctx, s.inactiveGovernor.GetAddress(), s.valAddrs[1]) + if assert.True(found, "valShare3 not found") { + assert.Equal(valShare3, v1.GovernorValShares{ + GovernorAddress: s.inactiveGovernor.GovernorAddress, + ValidatorAddress: s.valAddrs[1].String(), + Shares: math.LegacyNewDec(8), + }) + } + + // Assert GetAllGovernorValShares + activeGovValShares := govKeeper.GetAllGovernorValShares(ctx, s.activeGovernors[0].GetAddress()) + assert.ElementsMatch(activeGovValShares, []v1.GovernorValShares{valShare1, valShare2}) + inactiveGovValShares := govKeeper.GetAllGovernorValShares(ctx, s.inactiveGovernor.GetAddress()) + assert.ElementsMatch(inactiveGovValShares, []v1.GovernorValShares{valShare3}) + + // Assert IterateGovernorValShares + var valShares []v1.GovernorValShares + govKeeper.IterateGovernorValShares(ctx, s.activeGovernors[0].GetAddress(), func(i int64, v v1.GovernorValShares) bool { + valShares = append(valShares, v) + return false + }) + assert.ElementsMatch(valShares, activeGovValShares) + valShares = nil + govKeeper.IterateGovernorValShares(ctx, s.inactiveGovernor.GetAddress(), func(i int64, v v1.GovernorValShares) bool { + valShares = append(valShares, v) + return false + }) + assert.ElementsMatch(valShares, inactiveGovValShares) + + // Assert RedelegateToGovernor + err = govKeeper.RedelegateToGovernor(ctx, s.delAddrs[0], s.inactiveGovernor.GetAddress()) + assert.NoError(err) + allDelegs = govKeeper.GetAllGovernanceDelegationsByGovernor(ctx, s.activeGovernors[0].GetAddress()) + assert.ElementsMatch(allDelegs, []*v1.GovernanceDelegation{&deleg2}) + allDelegs = govKeeper.GetAllGovernanceDelegationsByGovernor(ctx, s.inactiveGovernor.GetAddress()) + deleg1.GovernorAddress = s.inactiveGovernor.GovernorAddress + assert.ElementsMatch(allDelegs, []*v1.GovernanceDelegation{&deleg1, &deleg3}) + valShare1, found = govKeeper.GetGovernorValShares(ctx, s.activeGovernors[0].GetAddress(), s.valAddrs[0]) + if assert.True(found, "valShare1 not found") { + assert.Equal(valShare1, v1.GovernorValShares{ + GovernorAddress: s.activeGovernors[0].GovernorAddress, + ValidatorAddress: s.valAddrs[0].String(), + Shares: math.LegacyNewDec(5), + }) + } + _, found = govKeeper.GetGovernorValShares(ctx, s.activeGovernors[0].GetAddress(), s.valAddrs[1]) + assert.False(found) + valShare2, found = govKeeper.GetGovernorValShares(ctx, s.inactiveGovernor.GetAddress(), s.valAddrs[0]) + if assert.True(found, "valShare2 not found") { + assert.Equal(valShare2, v1.GovernorValShares{ + GovernorAddress: s.inactiveGovernor.GovernorAddress, + ValidatorAddress: s.valAddrs[0].String(), + Shares: math.LegacyNewDec(1), + }) + } + valShare3, found = govKeeper.GetGovernorValShares(ctx, s.inactiveGovernor.GetAddress(), s.valAddrs[1]) + if assert.True(found, "valShare3 not found") { + assert.Equal(valShare3, v1.GovernorValShares{ + GovernorAddress: s.inactiveGovernor.GovernorAddress, + ValidatorAddress: s.valAddrs[1].String(), + Shares: math.LegacyNewDec(10), + }) + } + + // Assert UndelegateFromGovernor + err = govKeeper.UndelegateFromGovernor(ctx, s.delAddrs[0]) + assert.NoError(err) + allDelegs = govKeeper.GetAllGovernanceDelegationsByGovernor(ctx, s.activeGovernors[0].GetAddress()) + assert.ElementsMatch(allDelegs, []*v1.GovernanceDelegation{&deleg2}) + allDelegs = govKeeper.GetAllGovernanceDelegationsByGovernor(ctx, s.inactiveGovernor.GetAddress()) + deleg1.GovernorAddress = s.inactiveGovernor.GovernorAddress + assert.ElementsMatch(allDelegs, []*v1.GovernanceDelegation{&deleg3}) + valShare1, found = govKeeper.GetGovernorValShares(ctx, s.activeGovernors[0].GetAddress(), s.valAddrs[0]) + if assert.True(found, "valShare1 not found") { + assert.Equal(valShare1, v1.GovernorValShares{ + GovernorAddress: s.activeGovernors[0].GovernorAddress, + ValidatorAddress: s.valAddrs[0].String(), + Shares: math.LegacyNewDec(5), + }) + } + _, found = govKeeper.GetGovernorValShares(ctx, s.activeGovernors[0].GetAddress(), s.valAddrs[1]) + assert.False(found) + _, found = govKeeper.GetGovernorValShares(ctx, s.inactiveGovernor.GetAddress(), s.valAddrs[0]) + assert.False(found) + valShare3, found = govKeeper.GetGovernorValShares(ctx, s.inactiveGovernor.GetAddress(), s.valAddrs[1]) + if assert.True(found, "valShare3 not found") { + assert.Equal(valShare3, v1.GovernorValShares{ + GovernorAddress: s.inactiveGovernor.GovernorAddress, + ValidatorAddress: s.valAddrs[1].String(), + Shares: math.LegacyNewDec(8), + }) + } +} diff --git a/x/gov/keeper/fixture_test.go b/x/gov/keeper/fixture_test.go new file mode 100644 index 00000000..6fc8bf21 --- /dev/null +++ b/x/gov/keeper/fixture_test.go @@ -0,0 +1,170 @@ +package keeper_test + +import ( + "context" + "testing" + "time" + + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "cosmossdk.io/math" + + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/atomone-hub/atomone/x/gov/keeper" + "github.com/atomone-hub/atomone/x/gov/types" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" +) + +type fixture struct { + t *testing.T + + valAddrs []sdk.ValAddress + delAddrs []sdk.AccAddress + govAddrs []types.GovernorAddress + totalBonded int64 + validators []stakingtypes.Validator + delegations []stakingtypes.Delegation + + keeper *keeper.Keeper + ctx sdk.Context + mocks mocks + + activeGovernors []v1.Governor + inactiveGovernor v1.Governor + proposal v1.Proposal +} + +// newFixture returns a configured fixture for testing the govKeeper methods. +// - track staking delegations and ensure the mock staking keeper replies +// accordingly. +// - setup 1 active and 1 inactive governors +// - initiates the validators with a self delegation of 1: +// - setup IterateBondedValidatorsByPower call +// - setup IterateDelegations call for validators +func newFixture(t *testing.T, ctx sdk.Context, numVals, numDelegators, + numGovernors int, govKeeper *keeper.Keeper, mocks mocks, +) *fixture { + var ( + addrs = simtestutil.CreateRandomAccounts(numVals + numDelegators + numGovernors) + valAddrs = simtestutil.ConvertAddrsToValAddrs(addrs[:numVals]) + delAddrs = addrs[numVals : numVals+numDelegators] + govAddrs = convertAddrsToGovAddrs(addrs[numVals+numDelegators:]) + s = &fixture{ + t: t, + ctx: ctx, + valAddrs: valAddrs, + delAddrs: delAddrs, + govAddrs: govAddrs, + keeper: govKeeper, + mocks: mocks, + } + ) + mocks.stakingKeeper.EXPECT().TotalBondedTokens(gomock.Any()). + DoAndReturn(func(_ context.Context) (math.Int, error) { + return math.NewInt(s.totalBonded), nil + }).MaxTimes(1) + + // Mocks a bunch of validators + for i := 0; i < len(valAddrs); i++ { + s.validators = append(s.validators, stakingtypes.Validator{ + OperatorAddress: valAddrs[i].String(), + Status: stakingtypes.Bonded, + Tokens: math.ZeroInt(), + DelegatorShares: math.LegacyZeroDec(), + }) + // validator self delegation + s.delegate(sdk.AccAddress(valAddrs[i]), valAddrs[i], 1) + } + mocks.stakingKeeper.EXPECT(). + IterateBondedValidatorsByPower(ctx, gomock.Any()). + DoAndReturn( + func(ctx context.Context, fn func(index int64, validator stakingtypes.ValidatorI) bool) error { + for i := 0; i < len(valAddrs); i++ { + fn(int64(i), s.validators[i]) + } + return nil + }).AnyTimes() + mocks.stakingKeeper.EXPECT(). + IterateDelegations(ctx, gomock.Any(), gomock.Any()). + DoAndReturn( + func(ctx context.Context, voter sdk.AccAddress, fn func(index int64, d stakingtypes.DelegationI) bool) error { + for i, d := range s.delegations { + if d.DelegatorAddress == voter.String() { + fn(int64(i), d) + } + } + return nil + }).AnyTimes() + mocks.stakingKeeper.EXPECT().GetValidator(ctx, gomock.Any()).DoAndReturn( + func(ctx context.Context, addr sdk.ValAddress) (stakingtypes.ValidatorI, bool) { + for i := 0; i < len(valAddrs); i++ { + if valAddrs[i].String() == addr.String() { + return s.validators[i], true + } + } + return nil, false + }).AnyTimes() + mocks.stakingKeeper.EXPECT().GetDelegation(ctx, gomock.Any(), gomock.Any()).DoAndReturn( + func(_ context.Context, del sdk.AccAddress, val sdk.ValAddress) (stakingtypes.Delegation, bool) { + for _, d := range s.delegations { + if d.DelegatorAddress == del.String() && d.ValidatorAddress == val.String() { + return d, true + } + } + return stakingtypes.Delegation{}, false + }).AnyTimes() + + // Create active governors + for i := 0; i < len(govAddrs)-1; i++ { + governor, err := v1.NewGovernor(govAddrs[i].String(), v1.GovernorDescription{}, time.Now()) + require.NoError(t, err) + govKeeper.SetGovernor(ctx, governor) + s.activeGovernors = append(s.activeGovernors, governor) + } + // Create one inactive governor + inactiveGovAddr := govAddrs[len(govAddrs)-1] + governor, err := v1.NewGovernor(inactiveGovAddr.String(), v1.GovernorDescription{}, time.Now()) + require.NoError(t, err) + governor.Status = v1.Inactive + govKeeper.SetGovernor(ctx, governor) + s.inactiveGovernor = governor + return s +} + +// delegate updates the tallyFixture delegations and validators fields. +// WARNING: delegate must be called *after* any calls to govKeeper.DelegateToGovernor +// because the hooks are not invoked in this test setup. +func (s *fixture) delegate(delegator sdk.AccAddress, validator sdk.ValAddress, m int64) { + // Increment total bonded according to each delegations + s.totalBonded += m + delegation := stakingtypes.Delegation{ + DelegatorAddress: delegator.String(), + ValidatorAddress: validator.String(), + } + // Increase validator shares and tokens, compute delegation.Shares + for i := 0; i < len(s.validators); i++ { + if s.validators[i].OperatorAddress == validator.String() { + s.validators[i], delegation.Shares = s.validators[i].AddTokensFromDel(math.NewInt(m)) + break + } + } + s.delegations = append(s.delegations, delegation) +} + +// vote calls govKeeper.Vote() +func (s *fixture) vote(voter sdk.AccAddress, vote v1.VoteOption) { + err := s.keeper.AddVote(s.ctx, s.proposal.Id, voter, v1.NewNonSplitVoteOption(vote), "") + require.NoError(s.t, err) +} + +func (s *fixture) validatorVote(voter sdk.ValAddress, vote v1.VoteOption) { + s.vote(sdk.AccAddress(voter), vote) +} + +func (s *fixture) governorVote(voter types.GovernorAddress, vote v1.VoteOption) { + s.vote(sdk.AccAddress(voter), vote) +} diff --git a/x/gov/keeper/governor.go b/x/gov/keeper/governor.go new file mode 100644 index 00000000..b06f81f2 --- /dev/null +++ b/x/gov/keeper/governor.go @@ -0,0 +1,131 @@ +package keeper + +import ( + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/atomone-hub/atomone/x/gov/types" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" +) + +// GetGovernor returns the governor with the provided address +func (k Keeper) GetGovernor(ctx sdk.Context, addr types.GovernorAddress) (v1.Governor, bool) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.GovernorKey(addr)) + if bz == nil { + return v1.Governor{}, false + } + + return v1.MustUnmarshalGovernor(k.cdc, bz), true +} + +// SetGovernor sets the governor in the store +func (k Keeper) SetGovernor(ctx sdk.Context, governor v1.Governor) { + store := ctx.KVStore(k.storeKey) + bz := v1.MustMarshalGovernor(k.cdc, &governor) + store.Set(types.GovernorKey(governor.GetAddress()), bz) +} + +// RemoveGovernor removes the governor from the store +func (k Keeper) RemoveGovernor(ctx sdk.Context, addr types.GovernorAddress) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.GovernorKey(addr)) +} + +// GetAllGovernors returns all governors +func (k Keeper) GetAllGovernors(ctx sdk.Context) (governors []*v1.Governor) { + store := ctx.KVStore(k.storeKey) + + iterator := storetypes.KVStorePrefixIterator(store, types.GovernorKeyPrefix) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + governor := v1.MustUnmarshalGovernor(k.cdc, iterator.Value()) + governors = append(governors, &governor) + } + + return governors +} + +// GetAllActiveGovernors returns all active governors +func (k Keeper) GetAllActiveGovernors(ctx sdk.Context) (governors []*v1.Governor) { + store := ctx.KVStore(k.storeKey) + + iterator := storetypes.KVStorePrefixIterator(store, types.GovernorKeyPrefix) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + governor := v1.MustUnmarshalGovernor(k.cdc, iterator.Value()) + if governor.IsActive() { + governors = append(governors, &governor) + } + } + + return governors +} + +// IterateGovernors iterates over all governors and performs a callback function +func (k Keeper) IterateGovernors(ctx sdk.Context, cb func(index int64, governor v1.GovernorI) (stop bool)) { + store := ctx.KVStore(k.storeKey) + + iterator := storetypes.KVStorePrefixIterator(store, types.GovernorKeyPrefix) + defer iterator.Close() + + for i := int64(0); iterator.Valid(); iterator.Next() { + governor := v1.MustUnmarshalGovernor(k.cdc, iterator.Value()) + if cb(i, governor) { + break + } + i++ + } +} + +func (k Keeper) getGovernorBondedTokens(ctx sdk.Context, govAddr types.GovernorAddress) (bondedTokens math.Int, err error) { + bondedTokens = math.ZeroInt() + addr := sdk.AccAddress(govAddr) + err = k.sk.IterateDelegations(ctx, addr, func(_ int64, delegation stakingtypes.DelegationI) (stop bool) { + validatorAddr, err := sdk.ValAddressFromBech32(delegation.GetValidatorAddr()) + if err != nil { + panic(err) // This should never happen + } + validator, _ := k.sk.GetValidator(ctx, validatorAddr) + shares := delegation.GetShares() + bt := shares.MulInt(validator.GetBondedTokens()).Quo(validator.GetDelegatorShares()).TruncateInt() + bondedTokens = bondedTokens.Add(bt) + + return false + }) + if err != nil { + return math.ZeroInt(), errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "failed to iterate delegations: %v", err) + } + + return bondedTokens, nil +} + +func (k Keeper) ValidateGovernorMinSelfDelegation(ctx sdk.Context, governor v1.Governor) bool { + // ensure that the governor is active and that has a valid governance self-delegation + if !governor.IsActive() { + return false + } + minGovernorSelfDelegation, _ := math.NewIntFromString(k.GetParams(ctx).MinGovernorSelfDelegation) + bondedTokens, err := k.getGovernorBondedTokens(ctx, governor.GetAddress()) + if err != nil { + return false + } + delAddr := sdk.AccAddress(governor.GetAddress()) + + if del, found := k.GetGovernanceDelegation(ctx, delAddr); !found || governor.GovernorAddress != del.GovernorAddress { + panic("active governor without governance self-delegation") + } + + if bondedTokens.LT(minGovernorSelfDelegation) { + return false + } + + return true +} diff --git a/x/gov/keeper/governor_test.go b/x/gov/keeper/governor_test.go new file mode 100644 index 00000000..96125bd2 --- /dev/null +++ b/x/gov/keeper/governor_test.go @@ -0,0 +1,177 @@ +package keeper_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" +) + +func TestGovernor(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + govKeeper, _, _, ctx := setupGovKeeper(t) + addrs := simtestutil.CreateRandomAccounts(3) + govAddrs := convertAddrsToGovAddrs(addrs) + + // Add 2 governors + gov1Desc := v1.NewGovernorDescription("moniker1", "id1", "website1", "sec1", "detail1") + gov1, err := v1.NewGovernor(govAddrs[0].String(), gov1Desc, time.Now().UTC()) + require.NoError(err) + gov2Desc := v1.NewGovernorDescription("moniker2", "id2", "website2", "sec2", "detail2") + gov2, err := v1.NewGovernor(govAddrs[1].String(), gov2Desc, time.Now().UTC()) + gov2.Status = v1.Inactive + require.NoError(err) + govKeeper.SetGovernor(ctx, gov1) + govKeeper.SetGovernor(ctx, gov2) + + // Get gov1 + gov, found := govKeeper.GetGovernor(ctx, govAddrs[0]) + if assert.True(found, "cant find gov1") { + assert.Equal(gov1, gov) + } + + // Get gov2 + gov, found = govKeeper.GetGovernor(ctx, govAddrs[1]) + if assert.True(found, "cant find gov2") { + assert.Equal(gov2, gov) + } + + // Get all govs + govs := govKeeper.GetAllGovernors(ctx) + if assert.Len(govs, 2, "expected 2 governors") { + // Insert order is not preserved, order is related to the address which is + // generated randomly, so the order of govs is random. + for i := 0; i < 2; i++ { + switch govs[i].GetAddress().String() { + case gov1.GetAddress().String(): + assert.Equal(gov1, *govs[i]) + case gov2.GetAddress().String(): + assert.Equal(gov2, *govs[i]) + } + } + } + + // Get all active govs + govs = govKeeper.GetAllActiveGovernors(ctx) + if assert.Len(govs, 1, "expected 1 active governor") { + assert.Equal(gov1, *govs[0]) + } + + // IterateGovernors + govs = nil + govKeeper.IterateGovernors(ctx, func(i int64, govI v1.GovernorI) bool { + gov := govI.(v1.Governor) + govs = append(govs, &gov) + return false + }) + if assert.Len(govs, 2, "expected 2 governors") { + for i := 0; i < 2; i++ { + switch govs[i].GetAddress().String() { + case gov1.GetAddress().String(): + assert.Equal(gov1, *govs[i]) + case gov2.GetAddress().String(): + assert.Equal(gov2, *govs[i]) + } + } + } + + // Remove gov2 + govKeeper.RemoveGovernor(ctx, govAddrs[1]) + gov, found = govKeeper.GetGovernor(ctx, govAddrs[1]) + assert.False(found, "expected gov2 to be removed") + + // Get all govs after removal + govs = govKeeper.GetAllGovernors(ctx) + if assert.Len(govs, 1, "expected 1 governor after removal") { + assert.Equal(gov1, *govs[0]) + } +} + +func TestValidateGovernorMinSelfDelegation(t *testing.T) { + tests := []struct { + name string + setup func(*fixture) v1.Governor + selfDelegation bool + valDelegations []stakingtypes.Delegation + expectedPanic bool + expectedValid bool + }{ + { + name: "inactive governor", + setup: func(s *fixture) v1.Governor { + return s.inactiveGovernor + }, + expectedPanic: false, + expectedValid: false, + }, + { + name: "active governor w/o self delegation w/o validator delegation", + setup: func(s *fixture) v1.Governor { + return s.activeGovernors[0] + }, + expectedPanic: true, + expectedValid: false, + }, + { + name: "active governor w self delegation w/o validator delegation", + setup: func(s *fixture) v1.Governor { + govAddr := s.activeGovernors[0].GetAddress() + delAddr := sdk.AccAddress(govAddr) + err := s.keeper.DelegateToGovernor(s.ctx, delAddr, govAddr) + require.NoError(s.t, err) + return s.activeGovernors[0] + }, + expectedPanic: false, + expectedValid: false, + }, + { + name: "active governor w self delegation w not enough validator delegation", + setup: func(s *fixture) v1.Governor { + govAddr := s.activeGovernors[0].GetAddress() + delAddr := sdk.AccAddress(govAddr) + err := s.keeper.DelegateToGovernor(s.ctx, delAddr, govAddr) + require.NoError(s.t, err) + s.delegate(delAddr, s.valAddrs[0], 1) + return s.activeGovernors[0] + }, + expectedPanic: false, + expectedValid: false, + }, + { + name: "active governor w self delegation w enough validator delegation", + setup: func(s *fixture) v1.Governor { + govAddr := s.activeGovernors[0].GetAddress() + delAddr := sdk.AccAddress(govAddr) + err := s.keeper.DelegateToGovernor(s.ctx, delAddr, govAddr) + require.NoError(s.t, err) + s.delegate(delAddr, s.valAddrs[0], v1.DefaultMinGovernorSelfDelegation.Int64()) + return s.activeGovernors[0] + }, + expectedPanic: false, + expectedValid: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + govKeeper, mocks, _, ctx := setupGovKeeper(t, mockAccountKeeperExpectations) + s := newFixture(t, ctx, 2, 2, 2, govKeeper, mocks) + governor := tt.setup(s) + + if tt.expectedPanic { + assert.Panics(t, func() { govKeeper.ValidateGovernorMinSelfDelegation(ctx, governor) }) + } else { + valid := govKeeper.ValidateGovernorMinSelfDelegation(ctx, governor) + + assert.Equal(t, tt.expectedValid, valid, "return of ValidateGovernorMinSelfDelegation") + } + }) + } +} diff --git a/x/gov/keeper/grpc_query.go b/x/gov/keeper/grpc_query.go index 00727a76..39e49702 100644 --- a/x/gov/keeper/grpc_query.go +++ b/x/gov/keeper/grpc_query.go @@ -341,6 +341,155 @@ func (q Keeper) ParticipationEMAs(c context.Context, _ *v1.QueryParticipationEMA }, nil } +// Governor queries governor information based on governor address. +func (q Keeper) Governor(c context.Context, req *v1.QueryGovernorRequest) (*v1.QueryGovernorResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.GovernorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "empty governor address") + } + + governorAddr, err := types.GovernorAddressFromBech32(req.GovernorAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + governor, found := q.GetGovernor(ctx, governorAddr) + if !found { + return nil, status.Errorf(codes.NotFound, "governor %s doesn't exist", req.GovernorAddress) + } + + return &v1.QueryGovernorResponse{Governor: &governor}, nil +} + +// Governors queries all governors. +func (q Keeper) Governors(c context.Context, req *v1.QueryGovernorsRequest) (*v1.QueryGovernorsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(q.storeKey) + governorStore := prefix.NewStore(store, types.GovernorKeyPrefix) + + var governors []*v1.Governor + pageRes, err := query.Paginate(governorStore, req.Pagination, func(key []byte, value []byte) error { + var governor v1.Governor + if err := q.cdc.Unmarshal(value, &governor); err != nil { + return err + } + + governors = append(governors, &governor) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &v1.QueryGovernorsResponse{Governors: governors, Pagination: pageRes}, nil +} + +// GovernanceDelegations queries all delegations of a governor. +func (q Keeper) GovernanceDelegations(c context.Context, req *v1.QueryGovernanceDelegationsRequest) (*v1.QueryGovernanceDelegationsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.GovernorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "empty governor address") + } + + governorAddr, err := types.GovernorAddressFromBech32(req.GovernorAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(q.storeKey) + delegationStore := prefix.NewStore(store, types.GovernanceDelegationsByGovernorKey(governorAddr, []byte{})) + + var delegations []*v1.GovernanceDelegation + pageRes, err := query.Paginate(delegationStore, req.Pagination, func(key []byte, value []byte) error { + var delegation v1.GovernanceDelegation + if err := q.cdc.Unmarshal(value, &delegation); err != nil { + return err + } + + delegations = append(delegations, &delegation) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &v1.QueryGovernanceDelegationsResponse{Delegations: delegations, Pagination: pageRes}, nil +} + +// GovernanceDelegation queries a delegation +func (q Keeper) GovernanceDelegation(c context.Context, req *v1.QueryGovernanceDelegationRequest) (*v1.QueryGovernanceDelegationResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "empty delegator address") + } + + delegatorAddr, err := sdk.AccAddressFromBech32(req.DelegatorAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + delegation, found := q.GetGovernanceDelegation(ctx, delegatorAddr) + if !found { + return nil, status.Errorf(codes.NotFound, "governance delegation for %s does not exist", req.DelegatorAddress) + } + + return &v1.QueryGovernanceDelegationResponse{GovernorAddress: delegation.GovernorAddress}, nil +} + +// GovernorValShares queries all validator shares of a governor. +func (q Keeper) GovernorValShares(c context.Context, req *v1.QueryGovernorValSharesRequest) (*v1.QueryGovernorValSharesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.GovernorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "empty governor address") + } + + governorAddr, err := types.GovernorAddressFromBech32(req.GovernorAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(q.storeKey) + valShareStore := prefix.NewStore(store, types.ValidatorSharesByGovernorKey(governorAddr, []byte{})) + + var valShares []*v1.GovernorValShares + pageRes, err := query.Paginate(valShareStore, req.Pagination, func(key []byte, value []byte) error { + var valShare v1.GovernorValShares + if err := q.cdc.Unmarshal(value, &valShare); err != nil { + return err + } + + valShares = append(valShares, &valShare) + + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &v1.QueryGovernorValSharesResponse{ValShares: valShares, Pagination: pageRes}, nil +} + var _ v1beta1.QueryServer = legacyQueryServer{} type legacyQueryServer struct { diff --git a/x/gov/keeper/hooks.go b/x/gov/keeper/hooks.go new file mode 100644 index 00000000..303229d9 --- /dev/null +++ b/x/gov/keeper/hooks.go @@ -0,0 +1,150 @@ +package keeper + +import ( + context "context" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/atomone-hub/atomone/x/gov/types" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" +) + +// Hooks wrapper struct for gov keeper +type Hooks struct { + k Keeper +} + +var _ stakingtypes.StakingHooks = Hooks{} + +// Return the staking hooks +func (k Keeper) StakingHooks() Hooks { + return Hooks{k} +} + +// BeforeDelegationSharesModified is called when a delegation's shares are modified +// We trigger a governor shares decrease here subtracting all delegation shares. +// The right amount of shares will be possibly added back in AfterDelegationModified +func (h Hooks) BeforeDelegationSharesModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + // does the delegator have a governance delegation? + govDelegation, found := h.k.GetGovernanceDelegation(sdkCtx, delAddr) + if !found { + return nil + } + govAddr := types.MustGovernorAddressFromBech32(govDelegation.GovernorAddress) + + // Fetch the delegation + delegation, _ := h.k.sk.GetDelegation(sdkCtx, delAddr, valAddr) + + // update the Governor's Validator shares + h.k.DecreaseGovernorShares(sdkCtx, govAddr, valAddr, delegation.Shares) + + return nil +} + +// AfterDelegationModified is called when a delegation is created or modified +// We trigger a governor shares increase here adding all delegation shares. +// It is balanced by the full-amount decrease in BeforeDelegationSharesModified +func (h Hooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + // does the delegator have a governance delegation? + govDelegation, found := h.k.GetGovernanceDelegation(sdkCtx, delAddr) + if !found { + return nil + } + + // Fetch the delegation + delegation, err := h.k.sk.GetDelegation(sdkCtx, delAddr, valAddr) + if err != nil { + return err + } + + govAddr := types.MustGovernorAddressFromBech32(govDelegation.GovernorAddress) + + // Calculate the new shares and update the Governor's shares + shares := delegation.Shares + + h.k.IncreaseGovernorShares(sdkCtx, govAddr, valAddr, shares) + + // if the delegator is also an active governor, ensure min self-delegation requirement is met, + // otherwise set governor to inactive + delGovAddr := types.GovernorAddress(delAddr.Bytes()) + if governor, found := h.k.GetGovernor(sdkCtx, delGovAddr); found && governor.IsActive() { + if governor.GetAddress().String() != govDelegation.GovernorAddress { + panic("active governor delegating to another governor") + } + // if the governor no longer meets the min self-delegation, set to inactive + if !h.k.ValidateGovernorMinSelfDelegation(sdkCtx, governor) { + governor.Status = v1.Inactive + now := sdkCtx.BlockTime() + governor.LastStatusChangeTime = &now + h.k.SetGovernor(sdkCtx, governor) + } + } + + return nil +} + +// BeforeDelegationRemoved is called when a delegation is removed +// We verify if the delegator is also an active governor and if so check +// that the min self-delegation requirement is still met, otherwise set governor +// status to inactive +func (h Hooks) BeforeDelegationRemoved(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + // if the delegator is also an active governor, ensure min self-delegation requirement is met, + // otherwise set governor to inactive + delGovAddr := types.GovernorAddress(delAddr.Bytes()) + if governor, found := h.k.GetGovernor(sdkCtx, delGovAddr); found && governor.IsActive() { + govDelegation, found := h.k.GetGovernanceDelegation(sdkCtx, delAddr) + if !found { + panic("active governor without governance self-delegation") + } + if governor.GetAddress().String() != govDelegation.GovernorAddress { + panic("active governor delegating to another governor") + } + // if the governor no longer meets the min self-delegation, set to inactive + if !h.k.ValidateGovernorMinSelfDelegation(sdkCtx, governor) { + governor.Status = v1.Inactive + now := sdkCtx.BlockTime() + governor.LastStatusChangeTime = &now + h.k.SetGovernor(sdkCtx, governor) + } + } + + return nil +} + +func (h Hooks) BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction math.LegacyDec) error { + return nil +} + +func (h Hooks) AfterValidatorCreated(ctx context.Context, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) BeforeValidatorModified(ctx context.Context, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) AfterValidatorRemoved(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) AfterValidatorBeginUnbonding(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) BeforeDelegationCreated(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) AfterUnbondingInitiated(ctx context.Context, unbondingID uint64) error { + return nil +} diff --git a/x/gov/keeper/invariants.go b/x/gov/keeper/invariants.go index fcb1b4f8..1f91cd41 100644 --- a/x/gov/keeper/invariants.go +++ b/x/gov/keeper/invariants.go @@ -5,7 +5,10 @@ package keeper import ( "fmt" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/atomone-hub/atomone/x/gov/types" v1 "github.com/atomone-hub/atomone/x/gov/types/v1" @@ -14,6 +17,7 @@ import ( // RegisterInvariants registers all governance invariants func RegisterInvariants(ir sdk.InvariantRegistry, keeper *Keeper, bk types.BankKeeper) { ir.RegisterRoute(types.ModuleName, "module-account", ModuleAccountInvariant(keeper, bk)) + ir.RegisterRoute(types.ModuleName, "governors-delegations", GovernorsDelegationsInvariant(keeper, keeper.sk)) } // AllInvariants runs all invariants of the governance module @@ -47,3 +51,80 @@ func ModuleAccountInvariant(keeper *Keeper, bk types.BankKeeper) sdk.Invariant { balances, expectedDeposits)), broken } } + +// GovernorsDelegationsInvariant checks that the validator shares resulting from all +// governor delegations actually correspond to the stored governor validator shares +func GovernorsDelegationsInvariant(keeper *Keeper, sk types.StakingKeeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + var ( + broken = false + invariantStr string + ) + + keeper.IterateGovernors(ctx, func(index int64, governor v1.GovernorI) bool { + // check that if governor is active, it has a valid governance self-delegation + if governor.IsActive() { + if del, ok := keeper.GetGovernanceDelegation(ctx, sdk.AccAddress(governor.GetAddress())); !ok || !governor.GetAddress().Equals(types.MustGovernorAddressFromBech32(del.GovernorAddress)) { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s delegations", governor.GetAddress().String()), + "active governor without governance self-delegation") + broken = true + return true + } + } + + valShares := make(map[string]math.LegacyDec) + valSharesKeys := make([]string, 0) + keeper.IterateGovernorDelegations(ctx, governor.GetAddress(), func(index int64, delegation v1.GovernanceDelegation) bool { + delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + err := keeper.sk.IterateDelegations(ctx, delAddr, func(_ int64, delegation stakingtypes.DelegationI) (stop bool) { + validatorAddr := delegation.GetValidatorAddr() + shares := delegation.GetShares() + if _, ok := valShares[validatorAddr]; !ok { + valShares[validatorAddr] = math.LegacyZeroDec() + valSharesKeys = append(valSharesKeys, validatorAddr) + } + valShares[validatorAddr] = valShares[validatorAddr].Add(shares) + return false + }) + if err != nil { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s delegations", governor.GetAddress().String()), + fmt.Sprintf("failed to iterate delegations: %v", err)) + broken = true + return true + } + return false + }) + + for _, valAddrStr := range valSharesKeys { + shares := valShares[valAddrStr] + validatorAddr, _ := sdk.ValAddressFromBech32(valAddrStr) + vs, ok := keeper.GetGovernorValShares(ctx, governor.GetAddress(), validatorAddr) + if !ok { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s delegations", governor.GetAddress().String()), + fmt.Sprintf("validator %s shares not found", valAddrStr)) + broken = true + return true + } + if !vs.Shares.Equal(shares) { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s delegations", governor.GetAddress().String()), + fmt.Sprintf("stored shares %s for validator %s do not match actual shares %s", vs.Shares, valAddrStr, shares)) + broken = true + return true + } + } + + keeper.IterateGovernorValShares(ctx, governor.GetAddress(), func(index int64, shares v1.GovernorValShares) bool { + if _, ok := valShares[shares.ValidatorAddress]; !ok && shares.Shares.GT(math.LegacyZeroDec()) { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s delegations", governor.GetAddress().String()), + fmt.Sprintf("non-zero (%s) shares stored for validator %s where there should be none", shares.Shares, shares.ValidatorAddress)) + broken = true + return true + } + return false + }) + + return broken + }) + return invariantStr, broken + } +} diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 32f1833d..09b2e89d 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -5,9 +5,10 @@ import ( "fmt" "cosmossdk.io/errors" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors1 "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/atomone-hub/atomone/x/gov/types" v1 "github.com/atomone-hub/atomone/x/gov/types/v1" @@ -171,7 +172,7 @@ func (k msgServer) Deposit(goCtx context.Context, msg *v1.MsgDeposit) (*v1.MsgDe // validateDeposit validates the deposit amount, do not use for initial deposit. func validateDeposit(amount sdk.Coins) error { if !amount.IsValid() || !amount.IsAllPositive() { - return sdkerrors1.ErrInvalidCoins.Wrap(amount.String()) + return sdkerrors.ErrInvalidCoins.Wrap(amount.String()) } return nil @@ -201,7 +202,7 @@ func (k msgServer) UpdateParams(goCtx context.Context, msg *v1.MsgUpdateParams) // ProposeLaw implements the MsgServer.ProposeLaw method. func (k msgServer) ProposeLaw(goCtx context.Context, msg *v1.MsgProposeLaw) (*v1.MsgProposeLawResponse, error) { if k.authority != msg.Authority { - return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.authority, msg.Authority) } // only a no-op for now return &v1.MsgProposeLawResponse{}, nil @@ -210,7 +211,7 @@ func (k msgServer) ProposeLaw(goCtx context.Context, msg *v1.MsgProposeLaw) (*v1 // ProposeConstitutionAmendment implements the MsgServer.ProposeConstitutionAmendment method. func (k msgServer) ProposeConstitutionAmendment(goCtx context.Context, msg *v1.MsgProposeConstitutionAmendment) (*v1.MsgProposeConstitutionAmendmentResponse, error) { if k.authority != msg.Authority { - return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.authority, msg.Authority) } if msg.Amendment == "" { return nil, govtypes.ErrInvalidProposalMsg.Wrap("amendment cannot be empty") @@ -224,6 +225,255 @@ func (k msgServer) ProposeConstitutionAmendment(goCtx context.Context, msg *v1.M return &v1.MsgProposeConstitutionAmendmentResponse{}, nil } +func (k msgServer) CreateGovernor(goCtx context.Context, msg *v1.MsgCreateGovernor) (*v1.MsgCreateGovernorResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // Ensure the governor does not already exist + addr := sdk.MustAccAddressFromBech32(msg.Address) + govAddr := govtypes.GovernorAddress(addr.Bytes()) + if _, found := k.GetGovernor(ctx, govAddr); found { + return nil, govtypes.ErrGovernorExists + } + + // Ensure the governor has a valid description + if _, err := msg.Description.EnsureLength(); err != nil { + return nil, err + } + + // Create the governor + governor, err := v1.NewGovernor(govAddr.String(), msg.Description, ctx.BlockTime()) + if err != nil { + return nil, err + } + + // validate min self-delegation + minSelfDelegation, _ := math.NewIntFromString(k.GetParams(ctx).MinGovernorSelfDelegation) + bondedTokens, err := k.getGovernorBondedTokens(ctx, govAddr) + if err != nil { + return nil, err + } + if bondedTokens.LT(minSelfDelegation) { + return nil, govtypes.ErrInsufficientGovernorDelegation.Wrapf("minimum self-delegation required: %s, total bonded tokens: %s", minSelfDelegation, bondedTokens) + } + + k.SetGovernor(ctx, governor) + + // a base account automatically creates a governance delegation to itself + err = k.DelegateToGovernor(ctx, addr, govAddr) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + govtypes.EventTypeCreateGovernor, + sdk.NewAttribute(govtypes.AttributeKeyGovernor, govAddr.String()), + ), + }) + + return &v1.MsgCreateGovernorResponse{}, nil +} + +func (k msgServer) EditGovernor(goCtx context.Context, msg *v1.MsgEditGovernor) (*v1.MsgEditGovernorResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // Ensure the governor exists + addr := sdk.MustAccAddressFromBech32(msg.Address) + govAddr := govtypes.GovernorAddress(addr.Bytes()) + governor, found := k.GetGovernor(ctx, govAddr) + if !found { + return nil, govtypes.ErrGovernorNotFound + } + + // Ensure the governor has a valid description + if _, err := msg.Description.EnsureLength(); err != nil { + return nil, err + } + + // Update the governor + governor.Description = msg.Description + k.SetGovernor(ctx, governor) + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + govtypes.EventTypeEditGovernor, + sdk.NewAttribute(govtypes.AttributeKeyGovernor, govAddr.String()), + ), + }) + + return &v1.MsgEditGovernorResponse{}, nil +} + +func (k msgServer) UpdateGovernorStatus(goCtx context.Context, msg *v1.MsgUpdateGovernorStatus) (*v1.MsgUpdateGovernorStatusResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // Ensure the governor exists + addr := sdk.MustAccAddressFromBech32(msg.Address) + govAddr := govtypes.GovernorAddress(addr.Bytes()) + governor, found := k.GetGovernor(ctx, govAddr) + if !found { + return nil, govtypes.ErrGovernorNotFound + } + + if !msg.Status.IsValid() { + return nil, govtypes.ErrInvalidGovernorStatus + } + + // Ensure the governor is not already in the desired status + if governor.Status == msg.Status { + return nil, govtypes.ErrGovernorStatusEqual + } + + // Ensure the governor has been in the current status for the required period + governorStatusChangePeriod := *k.GetParams(ctx).GovernorStatusChangePeriod + changeTime := ctx.BlockTime() + if governor.LastStatusChangeTime.Add(governorStatusChangePeriod).After(changeTime) { + return nil, govtypes.ErrGovernorStatusChangePeriod.Wrapf("last status change time: %s, need to wait until: %s", governor.LastStatusChangeTime, governor.LastStatusChangeTime.Add(governorStatusChangePeriod)) + } + + // Update the governor status + governor.Status = msg.Status + governor.LastStatusChangeTime = &changeTime + // prevent a change to active if min self-delegation is not met + if governor.IsActive() { + if !k.ValidateGovernorMinSelfDelegation(ctx, governor) { + return nil, govtypes.ErrInsufficientGovernorDelegation.Wrap("cannot set status to active: minimum self-delegation not met") + } + } + + k.SetGovernor(ctx, governor) + status := govtypes.AttributeValueStatusInactive + // if status changes to active, create governance self-delegation + // in case it didn't exist + if governor.IsActive() { + delegation, found := k.GetGovernanceDelegation(ctx, addr) + if !found { + err := k.DelegateToGovernor(ctx, addr, govAddr) + if err != nil { + return nil, err + } + } + if delegation.GovernorAddress != govAddr.String() { + err := k.RedelegateToGovernor(ctx, addr, govAddr) + if err != nil { + return nil, err + } + } + status = govtypes.AttributeValueStatusActive + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + govtypes.EventTypeGovernorChangeStatus, + sdk.NewAttribute(govtypes.AttributeKeyGovernor, govAddr.String()), + sdk.NewAttribute(govtypes.AttributeKeyStatus, status), + ), + }) + + return &v1.MsgUpdateGovernorStatusResponse{}, nil +} + +func (k msgServer) DelegateGovernor(goCtx context.Context, msg *v1.MsgDelegateGovernor) (*v1.MsgDelegateGovernorResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + delAddr := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) + govAddr := govtypes.MustGovernorAddressFromBech32(msg.GovernorAddress) + + // Ensure the delegator is not already an active governor, as they cannot delegate + if g, found := k.GetGovernor(ctx, govtypes.GovernorAddress(delAddr.Bytes())); found && g.IsActive() { + return nil, govtypes.ErrDelegatorIsGovernor + } + + // Ensure the delegation is not already present + gd, found := k.GetGovernanceDelegation(ctx, delAddr) + if found && govAddr.Equals(govtypes.MustGovernorAddressFromBech32(gd.GovernorAddress)) { + return nil, govtypes.ErrGovernanceDelegationExists + } + // redelegate if a delegation to another governor already exists + if found { + err := k.RedelegateToGovernor(ctx, delAddr, govAddr) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + govtypes.EventTypeRedelegate, + sdk.NewAttribute(govtypes.AttributeKeySrcGovernor, gd.GovernorAddress), + sdk.NewAttribute(govtypes.AttributeKeyDstGovernor, msg.GovernorAddress), + sdk.NewAttribute(govtypes.AttributeKeyDelegator, msg.DelegatorAddress), + ), + }) + } else { + // Create the delegation + err := k.DelegateToGovernor(ctx, delAddr, govAddr) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + govtypes.EventTypeDelegate, + sdk.NewAttribute(govtypes.AttributeKeyDstGovernor, msg.GovernorAddress), + sdk.NewAttribute(govtypes.AttributeKeyDelegator, msg.DelegatorAddress), + ), + }) + } + + return &v1.MsgDelegateGovernorResponse{}, nil +} + +func (k msgServer) UndelegateGovernor(goCtx context.Context, msg *v1.MsgUndelegateGovernor) (*v1.MsgUndelegateGovernorResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + delAddr := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) + + // Ensure the delegation exists + delegation, found := k.GetGovernanceDelegation(ctx, delAddr) + if !found { + return nil, govtypes.ErrGovernanceDelegationNotFound + } + + // if the delegator is also a governor, check if governor is active + // if so, undelegation is not allowed. A status change to inactive is required first. + delGovAddr := govtypes.GovernorAddress(delAddr.Bytes()) + delGovernor, found := k.GetGovernor(ctx, delGovAddr) + if found && delGovernor.IsActive() { + // if the delegation is not to self the state is inconsistent + if delegation.GovernorAddress != delGovAddr.String() { + panic("inconsistent state: active governor has a governance delegation to another governor") + } + return nil, govtypes.ErrDelegatorIsGovernor + } + + // Remove the delegation + err := k.UndelegateFromGovernor(ctx, delAddr) + if err != nil { + return nil, err + } + + // if governor is inactive and does not have any delegations left, remove governor + governor, found := k.GetGovernor(ctx, govtypes.MustGovernorAddressFromBech32(delegation.GovernorAddress)) + if !found { + panic("inconsistent state: governance delegation to non-existing governor") + } + if !governor.IsActive() { + delegations := k.GetAllGovernanceDelegationsByGovernor(ctx, governor.GetAddress()) + if len(delegations) == 0 { + k.RemoveGovernor(ctx, governor.GetAddress()) + } + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + govtypes.EventTypeUndelegate, + sdk.NewAttribute(govtypes.AttributeKeySrcGovernor, delegation.GovernorAddress), + sdk.NewAttribute(govtypes.AttributeKeyDelegator, msg.DelegatorAddress), + ), + }) + return &v1.MsgUndelegateGovernorResponse{}, nil +} + type legacyMsgServer struct { govAcct string server v1.MsgServer diff --git a/x/gov/keeper/tally.go b/x/gov/keeper/tally.go index 4c4a07ab..0eb2dc23 100644 --- a/x/gov/keeper/tally.go +++ b/x/gov/keeper/tally.go @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/atomone-hub/atomone/x/gov/types" v1 "github.com/atomone-hub/atomone/x/gov/types/v1" ) @@ -83,33 +84,10 @@ func (keeper Keeper) HasReachedQuorum(ctx sdk.Context, proposal v1.Proposal) (bo return false, nil } - /* DISABLED on AtomOne - no possible increase of computation speed by - iterating over validators since vote inheritance is disabled. - Keeping as comment because this should be adapted with governors loop - - // we check first if voting power of validators alone is enough to pass quorum - // and if so, we return true skipping the iteration over all votes - // can speed up computation in case quorum is already reached by validator votes alone - approxTotalVotingPower := math.LegacyZeroDec() - for _, val := range currValidators { - _, ok := keeper.GetVote(ctx, proposal.Id, sdk.AccAddress(val.GetOperator())) - if ok { - approxTotalVotingPower = approxTotalVotingPower.Add(math.LegacyNewDecFromInt(val.GetBondedTokens())) - } - } - // check and return whether or not the proposal has reached quorum - approxPercentVoting := approxTotalVotingPower.Quo(math.LegacyNewDecFromInt(totalBonded)) - if approxPercentVoting.GTE(quorum) { - return true, nil - } - */ - - // voting power of validators does not reach quorum, let's tally all votes currValidators, err := keeper.getBondedValidatorsByAddress(ctx) if err != nil { return false, err } - totalVotingPower, _, err := keeper.tallyVotes(ctx, proposal, currValidators, false) if err != nil { return false, err @@ -141,6 +119,9 @@ func (keeper Keeper) tallyVotes( currValidators map[string]stakingtypes.ValidatorI, isFinal bool, ) (totalVotingPower math.LegacyDec, results map[v1.VoteOption]math.LegacyDec, err error) { totalVotingPower = math.LegacyZeroDec() + // keeps track of governors that voted or have delegators that voted + allGovernors := make(map[string]v1.GovernorGovInfo) + if isFinal { results = make(map[v1.VoteOption]math.LegacyDec) results[v1.OptionYes] = math.LegacyZeroDec() @@ -149,23 +130,51 @@ func (keeper Keeper) tallyVotes( } keeper.IterateVotes(ctx, proposal.Id, func(vote v1.Vote) bool { + var governor v1.GovernorGovInfo + voter := sdk.MustAccAddressFromBech32(vote.Voter) + + gd, hasGovernor := keeper.GetGovernanceDelegation(ctx, voter) + if hasGovernor { + if gi, ok := allGovernors[gd.GovernorAddress]; ok { + governor = gi + } else { + govAddr := types.MustGovernorAddressFromBech32(gd.GovernorAddress) + governor = v1.NewGovernorGovInfo( + govAddr, + keeper.GetAllGovernorValShares(ctx, govAddr), + v1.WeightedVoteOptions{}, + ) + } + if gd.GovernorAddress == types.GovernorAddress(voter).String() { + // voter and governor are the same account, record his vote + governor.Vote = vote.Options + } + // Ensure allGovernors contains the updated governor + allGovernors[gd.GovernorAddress] = governor + } + // iterate over all delegations from voter, deduct from any delegated-to validators err = keeper.sk.IterateDelegations(ctx, voter, func(index int64, delegation stakingtypes.DelegationI) (stop bool) { valAddrStr := delegation.GetValidatorAddr() + votingPower := math.LegacyZeroDec() if val, ok := currValidators[valAddrStr]; ok { // delegation shares * bonded / total shares - votingPower := delegation.GetShares().MulInt(val.GetBondedTokens()).Quo(val.GetDelegatorShares()) - - if isFinal { - for _, option := range vote.Options { - weight, _ := math.LegacyNewDecFromStr(option.Weight) - subPower := votingPower.Mul(weight) - results[option.Option] = results[option.Option].Add(subPower) - } + votingPower = votingPower.Add(delegation.GetShares().MulInt(val.GetBondedTokens()).Quo(val.GetDelegatorShares())) + + // remove the delegation shares from the governor + if hasGovernor { + governor.ValSharesDeductions[valAddrStr] = governor.ValSharesDeductions[valAddrStr].Add(delegation.GetShares()) + } + } + + totalVotingPower = totalVotingPower.Add(votingPower) + if isFinal { + for _, option := range vote.Options { + subPower := option.Power(votingPower) + results[option.Option] = results[option.Option].Add(subPower) } - totalVotingPower = totalVotingPower.Add(votingPower) } return false @@ -183,25 +192,24 @@ func (keeper Keeper) tallyVotes( return totalVotingPower, results, err } - /* DISABLED on AtomOne - Voting can only be done with your own stake - // iterate over the validators again to tally their voting power - for _, val := range currValidators { - if len(val.Vote) == 0 { - continue - } + // get only the voting governors that are active and have the niminum self-delegation requirement met. + currGovernors := keeper.getCurrGovernors(ctx, allGovernors) - sharesAfterDeductions := val.DelegatorShares.Sub(val.DelegatorDeductions) - votingPower := sharesAfterDeductions.MulInt(val.BondedTokens).Quo(val.DelegatorShares) + // iterate over the governors again to tally their voting power + // As active governor are simply voters that need to have 100% of their bonded tokens + // delegated to them and their shares were deducted when iterating over votes + // we don't need to handle special cases. + for _, gov := range currGovernors { + votingPower := getGovernorVotingPower(gov, currValidators) - for _, option := range val.Vote { - weight, _ := math.LegacyNewDecFromStr(option.Weight) - subPower := votingPower.Mul(weight) - results[option.Option] = results[option.Option].Add(subPower) + if isFinal { + for _, option := range gov.Vote { + subPower := option.Power(votingPower) + results[option.Option] = results[option.Option].Add(subPower) + } } totalVotingPower = totalVotingPower.Add(votingPower) } - */ - return totalVotingPower, results, nil } @@ -248,3 +256,28 @@ func (keeper Keeper) getQuorumAndThreshold(ctx sdk.Context, proposal v1.Proposal return quorum, threshold } + +// getCurrGovernors returns the governors that voted, are active and meet the minimum self-delegation requirement +func (k Keeper) getCurrGovernors(ctx sdk.Context, allGovernors map[string]v1.GovernorGovInfo) (governors []v1.GovernorGovInfo) { + governorsInfos := make([]v1.GovernorGovInfo, 0) + for _, govInfo := range allGovernors { + governor, _ := k.GetGovernor(ctx, govInfo.Address) + + if k.ValidateGovernorMinSelfDelegation(ctx, governor) && len(govInfo.Vote) > 0 { + governorsInfos = append(governorsInfos, govInfo) + } + } + + return governorsInfos +} + +func getGovernorVotingPower(governor v1.GovernorGovInfo, currValidators map[string]stakingtypes.ValidatorI) (votingPower math.LegacyDec) { + votingPower = math.LegacyZeroDec() + for valAddrStr, shares := range governor.ValShares { + if val, ok := currValidators[valAddrStr]; ok { + sharesAfterDeductions := shares.Sub(governor.ValSharesDeductions[valAddrStr]) + votingPower = votingPower.Add(sharesAfterDeductions.MulInt(val.GetBondedTokens()).Quo(val.GetDelegatorShares())) + } + } + return votingPower +} diff --git a/x/gov/keeper/tally_test.go b/x/gov/keeper/tally_test.go index 30efde62..5508881c 100644 --- a/x/gov/keeper/tally_test.go +++ b/x/gov/keeper/tally_test.go @@ -1,127 +1,23 @@ package keeper_test import ( - "context" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "cosmossdk.io/math" - sdkmath "cosmossdk.io/math" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/atomone-hub/atomone/x/gov/keeper" + "github.com/atomone-hub/atomone/x/gov/types" v1 "github.com/atomone-hub/atomone/x/gov/types/v1" ) -type tallyFixture struct { - t *testing.T - - proposal v1.Proposal - valAddrs []sdk.ValAddress - delAddrs []sdk.AccAddress - totalBonded int64 - validators []stakingtypes.Validator - delegations []stakingtypes.Delegation - - keeper *keeper.Keeper - ctx sdk.Context - mocks mocks -} - -// newTallyFixture returns a configured fixture for testing the govKeeper.Tally -// method. -// - setup TotalBondedTokens call -// - initiates the validators with a self delegation of 1: -// - setup IterateBondedValidatorsByPower call -// - setup IterateDelegations call for validators -func newTallyFixture(t *testing.T, ctx sdk.Context, proposal v1.Proposal, - valAddrs []sdk.ValAddress, delAddrs []sdk.AccAddress, govKeeper *keeper.Keeper, - mocks mocks, -) *tallyFixture { - s := &tallyFixture{ - t: t, - ctx: ctx, - proposal: proposal, - valAddrs: valAddrs, - delAddrs: delAddrs, - keeper: govKeeper, - mocks: mocks, - } - mocks.stakingKeeper.EXPECT().TotalBondedTokens(gomock.Any()). - DoAndReturn(func(_ context.Context) (sdkmath.Int, error) { - return sdkmath.NewInt(s.totalBonded), nil - }).MaxTimes(1) - // Mocks a bunch of validators - for i := 0; i < len(valAddrs); i++ { - s.validators = append(s.validators, stakingtypes.Validator{ - OperatorAddress: valAddrs[i].String(), - Status: stakingtypes.Bonded, - Tokens: sdkmath.ZeroInt(), - DelegatorShares: sdkmath.LegacyZeroDec(), - }) - // validator self delegation - s.delegate(sdk.AccAddress(valAddrs[i]), valAddrs[i], 1) - } - mocks.stakingKeeper.EXPECT(). - IterateBondedValidatorsByPower(ctx, gomock.Any()). - DoAndReturn( - func(ctx context.Context, fn func(index int64, validator stakingtypes.ValidatorI) bool) error { - for i := 0; i < len(valAddrs); i++ { - fn(int64(i), s.validators[i]) - } - return nil - }) - mocks.stakingKeeper.EXPECT(). - IterateDelegations(ctx, gomock.Any(), gomock.Any()). - DoAndReturn( - func(ctx context.Context, voter sdk.AccAddress, fn func(index int64, d stakingtypes.DelegationI) bool) error { - for i, d := range s.delegations { - if d.DelegatorAddress == voter.String() { - fn(int64(i), d) - } - } - return nil - }).AnyTimes() - return s -} - -// delegate updates the tallyFixture delegations and validators fields. -func (s *tallyFixture) delegate(delegator sdk.AccAddress, validator sdk.ValAddress, m int64) { - // Increment total bonded according to each delegations - s.totalBonded += m - delegation := stakingtypes.Delegation{ - DelegatorAddress: delegator.String(), - ValidatorAddress: validator.String(), - } - for i := 0; i < len(s.validators); i++ { - if s.validators[i].OperatorAddress == validator.String() { - s.validators[i], delegation.Shares = s.validators[i].AddTokensFromDel(math.NewInt(m)) - break - } - } - s.delegations = append(s.delegations, delegation) -} - -// vote calls govKeeper.Vote() -func (s *tallyFixture) vote(voter sdk.AccAddress, vote v1.VoteOption) { - err := s.keeper.AddVote(s.ctx, s.proposal.Id, voter, v1.NewNonSplitVoteOption(vote), "") - require.NoError(s.t, err) -} - -func (s *tallyFixture) validatorVote(voter sdk.ValAddress, vote v1.VoteOption) { - s.vote(sdk.AccAddress(voter), vote) -} - func TestTally(t *testing.T) { tests := []struct { name string - setup func(*tallyFixture) + setup func(*fixture) proposalMsgs []sdk.Msg expectedPass bool expectedBurn bool @@ -142,7 +38,7 @@ func TestTally(t *testing.T) { }, { name: "one validator votes: prop fails/burn deposit", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_NO) }, proposalMsgs: TestProposal, @@ -156,7 +52,7 @@ func TestTally(t *testing.T) { }, { name: "one account votes without delegation: prop fails/burn deposit", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.vote(s.delAddrs[0], v1.VoteOption_VOTE_OPTION_YES) }, proposalMsgs: TestProposal, @@ -170,7 +66,7 @@ func TestTally(t *testing.T) { }, { name: "one delegator votes: prop fails/burn deposit", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.delegate(s.delAddrs[0], s.valAddrs[0], 2) s.vote(s.delAddrs[0], v1.VoteOption_VOTE_OPTION_YES) }, @@ -183,9 +79,218 @@ func TestTally(t *testing.T) { NoCount: "0", }, }, + { + name: "one governor vote w/o delegation: prop fails/burn deposit", + setup: func(s *fixture) { + // gov0 VP=3 vote=yes + s.governorVote(s.govAddrs[0], v1.VoteOption_VOTE_OPTION_YES) + }, + proposalMsgs: TestProposal, + expectedPass: false, + expectedBurn: true, // burn because quorum not reached + expectedTally: v1.TallyResult{ + YesCount: "3", + AbstainCount: "0", + NoCount: "0", + }, + }, + { + name: "one governor vote inherits delegation that didn't vote", + setup: func(s *fixture) { + // del0 VP=5 del=gov0 didn't vote + s.delegate(s.delAddrs[0], s.valAddrs[0], 2) + s.delegate(s.delAddrs[0], s.valAddrs[1], 3) + err := s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[0], s.govAddrs[0]) + require.NoError(s.t, err) + // gov0 VP=3 vote=yes + s.governorVote(s.govAddrs[0], v1.VoteOption_VOTE_OPTION_YES) + }, + proposalMsgs: TestProposal, + expectedPass: true, + expectedBurn: false, + expectedTally: v1.TallyResult{ + YesCount: "8", + AbstainCount: "0", + NoCount: "0", + }, + }, + { + name: "inactive governor vote doesn't inherit delegation that didn't vote", + setup: func(s *fixture) { + // del0 VP=5 del=gov2(inactive) didn't vote + s.delegate(s.delAddrs[0], s.valAddrs[0], 2) + s.delegate(s.delAddrs[0], s.valAddrs[1], 3) + err := s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[0], s.govAddrs[2]) + require.NoError(s.t, err) + // gov2(inactive) VP=3 vote=yes + s.governorVote(s.govAddrs[2], v1.VoteOption_VOTE_OPTION_YES) + }, + proposalMsgs: TestProposal, + expectedPass: false, + expectedBurn: true, + expectedTally: v1.TallyResult{ + YesCount: "3", + AbstainCount: "0", + NoCount: "0", + }, + }, + { + name: "one governor votes yes, one delegator votes yes", + setup: func(s *fixture) { + // del0 VP=5 del=gov0 vote=yes + s.delegate(s.delAddrs[0], s.valAddrs[0], 2) + s.delegate(s.delAddrs[0], s.valAddrs[1], 3) + s.vote(s.delAddrs[0], v1.VoteOption_VOTE_OPTION_YES) + err := s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[0], s.govAddrs[0]) + require.NoError(s.t, err) + // gov0 VP=3 vote=yes + s.governorVote(s.govAddrs[0], v1.VoteOption_VOTE_OPTION_YES) + }, + proposalMsgs: TestProposal, + expectedPass: true, + expectedBurn: false, + expectedTally: v1.TallyResult{ + YesCount: "8", + AbstainCount: "0", + NoCount: "0", + }, + }, + { + name: "one governor votes yes, one delegator votes no", + setup: func(s *fixture) { + // del0 VP=5 del=gov0 vote=no + s.delegate(s.delAddrs[0], s.valAddrs[0], 2) + s.delegate(s.delAddrs[0], s.valAddrs[1], 3) + s.vote(s.delAddrs[0], v1.VoteOption_VOTE_OPTION_NO) + err := s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[0], s.govAddrs[0]) + require.NoError(s.t, err) + // gov0 VP=3 vote=yes + s.governorVote(s.govAddrs[0], v1.VoteOption_VOTE_OPTION_YES) + }, + proposalMsgs: TestProposal, + expectedPass: false, + expectedBurn: false, + expectedTally: v1.TallyResult{ + YesCount: "3", + AbstainCount: "0", + NoCount: "5", + }, + }, + { + // Same case as previous one but with reverted vote order + name: "one delegator votes no, one governor votes yes", + setup: func(s *fixture) { + // gov0 VP=3 del=gov0 vote=yes + s.governorVote(s.govAddrs[0], v1.VoteOption_VOTE_OPTION_YES) + // del0 VP=5 vote=no + s.delegate(s.delAddrs[0], s.valAddrs[0], 2) + s.delegate(s.delAddrs[0], s.valAddrs[1], 3) + s.vote(s.delAddrs[0], v1.VoteOption_VOTE_OPTION_NO) + err := s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[0], s.govAddrs[0]) + require.NoError(s.t, err) + }, + proposalMsgs: TestProposal, + expectedPass: false, + expectedBurn: false, + expectedTally: v1.TallyResult{ + YesCount: "3", + AbstainCount: "0", + NoCount: "5", + }, + }, + { + name: "one governor votes and some delegations vote", + setup: func(s *fixture) { + // del0 VP=2 del=gov0 vote=no + s.delegate(s.delAddrs[0], s.valAddrs[0], 2) + err := s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[0], s.govAddrs[0]) + require.NoError(s.t, err) + s.vote(s.delAddrs[0], v1.VoteOption_VOTE_OPTION_NO) + // del1 VP=3 del=gov0 didn't vote (so VP goes to gov0's vote) + s.delegate(s.delAddrs[1], s.valAddrs[1], 3) + err = s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[1], s.govAddrs[0]) + require.NoError(s.t, err) + // del2 VP=4 del=gov0 vote=abstain + s.delegate(s.delAddrs[2], s.valAddrs[0], 4) + err = s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[2], s.govAddrs[0]) + require.NoError(s.t, err) + s.vote(s.delAddrs[2], v1.VoteOption_VOTE_OPTION_ABSTAIN) + // del3 VP=5 del=gov0 vote=yes + s.delegate(s.delAddrs[3], s.valAddrs[1], 2) + s.delegate(s.delAddrs[3], s.valAddrs[2], 3) + err = s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[3], s.govAddrs[0]) + require.NoError(s.t, err) + s.vote(s.delAddrs[3], v1.VoteOption_VOTE_OPTION_YES) + // del4 VP=4 del=gov1 vote=no + s.delegate(s.delAddrs[4], s.valAddrs[3], 4) + err = s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[4], s.govAddrs[1]) + require.NoError(s.t, err) + s.vote(s.delAddrs[4], v1.VoteOption_VOTE_OPTION_NO) + // del5 VP=6 del=gov1 didn't vote (so VP does to gov1's vote) + s.delegate(s.delAddrs[5], s.valAddrs[3], 6) + err = s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[5], s.govAddrs[1]) + require.NoError(s.t, err) + // gov0 VP=3 vote=yes + s.governorVote(s.govAddrs[0], v1.VoteOption_VOTE_OPTION_YES) + }, + proposalMsgs: TestProposal, + expectedPass: false, + expectedBurn: false, + expectedTally: v1.TallyResult{ + YesCount: "11", + AbstainCount: "4", + NoCount: "6", + }, + }, + { + name: "two governors vote and some delegations vote", + setup: func(s *fixture) { + // del0 VP=2 del=gov0 vote=no + s.delegate(s.delAddrs[0], s.valAddrs[0], 2) + err := s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[0], s.govAddrs[0]) + require.NoError(s.t, err) + s.vote(s.delAddrs[0], v1.VoteOption_VOTE_OPTION_NO) + // del1 VP=3 del=gov0 didn't vote (so VP goes to gov0's vote) + s.delegate(s.delAddrs[1], s.valAddrs[1], 3) + err = s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[1], s.govAddrs[0]) + require.NoError(s.t, err) + // del2 VP=4 del=gov0 vote=abstain + s.delegate(s.delAddrs[2], s.valAddrs[0], 4) + err = s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[2], s.govAddrs[0]) + require.NoError(s.t, err) + s.vote(s.delAddrs[2], v1.VoteOption_VOTE_OPTION_ABSTAIN) + // del3 VP=5 del=gov0 vote=yes + s.delegate(s.delAddrs[3], s.valAddrs[1], 2) + s.delegate(s.delAddrs[3], s.valAddrs[2], 3) + err = s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[3], s.govAddrs[0]) + require.NoError(s.t, err) + s.vote(s.delAddrs[3], v1.VoteOption_VOTE_OPTION_YES) + // del4 VP=4 del=gov1 vote=no + s.delegate(s.delAddrs[4], s.valAddrs[3], 4) + err = s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[4], s.govAddrs[1]) + require.NoError(s.t, err) + s.vote(s.delAddrs[4], v1.VoteOption_VOTE_OPTION_NO) + // del5 VP=6 del=gov1 didn't vote (so VP does to gov1's vote) + s.delegate(s.delAddrs[5], s.valAddrs[3], 6) + err = s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[5], s.govAddrs[1]) + require.NoError(s.t, err) + // gov0 VP=3 vote=yes + s.governorVote(s.govAddrs[0], v1.VoteOption_VOTE_OPTION_YES) + // gov1 VP=3 vote=abstain + s.governorVote(s.govAddrs[1], v1.VoteOption_VOTE_OPTION_ABSTAIN) + }, + proposalMsgs: TestProposal, + expectedPass: false, + expectedBurn: false, + expectedTally: v1.TallyResult{ + YesCount: "11", + AbstainCount: "13", + NoCount: "6", + }, + }, { name: "one delegator votes yes, validator votes also yes: prop fails/burn deposit", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.delegate(s.delAddrs[0], s.valAddrs[0], 1) s.vote(s.delAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) @@ -201,7 +306,7 @@ func TestTally(t *testing.T) { }, { name: "one delegator votes yes, validator votes no: prop fails/burn deposit", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.delegate(s.delAddrs[0], s.valAddrs[0], 1) s.vote(s.delAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_NO) @@ -217,7 +322,7 @@ func TestTally(t *testing.T) { }, { name: "validator votes yes, doesn't inherit delegations", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.delegate(s.delAddrs[0], s.valAddrs[0], 2) s.delegate(s.delAddrs[1], s.valAddrs[0], 2) s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_NO) @@ -238,7 +343,7 @@ func TestTally(t *testing.T) { // second validator votes no // third validator (no delegation) votes abstain name: "delegator with mixed delegations: prop pass", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.delegate(s.delAddrs[0], s.valAddrs[0], 2) s.delegate(s.delAddrs[0], s.valAddrs[1], 2) s.vote(s.delAddrs[0], v1.VoteOption_VOTE_OPTION_YES) @@ -256,25 +361,26 @@ func TestTally(t *testing.T) { }, }, { - name: "quorum reached with only abstain: prop fails", - setup: func(s *tallyFixture) { + name: "quorum reached with only abstain: prop rejected", + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_ABSTAIN) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_ABSTAIN) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_ABSTAIN) s.validatorVote(s.valAddrs[3], v1.VoteOption_VOTE_OPTION_ABSTAIN) + s.validatorVote(s.valAddrs[4], v1.VoteOption_VOTE_OPTION_ABSTAIN) }, proposalMsgs: TestProposal, expectedPass: false, expectedBurn: false, expectedTally: v1.TallyResult{ YesCount: "0", - AbstainCount: "4", + AbstainCount: "5", NoCount: "0", }, }, { name: "quorum reached with yes<=.667: prop rejected", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_YES) @@ -296,7 +402,7 @@ func TestTally(t *testing.T) { }, { name: "quorum reached with yes>.667: prop passes", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_YES) @@ -318,7 +424,7 @@ func TestTally(t *testing.T) { }, { name: "quorum reached with no>.7: prop rejected and deposit burned", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_NO) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_NO) @@ -340,7 +446,7 @@ func TestTally(t *testing.T) { }, { name: "quorum reached thanks to abstain, yes>.667: prop passes", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_NO) @@ -359,7 +465,7 @@ func TestTally(t *testing.T) { }, { name: "amendment quorum not reached: prop rejected", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) }, @@ -374,7 +480,7 @@ func TestTally(t *testing.T) { }, { name: "amendment quorum reached and threshold not reached: prop rejected", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_NO) @@ -393,7 +499,7 @@ func TestTally(t *testing.T) { }, { name: "amendment quorum reached and threshold reached: prop passes", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_NO) @@ -417,7 +523,7 @@ func TestTally(t *testing.T) { }, { name: "law quorum not reached: prop rejected", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_NO) }, @@ -432,7 +538,7 @@ func TestTally(t *testing.T) { }, { name: "law quorum reached and threshold not reached: prop rejected", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_NO) @@ -451,9 +557,10 @@ func TestTally(t *testing.T) { }, { name: "law quorum reached and threshold reached: prop passes", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) + s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[3], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[5], v1.VoteOption_VOTE_OPTION_ABSTAIN) }, @@ -461,18 +568,19 @@ func TestTally(t *testing.T) { expectedPass: true, expectedBurn: false, expectedTally: v1.TallyResult{ - YesCount: "3", + YesCount: "4", AbstainCount: "1", NoCount: "0", }, }, { name: "law quorum reached and threshold not reached no endorse", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[3], v1.VoteOption_VOTE_OPTION_NO) + s.validatorVote(s.valAddrs[4], v1.VoteOption_VOTE_OPTION_ABSTAIN) }, proposalMsgs: TestLawProposal, expectedPass: false, @@ -480,17 +588,18 @@ func TestTally(t *testing.T) { endorse: false, expectedTally: v1.TallyResult{ YesCount: "3", - AbstainCount: "0", + AbstainCount: "1", NoCount: "1", }, }, { name: "law quorum reached and threshold lowered with endorse", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[3], v1.VoteOption_VOTE_OPTION_NO) + s.validatorVote(s.valAddrs[4], v1.VoteOption_VOTE_OPTION_ABSTAIN) }, proposalMsgs: TestLawProposal, expectedPass: true, @@ -498,7 +607,7 @@ func TestTally(t *testing.T) { endorse: true, expectedTally: v1.TallyResult{ YesCount: "3", - AbstainCount: "0", + AbstainCount: "1", NoCount: "1", }, }, @@ -509,24 +618,32 @@ func TestTally(t *testing.T) { params := v1.DefaultParams() // Ensure params value are different than false params.BurnVoteQuorum = true + params.MinGovernorSelfDelegation = "1" err := govKeeper.SetParams(ctx, params) require.NoError(t, err) - var ( - numVals = 10 - numDelegators = 5 - addrs = simtestutil.CreateRandomAccounts(numVals + numDelegators) - valAddrs = simtestutil.ConvertAddrsToValAddrs(addrs[:numVals]) - delAddrs = addrs[numVals:] - ) + // Set starting participation EMAs to 0.375 so initial quorum is 0.25 using default params + // minQuorum = 0.1, maxQuorum = 0.5, participationEMA = 0.375; 0.1 + (0.5 - 0.1) * 0.375 = 0.25 + govKeeper.SetParticipationEMA(ctx, math.LegacyMustNewDecFromStr("0.375")) + govKeeper.SetLawParticipationEMA(ctx, math.LegacyMustNewDecFromStr("0.375")) + govKeeper.SetConstitutionAmendmentParticipationEMA(ctx, math.LegacyMustNewDecFromStr("0.375")) + // Create the test fixture + s := newFixture(t, ctx, 10, 6, 3, govKeeper, mocks) + // Setup governor self delegation + for _, govAddr := range s.govAddrs { + accAddr := sdk.AccAddress(govAddr) + s.delegate(accAddr, s.valAddrs[0], 1) + s.delegate(accAddr, s.valAddrs[1], 2) + err := govKeeper.DelegateToGovernor(ctx, accAddr, govAddr) + require.NoError(t, err) + } // Submit and activate a proposal - proposal, err := govKeeper.SubmitProposal(ctx, tt.proposalMsgs, "", "title", "summary", delAddrs[0]) + proposal, err := govKeeper.SubmitProposal(ctx, tt.proposalMsgs, "", "title", "summary", s.delAddrs[0]) require.NoError(t, err) govKeeper.ActivateVotingPeriod(ctx, proposal) if tt.endorse { proposal.Endorsed = true } - // Create the test fixture - s := newTallyFixture(t, ctx, proposal, valAddrs, delAddrs, govKeeper, mocks) + s.proposal = proposal if tt.setup != nil { tt.setup(s) } @@ -546,20 +663,20 @@ func TestHasReachedQuorum(t *testing.T) { tests := []struct { name string proposalMsgs []sdk.Msg - setup func(*tallyFixture) + setup func(*fixture) expectedQuorum bool }{ { name: "no votes: no quorum", proposalMsgs: TestProposal, - setup: func(s *tallyFixture) { + setup: func(s *fixture) { }, expectedQuorum: false, }, { name: "not enough votes: no quorum", proposalMsgs: TestProposal, - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_NO) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) }, @@ -568,7 +685,7 @@ func TestHasReachedQuorum(t *testing.T) { { name: "enough votes: quorum", proposalMsgs: TestProposal, - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_NO) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) s.delegate(s.delAddrs[0], s.valAddrs[2], 500000) @@ -579,9 +696,19 @@ func TestHasReachedQuorum(t *testing.T) { }, expectedQuorum: true, }, + { + name: "quorum reached by governor vote inheritance", + proposalMsgs: TestProposal, + setup: func(s *fixture) { + s.delegate(s.delAddrs[0], s.valAddrs[0], 500000) + s.keeper.DelegateToGovernor(s.ctx, s.delAddrs[0], s.govAddrs[0]) + s.governorVote(s.govAddrs[0], v1.VoteOption_VOTE_OPTION_ABSTAIN) + }, + expectedQuorum: true, + }, { name: "amendment quorum not reached", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) }, @@ -590,7 +717,7 @@ func TestHasReachedQuorum(t *testing.T) { }, { name: "amendment quorum reached", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_NO) @@ -608,7 +735,7 @@ func TestHasReachedQuorum(t *testing.T) { }, { name: "law quorum not reached", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_NO) }, @@ -617,9 +744,10 @@ func TestHasReachedQuorum(t *testing.T) { }, { name: "law quorum reached", - setup: func(s *tallyFixture) { + setup: func(s *fixture) { s.validatorVote(s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) + s.validatorVote(s.valAddrs[2], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[3], v1.VoteOption_VOTE_OPTION_YES) s.validatorVote(s.valAddrs[5], v1.VoteOption_VOTE_OPTION_ABSTAIN) }, @@ -630,19 +758,29 @@ func TestHasReachedQuorum(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { govKeeper, mocks, _, ctx := setupGovKeeper(t, mockAccountKeeperExpectations) - var ( - numVals = 10 - numDelegators = 5 - addrs = simtestutil.CreateRandomAccounts(numVals + numDelegators) - valAddrs = simtestutil.ConvertAddrsToValAddrs(addrs[:numVals]) - delAddrs = addrs[numVals:] - ) + params := v1.DefaultParams() + params.MinGovernorSelfDelegation = "1" + err := govKeeper.SetParams(ctx, params) + require.NoError(t, err) + // Set starting participation EMAs to 0.375 so initial quorum is 0.25 using default params + // minQuorum = 0.1, maxQuorum = 0.5, participationEMA = 0.375; 0.1 + (0.5 - 0.1) * 0.375 = 0.25 + govKeeper.SetParticipationEMA(ctx, math.LegacyMustNewDecFromStr("0.375")) + govKeeper.SetLawParticipationEMA(ctx, math.LegacyMustNewDecFromStr("0.375")) + govKeeper.SetConstitutionAmendmentParticipationEMA(ctx, math.LegacyMustNewDecFromStr("0.375")) // Submit and activate a proposal - proposal, err := govKeeper.SubmitProposal(ctx, tt.proposalMsgs, "", "title", "summary", delAddrs[0]) + s := newFixture(t, ctx, 10, 5, 3, govKeeper, mocks) + // Setup governor self delegation + for _, govAddr := range s.govAddrs { + accAddr := sdk.AccAddress(govAddr) + s.delegate(accAddr, s.valAddrs[0], 1) + s.delegate(accAddr, s.valAddrs[1], 2) + govKeeper.DelegateToGovernor(ctx, accAddr, govAddr) + } + proposal, err := govKeeper.SubmitProposal(ctx, tt.proposalMsgs, "", "title", "summary", s.delAddrs[0]) require.NoError(t, err) + s.proposal = proposal govKeeper.ActivateVotingPeriod(ctx, proposal) - suite := newTallyFixture(t, ctx, proposal, valAddrs, delAddrs, govKeeper, mocks) - tt.setup(suite) + tt.setup(s) quorum, err := govKeeper.HasReachedQuorum(ctx, proposal) @@ -650,9 +788,17 @@ func TestHasReachedQuorum(t *testing.T) { assert.Equal(t, tt.expectedQuorum, quorum) if tt.expectedQuorum { // Assert votes are still here after HasReachedQuorum - votes := suite.keeper.GetVotes(suite.ctx, proposal.Id) + votes := s.keeper.GetVotes(s.ctx, proposal.Id) assert.NotEmpty(t, votes, "votes must be kept after HasReachedQuorum") } }) } } + +func convertAddrsToGovAddrs(addrs []sdk.AccAddress) []types.GovernorAddress { + govAddrs := make([]types.GovernorAddress, len(addrs)) + for i, addr := range addrs { + govAddrs[i] = types.GovernorAddress(addr) + } + return govAddrs +} diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 0ef7cc6b..c8269b42 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -50,6 +50,8 @@ const ( MaxConstitutionAmendmentQuorum = "max_constitution_amendment_quorum" MinLawQuorum = "min_law_quorum" MaxLawQuorum = "max_law_quorum" + GovernorStatusChangePeriod = "governor_status_change_period" + MinGovernorSelfDelegation = "min_governor_self_delegation" ) // GenDepositParamsDepositPeriod returns randomized DepositParamsDepositPeriod @@ -164,6 +166,11 @@ func GenBurnDepositNoThreshold(r *rand.Rand) math.LegacyDec { return math.LegacyNewDecWithPrec(int64(simulation.RandIntBetween(r, 500, 950)), 3) } +// GenMinGovernorSelfDelegation returns a randomized MinGovernorSelfDelegation +func GenMinGovernorSelfDelegation(r *rand.Rand) math.Int { + return math.NewInt(int64(simulation.RandIntBetween(r, 1000, 10000000))) +} + // RandomizedGenState generates a random GenesisState for gov func RandomizedGenState(simState *module.SimulationState) { startingProposalID := uint64(simState.Rand.Intn(100)) @@ -344,6 +351,18 @@ func RandomizedGenState(simState *module.SimulationState) { var maxLawQuorum math.LegacyDec simState.AppParams.GetOrGenerate(MaxLawQuorum, &maxLawQuorum, simState.Rand, func(r *rand.Rand) { maxLawQuorum = GenMaxQuorum(r) }) + var governorStatusChangePeriod time.Duration + simState.AppParams.GetOrGenerate( + GovernorStatusChangePeriod, &governorStatusChangePeriod, simState.Rand, + func(r *rand.Rand) { governorStatusChangePeriod = GenDepositParamsDepositPeriod(r) }, + ) + + var minGovernorSelfDelegation math.Int + simState.AppParams.GetOrGenerate( + MinGovernorSelfDelegation, &minGovernorSelfDelegation, simState.Rand, + func(r *rand.Rand) { minGovernorSelfDelegation = GenMinGovernorSelfDelegation(r) }, + ) + govGenesis := v1.NewGenesisState( startingProposalID, startingParticipationEma, startingParticipationEma, startingParticipationEma, v1.NewParams(depositPeriod, votingPeriod, threshold.String(), amendmentsThreshold.String(), lawThreshold.String(), @@ -356,6 +375,7 @@ func RandomizedGenState(simState *module.SimulationState) { burnDepositNoThreshold.String(), maxQuorum.String(), minQuorum.String(), maxConstitutionAmendmentQuorum.String(), minConstitutionAmendmentQuorum.String(), maxLawQuorum.String(), minQuorum.String(), + governorStatusChangePeriod, minGovernorSelfDelegation.String(), ), ) diff --git a/x/gov/testutil/expected_keepers_mocks.go b/x/gov/testutil/expected_keepers_mocks.go index 7481b229..87ddcf06 100644 --- a/x/gov/testutil/expected_keepers_mocks.go +++ b/x/gov/testutil/expected_keepers_mocks.go @@ -1052,6 +1052,36 @@ func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx) } +// GetDelegation mocks base method. +func (m *MockStakingKeeper) GetDelegation(arg0 context.Context, arg1 types.AccAddress, arg2 types.ValAddress) (types1.Delegation, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDelegation", arg0, arg1, arg2) + ret0, _ := ret[0].(types1.Delegation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetDelegation indicates an expected call of GetDelegation. +func (mr *MockStakingKeeperMockRecorder) GetDelegation(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDelegation", reflect.TypeOf((*MockStakingKeeper)(nil).GetDelegation), arg0, arg1, arg2) +} + +// GetValidator mocks base method. +func (m *MockStakingKeeper) GetValidator(arg0 context.Context, arg1 types.ValAddress) (types1.Validator, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetValidator", arg0, arg1) + ret0, _ := ret[0].(types1.Validator) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetValidator indicates an expected call of GetValidator. +func (mr *MockStakingKeeperMockRecorder) GetValidator(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidator", reflect.TypeOf((*MockStakingKeeper)(nil).GetValidator), arg0, arg1) +} + // IterateBondedValidatorsByPower mocks base method. func (m *MockStakingKeeper) IterateBondedValidatorsByPower(arg0 context.Context, arg1 func(int64, types1.ValidatorI) bool) error { m.ctrl.T.Helper() diff --git a/x/gov/types/address.go b/x/gov/types/address.go new file mode 100644 index 00000000..339f9090 --- /dev/null +++ b/x/gov/types/address.go @@ -0,0 +1,188 @@ +package types + +import ( + "bytes" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "strings" + + "gopkg.in/yaml.v2" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Address = GovernorAddress{} + +const ( + // Prefix for governor addresses + // Full prefix is defined as `bech32AccountPrefix + PrefixGovernor` + PrefixGovernor = "gov" +) + +type GovernorAddress []byte + +// GovernorAddressFromHex creates a GovernorAddress from a hex string. +func GovernorAddressFromHex(address string) (addr GovernorAddress, err error) { + bz, err := addressBytesFromHexString(address) + return GovernorAddress(bz), err +} + +// GovernorAddressFromBech32 creates a GovernorAddress from a Bech32 string. +func GovernorAddressFromBech32(address string) (addr GovernorAddress, err error) { + if len(strings.TrimSpace(address)) == 0 { + return GovernorAddress{}, errors.New("empty address string is not allowed") + } + + bech32PrefixGovAddr := sdk.GetConfig().GetBech32AccountAddrPrefix() + PrefixGovernor + + bz, err := sdk.GetFromBech32(address, bech32PrefixGovAddr) + if err != nil { + return nil, err + } + + err = sdk.VerifyAddressFormat(bz) + if err != nil { + return nil, err + } + + return GovernorAddress(bz), nil +} + +// MustGovernorAddressFromBech32 creates a GovernorAddress from a Bech32 string. +// If the address is invalid, it panics. +func MustGovernorAddressFromBech32(address string) GovernorAddress { + addr, err := GovernorAddressFromBech32(address) + if err != nil { + panic(err) + } + + return addr +} + +// Returns boolean for whether two GovernorAddresses are Equal +func (ga GovernorAddress) Equals(ga2 sdk.Address) bool { + if ga.Empty() && ga2.Empty() { + return true + } + + return bytes.Equal(ga.Bytes(), ga2.Bytes()) +} + +// Returns boolean for whether a GovernorAddress is empty +func (ga GovernorAddress) Empty() bool { + return len(ga) == 0 +} + +// Marshal returns the raw address bytes. It is needed for protobuf +// compatibility. +func (ga GovernorAddress) Marshal() ([]byte, error) { + return ga, nil +} + +// Unmarshal sets the address to the given data. It is needed for protobuf +// compatibility. +func (ga *GovernorAddress) Unmarshal(data []byte) error { + *ga = data + return nil +} + +// MarshalJSON marshals to JSON using Bech32. +func (ga GovernorAddress) MarshalJSON() ([]byte, error) { + return json.Marshal(ga.String()) +} + +// MarshalYAML marshals to YAML using Bech32. +func (ga GovernorAddress) MarshalYAML() (interface{}, error) { + return ga.String(), nil +} + +// UnmarshalJSON unmarshals from JSON assuming Bech32 encoding. +func (ga *GovernorAddress) UnmarshalJSON(data []byte) error { + var s string + err := json.Unmarshal(data, &s) + if err != nil { + return err + } + if s == "" { + *ga = GovernorAddress{} + return nil + } + + ga2, err := GovernorAddressFromBech32(s) + if err != nil { + return err + } + + *ga = ga2 + return nil +} + +// UnmarshalYAML unmarshals from YAML assuming Bech32 encoding. +func (ga *GovernorAddress) UnmarshalYAML(data []byte) error { + var s string + err := yaml.Unmarshal(data, &s) + if err != nil { + return err + } + if s == "" { + *ga = GovernorAddress{} + return nil + } + + ga2, err := GovernorAddressFromBech32(s) + if err != nil { + return err + } + + *ga = ga2 + return nil +} + +// Bytes returns the raw address bytes. +func (ga GovernorAddress) Bytes() []byte { + return ga +} + +// String implements the Stringer interface. +func (ga GovernorAddress) String() string { + if ga.Empty() { + return "" + } + + bech32Addr, err := sdk.Bech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix()+PrefixGovernor, ga.Bytes()) + if err != nil { + panic(err) + } + return bech32Addr +} + +// Format implements the fmt.Formatter interface. +func (ga GovernorAddress) Format(s fmt.State, verb rune) { + switch verb { + case 's': + _, err := s.Write([]byte(ga.String())) + if err != nil { + panic(err) + } + case 'p': + _, err := s.Write([]byte(fmt.Sprintf("%p", ga))) + if err != nil { + panic(err) + } + default: + _, err := s.Write([]byte(fmt.Sprintf("%X", []byte(ga)))) + if err != nil { + panic(err) + } + } +} + +func addressBytesFromHexString(address string) ([]byte, error) { + if len(address) == 0 { + return nil, sdk.ErrEmptyHexAddress + } + + return hex.DecodeString(address) +} diff --git a/x/gov/types/errors.go b/x/gov/types/errors.go index 4358f437..494e1e78 100644 --- a/x/gov/types/errors.go +++ b/x/gov/types/errors.go @@ -9,18 +9,28 @@ var ( ErrInactiveProposal = errors.Register(ModuleName, 30, "inactive proposal") ErrAlreadyActiveProposal = errors.Register(ModuleName, 40, "proposal already active") // Errors 5 & 6 are legacy errors related to v1beta1.Proposal. - ErrInvalidProposalContent = errors.Register(ModuleName, 50, "invalid proposal content") - ErrInvalidProposalType = errors.Register(ModuleName, 60, "invalid proposal type") - ErrInvalidVote = errors.Register(ModuleName, 70, "invalid vote option") - ErrInvalidGenesis = errors.Register(ModuleName, 80, "invalid genesis state") - ErrNoProposalHandlerExists = errors.Register(ModuleName, 90, "no handler exists for proposal type") - ErrUnroutableProposalMsg = errors.Register(ModuleName, 100, "proposal message not recognized by router") - ErrNoProposalMsgs = errors.Register(ModuleName, 110, "no messages proposed") - ErrInvalidProposalMsg = errors.Register(ModuleName, 120, "invalid proposal message") - ErrInvalidSigner = errors.Register(ModuleName, 130, "expected gov account as only signer for proposal message") - ErrInvalidSignalMsg = errors.Register(ModuleName, 140, "signal message is invalid") - ErrMetadataTooLong = errors.Register(ModuleName, 150, "metadata too long") - ErrMinDepositTooSmall = errors.Register(ModuleName, 160, "minimum deposit is too small") - ErrInvalidConstitutionAmendment = errors.Register(ModuleName, 170, "invalid constitution amendment") - ErrUnknownProposal = errors.Register(ModuleName, 180, "unknown proposal") + ErrInvalidProposalContent = errors.Register(ModuleName, 50, "invalid proposal content") + ErrInvalidProposalType = errors.Register(ModuleName, 60, "invalid proposal type") + ErrInvalidVote = errors.Register(ModuleName, 70, "invalid vote option") + ErrInvalidGenesis = errors.Register(ModuleName, 80, "invalid genesis state") + ErrNoProposalHandlerExists = errors.Register(ModuleName, 90, "no handler exists for proposal type") + ErrUnroutableProposalMsg = errors.Register(ModuleName, 100, "proposal message not recognized by router") + ErrNoProposalMsgs = errors.Register(ModuleName, 110, "no messages proposed") + ErrInvalidProposalMsg = errors.Register(ModuleName, 120, "invalid proposal message") + ErrInvalidSigner = errors.Register(ModuleName, 130, "expected gov account as only signer for proposal message") + ErrInvalidSignalMsg = errors.Register(ModuleName, 140, "signal message is invalid") + ErrMetadataTooLong = errors.Register(ModuleName, 150, "metadata too long") + ErrMinDepositTooSmall = errors.Register(ModuleName, 160, "minimum deposit is too small") + ErrInvalidConstitutionAmendment = errors.Register(ModuleName, 170, "invalid constitution amendment") + ErrUnknownProposal = errors.Register(ModuleName, 180, "unknown proposal") + ErrGovernorExists = errors.Register(ModuleName, 300, "governor already exists") + ErrGovernorNotFound = errors.Register(ModuleName, 310, "governor not found") + ErrInvalidGovernorStatus = errors.Register(ModuleName, 320, "invalid governor status") + ErrGovernanceDelegationExists = errors.Register(ModuleName, 330, "governance delegation already exists") + ErrGovernanceDelegationNotFound = errors.Register(ModuleName, 340, "governance delegation not found") + ErrInvalidGovernanceDescription = errors.Register(ModuleName, 350, "invalid governance description") + ErrDelegatorIsGovernor = errors.Register(ModuleName, 360, "cannot explicitly manage governance delegations, delegator is an active governor") + ErrGovernorStatusEqual = errors.Register(ModuleName, 370, "cannot change governor status to the same status") + ErrGovernorStatusChangePeriod = errors.Register(ModuleName, 380, "governor status change period not elapsed") + ErrInsufficientGovernorDelegation = errors.Register(ModuleName, 390, "insufficient governor self-delegation") ) diff --git a/x/gov/types/events.go b/x/gov/types/events.go index 99b5305e..dbb1d134 100644 --- a/x/gov/types/events.go +++ b/x/gov/types/events.go @@ -11,6 +11,12 @@ const ( EventTypeQuorumCheck = "quorum_check" EventTypeMinDepositChange = "min_deposit_change" EventTypeMinInitialDepositChange = "min_initial_deposit_change" + EventTypeCreateGovernor = "create_governor" + EventTypeEditGovernor = "edit_governor" + EventTypeGovernorChangeStatus = "governor_change_status" + EventTypeDelegate = "delegate_governor" + EventTypeUndelegate = "undelegate_governor" + EventTypeRedelegate = "redelegate_governor" AttributeKeyVoter = "voter" AttributeKeyProposalResult = "proposal_result" @@ -32,4 +38,11 @@ const ( AttributeKeyLastMinDeposit = "last_min_deposit" // last min deposit value AttributeKeyNewMinInitialDeposit = "new_min_initial_deposit" // new min initial deposit value AttributeKeyLastMinInitialDeposit = "last_min_initial_deposit" // last min initial deposit value + AttributeKeySrcGovernor = "source_governor" + AttributeKeyDstGovernor = "destination_governor" + AttributeKeyDelegator = "delegator" + AttributeKeyGovernor = "governor" + AttributeKeyStatus = "status" + AttributeValueStatusInactive = "inactive" + AttributeValueStatusActive = "active" ) diff --git a/x/gov/types/expected_keepers.go b/x/gov/types/expected_keepers.go index 275d7803..cf62373f 100644 --- a/x/gov/types/expected_keepers.go +++ b/x/gov/types/expected_keepers.go @@ -17,6 +17,9 @@ type ParamSubspace interface { // StakingKeeper expected staking keeper (Validator and Delegator sets) (noalias) type StakingKeeper interface { + GetValidator(context.Context, sdk.ValAddress) (stakingtypes.Validator, error) + GetDelegation(context.Context, sdk.AccAddress, sdk.ValAddress) (stakingtypes.Delegation, error) + // iterate through bonded validators by operator address, execute func for each validator IterateBondedValidatorsByPower( context.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool), diff --git a/x/gov/types/keys.go b/x/gov/types/keys.go index 23c4dad4..5a55bea1 100644 --- a/x/gov/types/keys.go +++ b/x/gov/types/keys.go @@ -64,6 +64,12 @@ var ( KeyParticipationEMA = []byte{0x50} KeyConstitutionAmendmentParticipationEMA = []byte{0x60} KeyLawParticipationEMA = []byte{0x70} + + // GovernorKeyPrefix is the prefix for governor key + GovernorKeyPrefix = []byte{0x80} + GovernanceDelegationKeyPrefix = []byte{0x81} + ValidatorSharesByGovernorKeyPrefix = []byte{0x82} + GovernanceDelegationsByGovernorKeyPrefix = []byte{0x83} ) var lenTime = len(sdk.FormatTimeBytes(time.Now())) @@ -164,6 +170,28 @@ func VoteKey(proposalID uint64, voterAddr sdk.AccAddress) []byte { return append(VotesKey(proposalID), address.MustLengthPrefix(voterAddr.Bytes())...) } +// GovernorKey gets the first part of the governor key based on the governor address +func GovernorKey(governorAddr GovernorAddress) []byte { + return append(GovernorKeyPrefix, address.MustLengthPrefix(governorAddr.Bytes())...) +} + +// GovernanceDelegationKey gets the first part of the governance delegation key based on the delegator address +func GovernanceDelegationKey(delegatorAddr sdk.AccAddress) []byte { + return append(GovernanceDelegationKeyPrefix, address.MustLengthPrefix(delegatorAddr.Bytes())...) +} + +// GovernanceDelegationsByGovernorKey gets the first part of the key for governance delegations indexed by governor +// based on the delegator address and delegator address +func GovernanceDelegationsByGovernorKey(governorAddr GovernorAddress, delegatorAddr sdk.AccAddress) []byte { + return append(GovernanceDelegationsByGovernorKeyPrefix, append(address.MustLengthPrefix(governorAddr.Bytes()), address.MustLengthPrefix(delegatorAddr.Bytes())...)...) +} + +// ValidatorSharesByGovernorKey gets the first part of the validator shares key based +// on the governor address and validator address +func ValidatorSharesByGovernorKey(governorAddr GovernorAddress, validatorAddr sdk.ValAddress) []byte { + return append(ValidatorSharesByGovernorKeyPrefix, append(address.MustLengthPrefix(governorAddr.Bytes()), address.MustLengthPrefix(validatorAddr.Bytes())...)...) +} + // Split keys function; used for iterators // SplitProposalKey split the proposal key and returns the proposal id diff --git a/x/gov/types/v1/codec.go b/x/gov/types/v1/codec.go index b76459b1..085b15dc 100644 --- a/x/gov/types/v1/codec.go +++ b/x/gov/types/v1/codec.go @@ -19,6 +19,10 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "atomone/x/gov/v1/MsgUpdateParams") legacy.RegisterAminoMsg(cdc, &MsgProposeConstitutionAmendment{}, "atomone/x/gov/v1/MsgProposeAmendment") legacy.RegisterAminoMsg(cdc, &MsgProposeLaw{}, "atomone/x/gov/v1/MsgProposeLaw") + legacy.RegisterAminoMsg(cdc, &MsgCreateGovernor{}, "atomone/v1/MsgCreateGovernor") + legacy.RegisterAminoMsg(cdc, &MsgEditGovernor{}, "atomone/v1/MsgEditGovernor") + legacy.RegisterAminoMsg(cdc, &MsgDelegateGovernor{}, "atomone/v1/MsgDelegateGovernor") + legacy.RegisterAminoMsg(cdc, &MsgUndelegateGovernor{}, "atomone/v1/MsgUndelegateGovernor") } // RegisterInterfaces registers the interfaces types with the Interface Registry. @@ -32,6 +36,10 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgUpdateParams{}, &MsgProposeConstitutionAmendment{}, &MsgProposeLaw{}, + &MsgCreateGovernor{}, + &MsgEditGovernor{}, + &MsgDelegateGovernor{}, + &MsgUndelegateGovernor{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/gov/types/v1/delegation.go b/x/gov/types/v1/delegation.go new file mode 100644 index 00000000..22983bf2 --- /dev/null +++ b/x/gov/types/v1/delegation.go @@ -0,0 +1,32 @@ +package v1 + +import ( + "fmt" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/atomone-hub/atomone/x/gov/types" +) + +// NewGovernanceDelegation creates a new GovernanceDelegation instance +func NewGovernanceDelegation(delegatorAddr sdk.AccAddress, governorAddr types.GovernorAddress) GovernanceDelegation { + return GovernanceDelegation{ + DelegatorAddress: delegatorAddr.String(), + GovernorAddress: governorAddr.String(), + } +} + +// NewGovernorValShares creates a new GovernorValShares instance +func NewGovernorValShares(governorAddr types.GovernorAddress, validatorAddress sdk.ValAddress, shares math.LegacyDec) GovernorValShares { + if shares.IsNegative() { + panic(fmt.Sprintf("invalid governor val shares: %s", shares)) + } + + return GovernorValShares{ + GovernorAddress: governorAddr.String(), + ValidatorAddress: validatorAddress.String(), + Shares: shares, + } +} diff --git a/x/gov/types/v1/exported.go b/x/gov/types/v1/exported.go new file mode 100644 index 00000000..132d4000 --- /dev/null +++ b/x/gov/types/v1/exported.go @@ -0,0 +1,14 @@ +package v1 + +import ( + "github.com/atomone-hub/atomone/x/gov/types" +) + +type GovernorI interface { + GetMoniker() string // moniker of the governor + GetStatus() GovernorStatus // status of the governor + IsActive() bool // check if has a active status + IsInactive() bool // check if has status inactive + GetAddress() types.GovernorAddress // governor address to receive/return governors delegations + GetDescription() GovernorDescription // description of the governor +} diff --git a/x/gov/types/v1/genesis.go b/x/gov/types/v1/genesis.go index 5f7a38b0..90bcc3ac 100644 --- a/x/gov/types/v1/genesis.go +++ b/x/gov/types/v1/genesis.go @@ -6,7 +6,10 @@ import ( "golang.org/x/sync/errgroup" - "github.com/cosmos/cosmos-sdk/codec/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/atomone-hub/atomone/x/gov/types" ) // NewGenesisState creates a new genesis state for the governance module @@ -105,6 +108,43 @@ func ValidateGenesis(data *GenesisState) error { return nil }) + // weed out duplicate governors + errGroup.Go(func() error { + governorIds := make(map[string]struct{}) + for _, g := range data.Governors { + if _, err := types.GovernorAddressFromBech32(g.GovernorAddress); err != nil { + return fmt.Errorf("invalid governor address: %v", g) + } + if _, ok := governorIds[g.GovernorAddress]; ok { + return fmt.Errorf("duplicate governor: %v", g) + } + + governorIds[g.GovernorAddress] = struct{}{} + } + + return nil + }) + + // weed out duplicate governance delegations + errGroup.Go(func() error { + delegatorIds := make(map[string]struct{}) + for _, d := range data.GovernanceDelegations { + if _, err := sdk.AccAddressFromBech32(d.DelegatorAddress); err != nil { + return fmt.Errorf("invalid delegator address: %v", d) + } + if _, err := types.GovernorAddressFromBech32(d.GovernorAddress); err != nil { + return fmt.Errorf("invalid governor address: %v", d) + } + if _, ok := delegatorIds[d.DelegatorAddress]; ok { + return fmt.Errorf("duplicate governance delegation: %v", d) + } + + delegatorIds[d.DelegatorAddress] = struct{}{} + } + + return nil + }) + // verify params errGroup.Go(func() error { return data.Params.ValidateBasic() @@ -113,10 +153,10 @@ func ValidateGenesis(data *GenesisState) error { return errGroup.Wait() } -var _ types.UnpackInterfacesMessage = GenesisState{} +var _ codectypes.UnpackInterfacesMessage = GenesisState{} // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (data GenesisState) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { for _, p := range data.Proposals { err := p.UnpackInterfaces(unpacker) if err != nil { diff --git a/x/gov/types/v1/genesis.pb.go b/x/gov/types/v1/genesis.pb.go index 1358e15d..e04ed9bd 100644 --- a/x/gov/types/v1/genesis.pb.go +++ b/x/gov/types/v1/genesis.pb.go @@ -66,6 +66,10 @@ type GenesisState struct { // If unset or set to 0, the quorum for the next law proposal will be set to // the params.LawMinQuorum value. LawParticipationEma string `protobuf:"bytes,14,opt,name=law_participation_ema,json=lawParticipationEma,proto3" json:"law_participation_ema,omitempty"` + // governors defines all the governors present at genesis. + Governors []*Governor `protobuf:"bytes,15,rep,name=governors,proto3" json:"governors,omitempty"` + // governance_delegations defines all the governance delegations present at genesis. + GovernanceDelegations []*GovernanceDelegation `protobuf:"bytes,16,rep,name=governance_delegations,json=governanceDelegations,proto3" json:"governance_delegations,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -202,6 +206,20 @@ func (m *GenesisState) GetLawParticipationEma() string { return "" } +func (m *GenesisState) GetGovernors() []*Governor { + if m != nil { + return m.Governors + } + return nil +} + +func (m *GenesisState) GetGovernanceDelegations() []*GovernanceDelegation { + if m != nil { + return m.GovernanceDelegations + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "atomone.gov.v1.GenesisState") } @@ -209,40 +227,44 @@ func init() { func init() { proto.RegisterFile("atomone/gov/v1/genesis.proto", fileDescriptor_7737a96fb154b10d) } var fileDescriptor_7737a96fb154b10d = []byte{ - // 528 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0x6f, 0xd3, 0x30, - 0x18, 0xc6, 0x9b, 0xfd, 0xe9, 0x56, 0x37, 0x8d, 0x86, 0xd9, 0xc0, 0x8c, 0x11, 0x55, 0x93, 0x90, - 0x22, 0xa4, 0x26, 0x74, 0x93, 0xb8, 0x70, 0x22, 0xda, 0xb4, 0x4d, 0x02, 0xa9, 0x0a, 0x08, 0x24, - 0x2e, 0x91, 0x9b, 0x58, 0x99, 0xa5, 0xc4, 0x8e, 0x6a, 0x37, 0x63, 0x9f, 0x02, 0x3e, 0x0c, 0x1f, - 0x82, 0x63, 0xc5, 0x89, 0x23, 0x6a, 0xbf, 0x08, 0x8a, 0x93, 0xb4, 0x69, 0x28, 0x12, 0xb7, 0xf8, - 0x7d, 0x9f, 0xe7, 0xe7, 0xc7, 0x6f, 0x6c, 0x70, 0x82, 0x25, 0x4f, 0x38, 0x23, 0x4e, 0xc4, 0x33, - 0x27, 0x1b, 0x3a, 0x11, 0x61, 0x44, 0x50, 0x61, 0xa7, 0x13, 0x2e, 0x39, 0x34, 0xca, 0xae, 0x1d, - 0xf1, 0xcc, 0xce, 0x86, 0xc7, 0xa8, 0xa9, 0xe6, 0x59, 0xa1, 0x3c, 0x7e, 0x12, 0x70, 0x91, 0x70, - 0xe1, 0xab, 0x95, 0x53, 0x2c, 0x8a, 0xd6, 0xe9, 0xd7, 0x3d, 0xa0, 0x5f, 0x15, 0xd8, 0xf7, 0x12, - 0x4b, 0x02, 0x5f, 0x82, 0x43, 0x21, 0xf1, 0x44, 0x52, 0x16, 0xe5, 0xfa, 0x94, 0x0b, 0x1c, 0xfb, - 0x34, 0x44, 0x5a, 0x5f, 0xb3, 0x76, 0x3c, 0x58, 0xf5, 0x46, 0x65, 0xeb, 0x26, 0x84, 0xe7, 0x60, - 0x3f, 0x24, 0x29, 0x17, 0x54, 0x0a, 0xb4, 0xd5, 0xdf, 0xb6, 0xba, 0x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0x25, 0xc5, 0xf1, 0x92, 0xd8, 0xfd, 0x2f, 0xe2, 0x51, 0x49, 0xbc, 0x29, 0xdc, 0x15, - 0xf8, 0x35, 0x78, 0x90, 0xe6, 0x37, 0x2f, 0xa0, 0x29, 0xce, 0x33, 0xfb, 0x24, 0xc1, 0x48, 0xcf, - 0xcf, 0xe2, 0x1a, 0x3f, 0xbf, 0x0f, 0x40, 0x79, 0xa9, 0x2f, 0x48, 0xe0, 0x1d, 0xac, 0x09, 0x2f, - 0x13, 0x0c, 0x23, 0x60, 0xd5, 0xcf, 0xeb, 0xe3, 0x84, 0xb0, 0x30, 0x21, 0x4c, 0xdd, 0x8b, 0x06, - 0xb3, 0xb7, 0x91, 0xf9, 0xbc, 0xee, 0x7f, 0x53, 0xd9, 0x47, 0xcd, 0x8d, 0x5c, 0x70, 0x14, 0xe3, - 0xbb, 0x0d, 0x54, 0x63, 0x23, 0xf5, 0x61, 0x8c, 0xef, 0x9a, 0x0c, 0xf7, 0xea, 0xc7, 0xdc, 0xd4, - 0x66, 0x73, 0x53, 0xfb, 0x3d, 0x37, 0xb5, 0x6f, 0x0b, 0xb3, 0x35, 0x5b, 0x98, 0xad, 0x5f, 0x0b, - 0xb3, 0xf5, 0x79, 0x10, 0x51, 0x79, 0x3b, 0x1d, 0xdb, 0x01, 0x4f, 0x9c, 0x72, 0x88, 0x83, 0xdb, - 0xe9, 0xb8, 0xfa, 0x76, 0xbe, 0xa8, 0x97, 0x2f, 0xef, 0x53, 0x22, 0x9c, 0x6c, 0x38, 0x6e, 0xab, - 0x17, 0x7e, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0xf9, 0x9f, 0xf6, 0x13, 0x46, 0x04, 0x00, 0x00, + // 580 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xdd, 0x8a, 0xd3, 0x4e, + 0x14, 0xc0, 0x9b, 0xfd, 0xe8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x88, 0x4b, 0x22, 0xd0, + 0xae, 0xea, 0x38, 0x28, 0x76, 0x7c, 0xe0, 0x92, 0x58, 0x09, 0x02, 0xcf, 0x41, 0x3d, 0x9b, 0x44, + 0xa0, 0x3d, 0xc5, 0xa3, 0x22, 0x9f, 0xcd, 0x63, 0x6d, 0x50, 0x78, 0x09, 0xda, 0xe9, 0x79, 0x76, + 0x88, 0xe7, 0x38, 0x10, 0x68, 0xbf, 0xa7, 0xf5, 0x1b, 0xa7, 0x4f, 0xff, 0x32, 0xde, 0x54, 0x41, + 0xa3, 0x1d, 0xa4, 0x59, 0x2d, 0x37, 0x9f, 0x82, 0x17, 0xa0, 0x15, 0xf1, 0xe4, 0x49, 0x12, 0x51, + 0x55, 0x89, 0x8e, 0x4b, 0xa6, 0x8e, 0xdf, 0x66, 0xe3, 0x69, 0x46, 0xb9, 0x0c, 0x1c, 0x81, 0xa6, + 0xc4, 0xbe, 0x7f, 0x9b, 0x59, 0xfe, 0x53, 0x96, 0x27, 0x45, 0xcb, 0xfb, 0x98, 0xc9, 0x49, 0x1a, + 0x72, 0x93, 0x80, 0x06, 0xa8, 0xa6, 0xdd, 0x35, 0xd5, 0x7d, 0x78, 0xef, 0x25, 0x54, 0xd5, 0x4a, + 0x29, 0x78, 0x02, 0x9a, 0x0e, 0x67, 0x42, 0x52, 0xb9, 0x90, 0x94, 0x33, 0x54, 0xef, 0x69, 0xfd, + 0xba, 0xb5, 0x95, 0x83, 0x97, 0xa0, 0xe3, 0x63, 0x21, 0xed, 0x80, 0x32, 0x3b, 0xbd, 0x38, 0x02, + 0xca, 0xae, 0x17, 0xed, 0x6f, 0xb0, 0x90, 0x6f, 0x29, 0xcb, 0xfe, 0xd0, 0xb6, 0xbf, 0x15, 0xc3, + 0x8f, 0x00, 0xad, 0x4d, 0x94, 0x51, 0x49, 0xb1, 0xbf, 0x36, 0x36, 0xfe, 0xc9, 0xd8, 0x4d, 0x8d, + 0x57, 0x49, 0x77, 0x26, 0x7e, 0x05,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, 0xff, 0xb9, 0xc2, 0x02, 0x06, + 0xdb, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -265,6 +287,36 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.GovernanceDelegations) > 0 { + for iNdEx := len(m.GovernanceDelegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GovernanceDelegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + } + if len(m.Governors) > 0 { + for iNdEx := len(m.Governors) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Governors[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x7a + } + } if len(m.LawParticipationEma) > 0 { i -= len(m.LawParticipationEma) copy(dAtA[i:], m.LawParticipationEma) @@ -493,6 +545,18 @@ func (m *GenesisState) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } + if len(m.Governors) > 0 { + for _, e := range m.Governors { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.GovernanceDelegations) > 0 { + for _, e := range m.GovernanceDelegations { + l = e.Size() + n += 2 + l + sovGenesis(uint64(l)) + } + } return n } @@ -996,6 +1060,74 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } m.LawParticipationEma = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Governors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Governors = append(m.Governors, &Governor{}) + if err := m.Governors[len(m.Governors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernanceDelegations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GovernanceDelegations = append(m.GovernanceDelegations, &GovernanceDelegation{}) + if err := m.GovernanceDelegations[len(m.GovernanceDelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index a79510b2..3e954e64 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -4,6 +4,7 @@ package v1 import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" types1 "github.com/cosmos/cosmos-sdk/codec/types" @@ -122,6 +123,38 @@ func (ProposalStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_ecf0f9950ff6986c, []int{1} } +// GovernorStatus is the status of a governor. +type GovernorStatus int32 + +const ( + // UNSPECIFIED defines an invalid governor status. + Unspecified GovernorStatus = 0 + // ACTIVE defines a governor that is active. + Active GovernorStatus = 1 + // INACTIVE defines a governor that is inactive. + Inactive GovernorStatus = 2 +) + +var GovernorStatus_name = map[int32]string{ + 0: "GOVERNOR_STATUS_UNSPECIFIED", + 1: "GOVERNOR_STATUS_ACTIVE", + 2: "GOVERNOR_STATUS_INACTIVE", +} + +var GovernorStatus_value = map[string]int32{ + "GOVERNOR_STATUS_UNSPECIFIED": 0, + "GOVERNOR_STATUS_ACTIVE": 1, + "GOVERNOR_STATUS_INACTIVE": 2, +} + +func (x GovernorStatus) String() string { + return proto.EnumName(GovernorStatus_name, int32(x)) +} + +func (GovernorStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{2} +} + // WeightedVoteOption defines a unit of vote for vote split. type WeightedVoteOption struct { // option defines the valid vote options, it must not contain duplicate vote @@ -1147,6 +1180,12 @@ type Params struct { ConstitutionAmendmentQuorumRange *QuorumRange `protobuf:"bytes,27,opt,name=constitution_amendment_quorum_range,json=constitutionAmendmentQuorumRange,proto3" json:"constitution_amendment_quorum_range,omitempty"` // Achievable quorum for law proposals LawQuorumRange *QuorumRange `protobuf:"bytes,28,opt,name=law_quorum_range,json=lawQuorumRange,proto3" json:"law_quorum_range,omitempty"` + // Defines the duration of time that need to elapse between governor status changes. + GovernorStatusChangePeriod *time.Duration `protobuf:"bytes,29,opt,name=governor_status_change_period,json=governorStatusChangePeriod,proto3,stdduration" json:"governor_status_change_period,omitempty"` + // Defines the minimum amound of bonded tokens, aka the "self-delegation" (because active governors + // must have the governance VP from the base account automatically delegated to them), that a governor + // must have to be considered active. + MinGovernorSelfDelegation string `protobuf:"bytes,30,opt,name=min_governor_self_delegation,json=minGovernorSelfDelegation,proto3" json:"min_governor_self_delegation,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -1341,6 +1380,20 @@ func (m *Params) GetLawQuorumRange() *QuorumRange { return nil } +func (m *Params) GetGovernorStatusChangePeriod() *time.Duration { + if m != nil { + return m.GovernorStatusChangePeriod + } + return nil +} + +func (m *Params) GetMinGovernorSelfDelegation() string { + if m != nil { + return m.MinGovernorSelfDelegation + } + return "" +} + type QuorumRange struct { // Maximum achievable quorum Max string `protobuf:"bytes,1,opt,name=max,proto3" json:"max,omitempty"` @@ -1395,9 +1448,223 @@ func (m *QuorumRange) GetMin() string { return "" } +// Governor defines a governor, together with the total amount of delegated +// validator's bond shares for a set amount of validators. When a delegator +// delegates a percentage of its x/gov power to a governor, the resulting +// shares from each delegators delegations in x/staking are added to the +// governor's total shares. +type Governor struct { + // governor_address defines the address of the governor; bech32-encoded. + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` + // status is the status of the governor (active/inactive). + Status GovernorStatus `protobuf:"varint,2,opt,name=status,proto3,enum=atomone.gov.v1.GovernorStatus" json:"status,omitempty"` + // description defines the description terms for the governor. + Description GovernorDescription `protobuf:"bytes,3,opt,name=description,proto3" json:"description"` + // last_status_change_time is the time when the governor's status was last changed. + LastStatusChangeTime *time.Time `protobuf:"bytes,4,opt,name=last_status_change_time,json=lastStatusChangeTime,proto3,stdtime" json:"last_status_change_time,omitempty"` +} + +func (m *Governor) Reset() { *m = Governor{} } +func (m *Governor) String() string { return proto.CompactTextString(m) } +func (*Governor) ProtoMessage() {} +func (*Governor) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{14} +} +func (m *Governor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Governor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Governor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Governor) XXX_Merge(src proto.Message) { + xxx_messageInfo_Governor.Merge(m, src) +} +func (m *Governor) XXX_Size() int { + return m.Size() +} +func (m *Governor) XXX_DiscardUnknown() { + xxx_messageInfo_Governor.DiscardUnknown(m) +} + +var xxx_messageInfo_Governor proto.InternalMessageInfo + +// Description defines a governor description. +type GovernorDescription struct { + // moniker defines a human-readable name for the governor. + Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity defines an optional identity signature (ex. UPort or Keybase). + Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` + // website defines an optional website link. + Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website,omitempty"` + // security_contact defines an optional email for security contact. + SecurityContact string `protobuf:"bytes,4,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty"` + // details define other optional details. + Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *GovernorDescription) Reset() { *m = GovernorDescription{} } +func (m *GovernorDescription) String() string { return proto.CompactTextString(m) } +func (*GovernorDescription) ProtoMessage() {} +func (*GovernorDescription) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{15} +} +func (m *GovernorDescription) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GovernorDescription) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GovernorDescription.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GovernorDescription) XXX_Merge(src proto.Message) { + xxx_messageInfo_GovernorDescription.Merge(m, src) +} +func (m *GovernorDescription) XXX_Size() int { + return m.Size() +} +func (m *GovernorDescription) XXX_DiscardUnknown() { + xxx_messageInfo_GovernorDescription.DiscardUnknown(m) +} + +var xxx_messageInfo_GovernorDescription proto.InternalMessageInfo + +func (m *GovernorDescription) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *GovernorDescription) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *GovernorDescription) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *GovernorDescription) GetSecurityContact() string { + if m != nil { + return m.SecurityContact + } + return "" +} + +func (m *GovernorDescription) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +// GovernorValShares holds the number of virtual shares from the +// specific validator that a governor can use to vote on proposals. +type GovernorValShares struct { + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + // shares define the delegation shares available from this validator. + Shares cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=shares,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"shares"` +} + +func (m *GovernorValShares) Reset() { *m = GovernorValShares{} } +func (m *GovernorValShares) String() string { return proto.CompactTextString(m) } +func (*GovernorValShares) ProtoMessage() {} +func (*GovernorValShares) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{16} +} +func (m *GovernorValShares) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GovernorValShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GovernorValShares.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GovernorValShares) XXX_Merge(src proto.Message) { + xxx_messageInfo_GovernorValShares.Merge(m, src) +} +func (m *GovernorValShares) XXX_Size() int { + return m.Size() +} +func (m *GovernorValShares) XXX_DiscardUnknown() { + xxx_messageInfo_GovernorValShares.DiscardUnknown(m) +} + +var xxx_messageInfo_GovernorValShares proto.InternalMessageInfo + +// GovernanceDelegation defines a delegation of governance voting power from a +// delegator to a governor. +type GovernanceDelegation struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + GovernorAddress string `protobuf:"bytes,2,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` +} + +func (m *GovernanceDelegation) Reset() { *m = GovernanceDelegation{} } +func (m *GovernanceDelegation) String() string { return proto.CompactTextString(m) } +func (*GovernanceDelegation) ProtoMessage() {} +func (*GovernanceDelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{17} +} +func (m *GovernanceDelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GovernanceDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GovernanceDelegation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GovernanceDelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_GovernanceDelegation.Merge(m, src) +} +func (m *GovernanceDelegation) XXX_Size() int { + return m.Size() +} +func (m *GovernanceDelegation) XXX_DiscardUnknown() { + xxx_messageInfo_GovernanceDelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_GovernanceDelegation proto.InternalMessageInfo + func init() { proto.RegisterEnum("atomone.gov.v1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("atomone.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) + proto.RegisterEnum("atomone.gov.v1.GovernorStatus", GovernorStatus_name, GovernorStatus_value) proto.RegisterType((*WeightedVoteOption)(nil), "atomone.gov.v1.WeightedVoteOption") proto.RegisterType((*Deposit)(nil), "atomone.gov.v1.Deposit") proto.RegisterType((*LastMinDeposit)(nil), "atomone.gov.v1.LastMinDeposit") @@ -1412,132 +1679,200 @@ func init() { proto.RegisterType((*MinInitialDepositThrottler)(nil), "atomone.gov.v1.MinInitialDepositThrottler") proto.RegisterType((*Params)(nil), "atomone.gov.v1.Params") proto.RegisterType((*QuorumRange)(nil), "atomone.gov.v1.QuorumRange") + proto.RegisterType((*Governor)(nil), "atomone.gov.v1.Governor") + proto.RegisterType((*GovernorDescription)(nil), "atomone.gov.v1.GovernorDescription") + proto.RegisterType((*GovernorValShares)(nil), "atomone.gov.v1.GovernorValShares") + proto.RegisterType((*GovernanceDelegation)(nil), "atomone.gov.v1.GovernanceDelegation") } func init() { proto.RegisterFile("atomone/gov/v1/gov.proto", fileDescriptor_ecf0f9950ff6986c) } var fileDescriptor_ecf0f9950ff6986c = []byte{ - // 1874 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0xbd, 0x6f, 0x1b, 0xc9, - 0x15, 0xd7, 0x8a, 0x14, 0x25, 0x3d, 0x8a, 0xd4, 0x6a, 0x24, 0xdb, 0x2b, 0xca, 0xa2, 0x74, 0xbc, - 0x43, 0xa0, 0x73, 0x6c, 0x32, 0xb2, 0x2f, 0x2e, 0x0e, 0x07, 0x04, 0x94, 0x48, 0x3b, 0x74, 0x6c, - 0x91, 0x5e, 0xd2, 0xba, 0x5c, 0x8a, 0x2c, 0x46, 0xdc, 0x31, 0xb5, 0x38, 0xee, 0x0c, 0xbd, 0x3b, - 0xa4, 0xc5, 0x94, 0xf9, 0x0b, 0x0e, 0x48, 0x93, 0xa4, 0x4a, 0x99, 0x32, 0xc5, 0x01, 0x69, 0xd3, - 0x04, 0xb8, 0xf2, 0x70, 0x45, 0x90, 0x34, 0x4e, 0x60, 0x17, 0x01, 0xfc, 0x2f, 0xa4, 0x09, 0xe6, - 0x63, 0xf9, 0x25, 0xd2, 0x92, 0x8c, 0x04, 0x08, 0xd2, 0x48, 0xbb, 0xf3, 0x7e, 0xbf, 0xf7, 0xde, - 0xcc, 0xfb, 0x98, 0xc7, 0x05, 0x0b, 0x73, 0xe6, 0x33, 0x4a, 0x0a, 0x2d, 0xd6, 0x2b, 0xf4, 0xf6, - 0xc5, 0xbf, 0x7c, 0x27, 0x60, 0x9c, 0xa1, 0xb4, 0x96, 0xe4, 0xc5, 0x52, 0x6f, 0x3f, 0x93, 0x6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 0x1e, 0x97, 0x4b, 0xe6, 0xc2, 0x34, 0xd9, 0x71, 0xb9, - 0x51, 0x2d, 0x97, 0xcc, 0xc4, 0xc1, 0xc3, 0x6f, 0x5e, 0x67, 0x8d, 0x6f, 0x5f, 0x67, 0x8d, 0x7f, - 0xbc, 0xce, 0x1a, 0x5f, 0xbd, 0xc9, 0xce, 0x7d, 0xfb, 0x26, 0x3b, 0xf7, 0xd7, 0x37, 0xd9, 0xb9, - 0x9f, 0xdd, 0x69, 0x79, 0xfc, 0xb4, 0x7b, 0x92, 0x6f, 0x32, 0xbf, 0xa0, 0xb3, 0xe1, 0xce, 0x69, - 0xf7, 0x24, 0x7a, 0x2e, 0x9c, 0xc9, 0x0f, 0xc0, 0xbc, 0xdf, 0x21, 0x61, 0xa1, 0xb7, 0x7f, 0x92, - 0x90, 0xcd, 0xe8, 0xde, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xca, 0x30, 0xd0, 0xe5, 0x1f, 0x16, + // 2322 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0xcd, 0x6f, 0x1b, 0xc7, + 0xd9, 0xd7, 0x92, 0x14, 0x25, 0x3d, 0x14, 0x29, 0x6a, 0x24, 0xdb, 0x2b, 0xca, 0xa2, 0x14, 0x26, + 0x08, 0x14, 0xbd, 0x31, 0x19, 0x39, 0x79, 0x73, 0x30, 0x02, 0x14, 0x94, 0xc8, 0xa8, 0x4c, 0x1d, + 0x91, 0x5e, 0xd2, 0x72, 0xd3, 0x43, 0x17, 0x23, 0xee, 0x88, 0x5a, 0x98, 0xbb, 0x43, 0xef, 0x0e, + 0x69, 0xb1, 0xc7, 0x9e, 0x02, 0xf7, 0x12, 0xb4, 0x97, 0xb6, 0xa8, 0x01, 0xa3, 0xbd, 0xf4, 0x98, + 0x83, 0x81, 0x5e, 0x7b, 0x29, 0x90, 0x63, 0xe0, 0x53, 0x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0xe8, 0x71, 0xe9, 0x48, 0x78, 0x57, + 0x42, 0xc3, 0x7b, 0x95, 0x33, 0x28, 0x41, 0xfb, 0x74, 0x18, 0xe8, 0x7d, 0x98, 0x57, 0x0e, 0xf4, + 0xb0, 0xdb, 0x22, 0x7a, 0x26, 0xfc, 0xb2, 0x2f, 0x73, 0xc9, 0xe0, 0x90, 0x53, 0xa2, 0x13, 0x0f, + 0x86, 0x44, 0xf4, 0x13, 0x78, 0xfb, 0xb5, 0xe5, 0xa4, 0xd4, 0xac, 0x5e, 0x5e, 0xcd, 0xc6, 0x6b, + 0xea, 0x4d, 0xea, 0xbe, 0x0b, 0xe9, 0x61, 0x69, 0x28, 0x45, 0xd7, 0x2f, 0xaf, 0x28, 0x35, 0xa8, + 0x1d, 0x29, 0xf6, 0x10, 0xd6, 0x5a, 0xb4, 0x47, 0x3c, 0x97, 0x7a, 0xa6, 0x7c, 0x28, 0x31, 0x9b, + 0xc7, 0x9c, 0x12, 0x74, 0xf1, 0xb5, 0x8b, 0x65, 0x71, 0x26, 0x90, 0x22, 0x5f, 0x5d, 0x76, 0x85, + 0x0c, 0xd5, 0xd3, 0xab, 0x70, 0x9d, 0x27, 0xd0, 0x50, 0x0f, 0x69, 0x1f, 0x99, 0x16, 0x69, 0x93, + 0x96, 0xbc, 0x30, 0x67, 0x43, 0xef, 0x97, 0xbc, 0x5f, 0xef, 0x05, 0x42, 0x49, 0xfb, 0xa8, 0x34, + 0x60, 0xc8, 0xdd, 0x81, 0xc4, 0xe8, 0x1e, 0x36, 0x20, 0xea, 0xe0, 0x93, 0x90, 0x7b, 0x30, 0xdf, + 0x30, 0x27, 0x09, 0x84, 0xed, 0x9e, 0x31, 0xae, 0x73, 0x52, 0xee, 0xb7, 0x11, 0x98, 0x0d, 0xb4, + 0xf1, 0xb9, 0x62, 0x60, 0x2c, 0x96, 0x17, 0x53, 0x29, 0xdd, 0x58, 0x08, 0xd6, 0xd5, 0x7d, 0x75, + 0xe4, 0x35, 0x2a,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x77, 0x0f, 0xf3, 0x4d, 0xea, 0x14, 0x54, 0xab, 0xbb, 0x71, 0xdc, + 0x3d, 0x0c, 0x7e, 0x17, 0x4e, 0xc4, 0xdf, 0xa9, 0x58, 0xbf, 0x43, 0xfc, 0x42, 0x6f, 0xfb, 0x30, + 0x2e, 0x3a, 0xd5, 0x87, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x90, 0x75, 0x9d, 0xae, 0xc6, 0x1a, 0x00, 0x00, } +func (this *GovernorDescription) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GovernorDescription) + if !ok { + that2, ok := that.(GovernorDescription) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Moniker != that1.Moniker { + return false + } + if this.Identity != that1.Identity { + return false + } + if this.Website != that1.Website { + return false + } + if this.SecurityContact != that1.SecurityContact { + return false + } + if this.Details != that1.Details { + return false + } + return true +} func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2284,6 +2619,27 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.MinGovernorSelfDelegation) > 0 { + i -= len(m.MinGovernorSelfDelegation) + copy(dAtA[i:], m.MinGovernorSelfDelegation) + i = encodeVarintGov(dAtA, i, uint64(len(m.MinGovernorSelfDelegation))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xf2 + } + if m.GovernorStatusChangePeriod != nil { + n12, err12 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.GovernorStatusChangePeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.GovernorStatusChangePeriod):]) + if err12 != nil { + return 0, err12 + } + i -= n12 + i = encodeVarintGov(dAtA, i, uint64(n12)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xea + } if m.LawQuorumRange != nil { { size, err := m.LawQuorumRange.MarshalToSizedBuffer(dAtA[:i]) @@ -2371,24 +2727,24 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xb0 } if m.MaxVotingPeriodExtension != nil { - n17, err17 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxVotingPeriodExtension, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxVotingPeriodExtension):]) - if err17 != nil { - return 0, err17 + n18, err18 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxVotingPeriodExtension, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxVotingPeriodExtension):]) + if err18 != nil { + return 0, err18 } - i -= n17 - i = encodeVarintGov(dAtA, i, uint64(n17)) + i -= n18 + i = encodeVarintGov(dAtA, i, uint64(n18)) i-- dAtA[i] = 0x1 i-- dAtA[i] = 0xaa } if m.QuorumTimeout != nil { - n18, err18 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.QuorumTimeout, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.QuorumTimeout):]) - if err18 != nil { - return 0, err18 + n19, err19 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.QuorumTimeout, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.QuorumTimeout):]) + if err19 != nil { + return 0, err19 } - i -= n18 - i = encodeVarintGov(dAtA, i, uint64(n18)) + i -= n19 + i = encodeVarintGov(dAtA, i, uint64(n19)) i-- dAtA[i] = 0x1 i-- @@ -2479,22 +2835,22 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } if m.VotingPeriod != nil { - n19, err19 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) - if err19 != nil { - return 0, err19 + n20, err20 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err20 != nil { + return 0, err20 } - i -= n19 - i = encodeVarintGov(dAtA, i, uint64(n19)) + i -= n20 + i = encodeVarintGov(dAtA, i, uint64(n20)) i-- dAtA[i] = 0x1a } if m.MaxDepositPeriod != nil { - n20, err20 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) - if err20 != nil { - return 0, err20 + n21, err21 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err21 != nil { + return 0, err21 } - i -= n20 - i = encodeVarintGov(dAtA, i, uint64(n20)) + i -= n21 + i = encodeVarintGov(dAtA, i, uint64(n21)) i-- dAtA[i] = 0x12 } @@ -2552,64 +2908,261 @@ func (m *QuorumRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintGov(dAtA []byte, offset int, v uint64) int { - offset -= sovGov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *Governor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *WeightedVoteOption) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Option != 0 { - n += 1 + sovGov(uint64(m.Option)) - } - l = len(m.Weight) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - return n + +func (m *Governor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Deposit) Size() (n int) { - if m == nil { - return 0 - } +func (m *Governor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.ProposalId != 0 { - n += 1 + sovGov(uint64(m.ProposalId)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) + if m.LastStatusChangeTime != nil { + n22, err22 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.LastStatusChangeTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.LastStatusChangeTime):]) + if err22 != nil { + return 0, err22 + } + i -= n22 + i = encodeVarintGov(dAtA, i, uint64(n22)) + i-- + dAtA[i] = 0x22 } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0x1a + if m.Status != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintGov(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *LastMinDeposit) Size() (n int) { - if m == nil { - return 0 +func (m *GovernorDescription) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *GovernorDescription) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GovernorDescription) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Value) > 0 { - for _, e := range m.Value { - l = e.Size() + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintGov(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x2a + } + if len(m.SecurityContact) > 0 { + i -= len(m.SecurityContact) + copy(dAtA[i:], m.SecurityContact) + i = encodeVarintGov(dAtA, i, uint64(len(m.SecurityContact))) + i-- + dAtA[i] = 0x22 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintGov(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x1a + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintGov(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x12 + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintGov(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GovernorValShares) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GovernorValShares) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GovernorValShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Shares.Size() + i -= size + if _, err := m.Shares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintGov(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintGov(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GovernanceDelegation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GovernanceDelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GovernanceDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintGov(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintGov(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGov(dAtA []byte, offset int, v uint64) int { + offset -= sovGov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *WeightedVoteOption) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Option != 0 { + n += 1 + sovGov(uint64(m.Option)) + } + l = len(m.Weight) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *Deposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + return n +} + +func (m *LastMinDeposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Value) > 0 { + for _, e := range m.Value { + l = e.Size() n += 1 + l + sovGov(uint64(l)) } } @@ -2983,6 +3536,14 @@ func (m *Params) Size() (n int) { l = m.LawQuorumRange.Size() n += 2 + l + sovGov(uint64(l)) } + if m.GovernorStatusChangePeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.GovernorStatusChangePeriod) + n += 2 + l + sovGov(uint64(l)) + } + l = len(m.MinGovernorSelfDelegation) + if l > 0 { + n += 2 + l + sovGov(uint64(l)) + } return n } @@ -3003,6 +3564,93 @@ func (m *QuorumRange) Size() (n int) { return n } +func (m *Governor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovGov(uint64(m.Status)) + } + l = m.Description.Size() + n += 1 + l + sovGov(uint64(l)) + if m.LastStatusChangeTime != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.LastStatusChangeTime) + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *GovernorDescription) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.SecurityContact) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *GovernorValShares) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = m.Shares.Size() + n += 1 + l + sovGov(uint64(l)) + return n +} + +func (m *GovernanceDelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + func sovGov(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -5963,61 +6611,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QuorumRange) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QuorumRange: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuorumRange: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 29: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Max", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GovernorStatusChangePeriod", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -6027,7 +6625,125 @@ func (m *QuorumRange) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.GovernorStatusChangePeriod == nil { + m.GovernorStatusChangePeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.GovernorStatusChangePeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 30: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinGovernorSelfDelegation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinGovernorSelfDelegation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuorumRange) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuorumRange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuorumRange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Max", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -6098,6 +6814,648 @@ func (m *QuorumRange) Unmarshal(dAtA []byte) error { } return nil } +func (m *Governor) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Governor: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Governor: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= GovernorStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastStatusChangeTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LastStatusChangeTime == nil { + m.LastStatusChangeTime = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.LastStatusChangeTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GovernorDescription) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GovernorDescription: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GovernorDescription: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecurityContact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GovernorValShares) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GovernorValShares: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GovernorValShares: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Shares", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Shares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GovernanceDelegation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GovernanceDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GovernanceDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipGov(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/gov/types/v1/governor.go b/x/gov/types/v1/governor.go new file mode 100644 index 00000000..eeb0cd52 --- /dev/null +++ b/x/gov/types/v1/governor.go @@ -0,0 +1,165 @@ +package v1 + +import ( + time "time" + + "cosmossdk.io/errors" + + "github.com/cosmos/cosmos-sdk/codec" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/atomone-hub/atomone/x/gov/types" +) + +var ( + GovernorStatusUnspecified = GovernorStatus_name[int32(Unspecified)] + GovernorStatusActive = GovernorStatus_name[int32(Active)] + GovernorStatusInactive = GovernorStatus_name[int32(Inactive)] +) + +var _ GovernorI = Governor{} + +// NewGovernor constructs a new Governor +func NewGovernor(address string, description GovernorDescription, creationTime time.Time) (Governor, error) { + return Governor{ + GovernorAddress: address, + Description: description, + Status: Active, + LastStatusChangeTime: &creationTime, + }, nil +} + +func MustMarshalGovernor(cdc codec.BinaryCodec, governor *Governor) []byte { + return cdc.MustMarshal(governor) +} + +func MustUnmarshalGovernor(cdc codec.BinaryCodec, value []byte) Governor { + governor, err := UnmarshalGovernor(cdc, value) + if err != nil { + panic(err) + } + + return governor +} + +// unmarshal a redelegation from a store value +func UnmarshalGovernor(cdc codec.BinaryCodec, value []byte) (g Governor, err error) { + err = cdc.Unmarshal(value, &g) + return g, err +} + +// IsActive checks if the governor status equals Active +func (g Governor) IsActive() bool { + return g.GetStatus() == Active +} + +// IsInactive checks if the governor status equals Inactive +func (g Governor) IsInactive() bool { + return g.GetStatus() == Inactive +} + +func NewGovernorDescription(moniker, identity, website, securityContact, details string) GovernorDescription { + return GovernorDescription{ + Moniker: moniker, + Identity: identity, + Website: website, + SecurityContact: securityContact, + Details: details, + } +} + +// UpdateDescription updates the fields of a given description. An error is +// returned if the resulting description contains an invalid length. +func (d GovernorDescription) UpdateDescription(d2 GovernorDescription) (GovernorDescription, error) { + if d2.Moniker == stakingtypes.DoNotModifyDesc { + d2.Moniker = d.Moniker + } + + if d2.Identity == stakingtypes.DoNotModifyDesc { + d2.Identity = d.Identity + } + + if d2.Website == stakingtypes.DoNotModifyDesc { + d2.Website = d.Website + } + + if d2.SecurityContact == stakingtypes.DoNotModifyDesc { + d2.SecurityContact = d.SecurityContact + } + + if d2.Details == stakingtypes.DoNotModifyDesc { + d2.Details = d.Details + } + + return NewGovernorDescription( + d2.Moniker, + d2.Identity, + d2.Website, + d2.SecurityContact, + d2.Details, + ).EnsureLength() +} + +// EnsureLength ensures the length of a vovernor's description. +func (d GovernorDescription) EnsureLength() (GovernorDescription, error) { + if len(d.Moniker) > stakingtypes.MaxMonikerLength { + return d, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid moniker length; got: %d, max: %d", len(d.Moniker), stakingtypes.MaxMonikerLength) + } + + if len(d.Identity) > stakingtypes.MaxIdentityLength { + return d, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid identity length; got: %d, max: %d", len(d.Identity), stakingtypes.MaxIdentityLength) + } + + if len(d.Website) > stakingtypes.MaxWebsiteLength { + return d, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid website length; got: %d, max: %d", len(d.Website), stakingtypes.MaxWebsiteLength) + } + + if len(d.SecurityContact) > stakingtypes.MaxSecurityContactLength { + return d, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid security contact length; got: %d, max: %d", len(d.SecurityContact), stakingtypes.MaxSecurityContactLength) + } + + if len(d.Details) > stakingtypes.MaxDetailsLength { + return d, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid details length; got: %d, max: %d", len(d.Details), stakingtypes.MaxDetailsLength) + } + + return d, nil +} + +func (s GovernorStatus) IsValid() bool { + return s == Active || s == Inactive +} + +// GovernorStatusFromString returns a GovernorStatus from a string. It returns an +// error if the string is invalid. +func GovernorStatusFromString(str string) (GovernorStatus, error) { + switch str { + case GovernorStatusActive: + return Active, nil + case GovernorStatusInactive: + return Inactive, nil + default: + return Unspecified, types.ErrInvalidGovernorStatus.Wrapf("unrecognized governor status %s", str) + } +} + +// MinEqual defines a more minimum set of equality conditions when comparing two +// governors. +func (g *Governor) MinEqual(other *Governor) bool { + return g.GovernorAddress == other.GovernorAddress && + g.Status == other.Status && + g.Description.Equal(other.Description) +} + +// Equal checks if the receiver equals the parameter +func (g *Governor) Equal(v2 *Governor) bool { + return g.MinEqual(v2) +} + +func (g Governor) GetMoniker() string { return g.Description.Moniker } +func (g Governor) GetStatus() GovernorStatus { return g.Status } +func (g Governor) GetDescription() GovernorDescription { return g.Description } +func (g Governor) GetLastStatusChangeTime() *time.Time { return g.LastStatusChangeTime } +func (g Governor) GetAddress() types.GovernorAddress { + return types.MustGovernorAddressFromBech32(g.GovernorAddress) +} diff --git a/x/gov/types/v1/msgs.go b/x/gov/types/v1/msgs.go index e532a877..cd4582bc 100644 --- a/x/gov/types/v1/msgs.go +++ b/x/gov/types/v1/msgs.go @@ -266,3 +266,108 @@ func (msg MsgProposeLaw) ValidateBasic() error { return nil } + +// NewMsgCreateGovernor creates a new MsgCreateGovernor instance +func NewMsgCreateGovernor(address sdk.AccAddress, description GovernorDescription) *MsgCreateGovernor { + return &MsgCreateGovernor{Address: address.String(), Description: description} +} + +// Route implements the sdk.Msg interface. +func (msg MsgCreateGovernor) Route() string { return types.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgCreateGovernor) Type() string { return sdk.MsgTypeURL(&msg) } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgCreateGovernor) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return sdkerrors.ErrInvalidAddress.Wrap(err.Error()) + } + + if _, err := msg.Description.EnsureLength(); err != nil { + return types.ErrInvalidGovernanceDescription.Wrap(err.Error()) + } + return nil +} + +// NewMsgEditGovernor creates a new MsgEditGovernor instance +func NewMsgEditGovernor(addr sdk.AccAddress, description GovernorDescription) *MsgEditGovernor { + return &MsgEditGovernor{Address: addr.String(), Description: description} +} + +// Route implements the sdk.Msg interface. +func (msg MsgEditGovernor) Route() string { return types.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgEditGovernor) Type() string { return sdk.MsgTypeURL(&msg) } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgEditGovernor) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return sdkerrors.ErrInvalidAddress.Wrap(err.Error()) + } + return nil +} + +// NewMsgDelegateGovernor creates a new MsgDelegateGovernor instance +func NewMsgDelegateGovernor(delegator sdk.AccAddress, governor types.GovernorAddress) *MsgDelegateGovernor { + return &MsgDelegateGovernor{DelegatorAddress: delegator.String(), GovernorAddress: governor.String()} +} + +// Route implements the sdk.Msg interface. +func (msg MsgDelegateGovernor) Route() string { return types.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgDelegateGovernor) Type() string { return sdk.MsgTypeURL(&msg) } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgDelegateGovernor) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrap(err.Error()) + } + if _, err := types.GovernorAddressFromBech32(msg.GovernorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid governor address: %s", err) + } + return nil +} + +// NewMsgUndelegateGovernor creates a new MsgUndelegateGovernor instance +func NewMsgUndelegateGovernor(delegator sdk.AccAddress) *MsgUndelegateGovernor { + return &MsgUndelegateGovernor{DelegatorAddress: delegator.String()} +} + +// Route implements the sdk.Msg interface. +func (msg MsgUndelegateGovernor) Route() string { return types.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgUndelegateGovernor) Type() string { return sdk.MsgTypeURL(&msg) } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgUndelegateGovernor) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrap(err.Error()) + } + return nil +} + +// NewMsgUpdateGovernorStatus creates a new MsgUpdateGovernorStatus instance +func NewMsgUpdateGovernorStatus(address sdk.AccAddress, status GovernorStatus) *MsgUpdateGovernorStatus { + return &MsgUpdateGovernorStatus{Address: address.String(), Status: status} +} + +// Route implements the sdk.Msg interface. +func (msg MsgUpdateGovernorStatus) Route() string { return types.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgUpdateGovernorStatus) Type() string { return sdk.MsgTypeURL(&msg) } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgUpdateGovernorStatus) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return sdkerrors.ErrInvalidAddress.Wrap(err.Error()) + } + if !msg.Status.IsValid() { + return types.ErrInvalidGovernorStatus.Wrap(msg.Status.String()) + } + return nil +} diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index 738103c9..90e7aa38 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -21,6 +21,10 @@ const ( // value would make the throttler too little sensitive to the distance // from the target when decreasing the deposit. MaxDecreaseSensitivityTargetDistanceDepositThrottler = 100 + + // DefaultGovernorStatusChangePeriod is the default period that has to pass + // before a governor can change their status (e.g. from active to inactive). + DefaultGovernorStatusChangePeriod time.Duration = time.Hour * 24 * 28 // 28 days ) // MinVotingPeriod is set in stone by the constitution at 21 days, but it can @@ -68,6 +72,8 @@ var ( DefaultMinInitialDepositDecreaseRatio = math.LegacyNewDecWithPrec(5, 3) DefaultTargetProposalsInDepositPeriod uint64 = 5 DefaultBurnDepositNoThreshold = math.LegacyNewDecWithPrec(80, 2) + DefaultMaxGovernors uint64 = 100 + DefaultMinGovernorSelfDelegation = math.NewInt(1000_000000) ) // Deprecated: NewDepositParams creates a new DepositParams object @@ -116,6 +122,7 @@ func NewParams( maxQuorum string, minQuorum string, maxConstitutionAmendmentQuorum string, minConstitutionAmendmentQuorum string, maxLawQuorum string, minLawQuorum string, + governorStatusChangePeriod time.Duration, minGovernorSelfDelegation string, ) Params { return Params{ // MinDeposit: minDeposit, // Deprecated in favor of dynamic min deposit @@ -160,6 +167,8 @@ func NewParams( Max: maxLawQuorum, Min: minLawQuorum, }, + GovernorStatusChangePeriod: &governorStatusChangePeriod, + MinGovernorSelfDelegation: minGovernorSelfDelegation, } } @@ -198,6 +207,8 @@ func DefaultParams() Params { DefaultMinConstitutionAmendmentQuorum.String(), DefaultMaxLawQuorum.String(), DefaultMinLawQuorum.String(), + DefaultGovernorStatusChangePeriod, + DefaultMinGovernorSelfDelegation.String(), ) } @@ -477,6 +488,22 @@ func (p Params) ValidateBasic() error { return fmt.Errorf("burnDepositNoThreshold too large: %s", burnDepositNoThreshold) } + if p.GovernorStatusChangePeriod == nil { + return fmt.Errorf("governor status change period must not be nil: %d", p.GovernorStatusChangePeriod) + } + + if p.GovernorStatusChangePeriod.Seconds() <= 0 { + return fmt.Errorf("governor status change period must be positive: %d", p.GovernorStatusChangePeriod) + } + + minGovernorSelfDelegation, ok := math.NewIntFromString(p.MinGovernorSelfDelegation) + if !ok { + return fmt.Errorf("invalid minimum governor self delegation: %s", p.MinGovernorSelfDelegation) + } + if minGovernorSelfDelegation.IsNegative() { + return fmt.Errorf("minimum governor self delegation must be positive: %s", minGovernorSelfDelegation) + } + return nil } diff --git a/x/gov/types/v1/query.pb.go b/x/gov/types/v1/query.pb.go index 60310a0b..330c4d6c 100644 --- a/x/gov/types/v1/query.pb.go +++ b/x/gov/types/v1/query.pb.go @@ -1347,1178 +1347,1473 @@ func (m *QueryParticipationEMAsResponse) GetLawParticipationEma() string { return "" } -func init() { - proto.RegisterType((*QueryConstitutionRequest)(nil), "atomone.gov.v1.QueryConstitutionRequest") - proto.RegisterType((*QueryConstitutionResponse)(nil), "atomone.gov.v1.QueryConstitutionResponse") - proto.RegisterType((*QueryProposalRequest)(nil), "atomone.gov.v1.QueryProposalRequest") - proto.RegisterType((*QueryProposalResponse)(nil), "atomone.gov.v1.QueryProposalResponse") - proto.RegisterType((*QueryProposalsRequest)(nil), "atomone.gov.v1.QueryProposalsRequest") - proto.RegisterType((*QueryProposalsResponse)(nil), "atomone.gov.v1.QueryProposalsResponse") - proto.RegisterType((*QueryVoteRequest)(nil), "atomone.gov.v1.QueryVoteRequest") - proto.RegisterType((*QueryVoteResponse)(nil), "atomone.gov.v1.QueryVoteResponse") - proto.RegisterType((*QueryVotesRequest)(nil), "atomone.gov.v1.QueryVotesRequest") - proto.RegisterType((*QueryVotesResponse)(nil), "atomone.gov.v1.QueryVotesResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "atomone.gov.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "atomone.gov.v1.QueryParamsResponse") - proto.RegisterType((*QueryDepositRequest)(nil), "atomone.gov.v1.QueryDepositRequest") - proto.RegisterType((*QueryDepositResponse)(nil), "atomone.gov.v1.QueryDepositResponse") - proto.RegisterType((*QueryDepositsRequest)(nil), "atomone.gov.v1.QueryDepositsRequest") - proto.RegisterType((*QueryDepositsResponse)(nil), "atomone.gov.v1.QueryDepositsResponse") - proto.RegisterType((*QueryTallyResultRequest)(nil), "atomone.gov.v1.QueryTallyResultRequest") - proto.RegisterType((*QueryTallyResultResponse)(nil), "atomone.gov.v1.QueryTallyResultResponse") - proto.RegisterType((*QueryMinDepositRequest)(nil), "atomone.gov.v1.QueryMinDepositRequest") - proto.RegisterType((*QueryMinDepositResponse)(nil), "atomone.gov.v1.QueryMinDepositResponse") - proto.RegisterType((*QueryMinInitialDepositRequest)(nil), "atomone.gov.v1.QueryMinInitialDepositRequest") - proto.RegisterType((*QueryMinInitialDepositResponse)(nil), "atomone.gov.v1.QueryMinInitialDepositResponse") - proto.RegisterType((*QueryQuorumsRequest)(nil), "atomone.gov.v1.QueryQuorumsRequest") - proto.RegisterType((*QueryQuorumsResponse)(nil), "atomone.gov.v1.QueryQuorumsResponse") - proto.RegisterType((*QueryParticipationEMAsRequest)(nil), "atomone.gov.v1.QueryParticipationEMAsRequest") - proto.RegisterType((*QueryParticipationEMAsResponse)(nil), "atomone.gov.v1.QueryParticipationEMAsResponse") +// QueryGovernorRequest is the request type for the Query/Governor RPC method. +type QueryGovernorRequest struct { + // gvernor_address defines the address of the governor. + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` } -func init() { proto.RegisterFile("atomone/gov/v1/query.proto", fileDescriptor_2290d0188dd70223) } - -var fileDescriptor_2290d0188dd70223 = []byte{ - // 1398 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcf, 0x6f, 0xd4, 0xc6, - 0x17, 0x8f, 0x37, 0x3f, 0x48, 0x5e, 0xc2, 0x7e, 0xc9, 0x10, 0x60, 0x63, 0xc2, 0x06, 0x4c, 0x48, - 0x02, 0xfa, 0xae, 0xdd, 0x0d, 0x05, 0xaa, 0xb6, 0xb4, 0x65, 0x49, 0x48, 0x73, 0x88, 0x1a, 0x0c, - 0xea, 0xa1, 0x3d, 0xac, 0x9c, 0x5d, 0xcb, 0x58, 0x5a, 0x7b, 0x9c, 0xb5, 0x77, 0xd3, 0x28, 0x8d, - 0x50, 0x2b, 0x55, 0x2a, 0x9c, 0xa8, 0xaa, 0xaa, 0x2a, 0x52, 0xff, 0x0b, 0x2e, 0x3d, 0xf6, 0xc6, - 0x11, 0xd1, 0x4b, 0x4f, 0x55, 0x95, 0xf4, 0x0f, 0xa9, 0x3c, 0xf3, 0xec, 0xb5, 0xbd, 0xf6, 0xee, - 0x06, 0xa1, 0xde, 0x76, 0x67, 0x3e, 0xef, 0xf3, 0x3e, 0xf3, 0x99, 0x37, 0x33, 0x4f, 0x06, 0x51, - 0xf3, 0xa8, 0x45, 0x6d, 0x5d, 0x31, 0x68, 0x5b, 0x69, 0x97, 0x95, 0x9d, 0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xf2, 0x8d, 0x00, 0xd0, 0x79, 0xf6, 0x49, 0xfa, 0xd1, 0xed, 0xea, 0x18, 0xc4, 0xa5, - 0xbe, 0x38, 0x94, 0x25, 0x31, 0x59, 0x73, 0x44, 0x4c, 0xca, 0xb2, 0x4c, 0x1b, 0xed, 0x21, 0xbf, - 0x0a, 0x30, 0xdd, 0xf5, 0xf8, 0x93, 0x52, 0x56, 0x8a, 0xd4, 0x2e, 0x42, 0x94, 0x07, 0x85, 0xa3, - 0xb0, 0xab, 0x4c, 0xd8, 0x65, 0x72, 0x29, 0x45, 0x18, 0x36, 0x1a, 0x81, 0xbe, 0x16, 0x9c, 0xc0, - 0x86, 0x20, 0xa3, 0xda, 0xe3, 0x6d, 0x44, 0x46, 0xb5, 0x27, 0x7a, 0x0a, 0x69, 0x9e, 0x09, 0x98, - 0x25, 0xe7, 0x94, 0xae, 0xaf, 0x4d, 0x3c, 0x97, 0x6f, 0x4b, 0xd7, 0x1b, 0x9d, 0x61, 0x4b, 0xd6, - 0x6b, 0x9f, 0x61, 0x4b, 0xe6, 0xd3, 0x9f, 0x6d, 0x4b, 0xec, 0x99, 0xd5, 0x2d, 0xcd, 0xad, 0xac, - 0xbf, 0x3c, 0x2c, 0x0a, 0xaf, 0x0e, 0x8b, 0xc2, 0xdf, 0x87, 0x45, 0xe1, 0xd9, 0x51, 0x71, 0xe8, - 0xd5, 0x51, 0x71, 0xe8, 0xcf, 0xa3, 0xe2, 0xd0, 0x17, 0x25, 0xc3, 0xf4, 0x1e, 0xb5, 0xb6, 0xe5, - 0x1a, 0xb5, 0x02, 0x9a, 0xd2, 0xa3, 0xd6, 0x76, 0x48, 0xf9, 0x15, 0x23, 0xf5, 0xef, 0x12, 0x57, - 0x69, 0x97, 0xb7, 0xc7, 0xd8, 0x47, 0xa9, 0xeb, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x20, 0x0d, - 0x08, 0x42, 0x77, 0x13, 0x00, 0x00, +func (m *QueryGovernorRequest) Reset() { *m = QueryGovernorRequest{} } +func (m *QueryGovernorRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorRequest) ProtoMessage() {} +func (*QueryGovernorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{26} +} +func (m *QueryGovernorRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGovernorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorRequest.Merge(m, src) +} +func (m *QueryGovernorRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorRequest.DiscardUnknown(m) } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 +var xxx_messageInfo_QueryGovernorRequest proto.InternalMessageInfo -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Constitution queries the chain's constitution. - Constitution(ctx context.Context, in *QueryConstitutionRequest, opts ...grpc.CallOption) (*QueryConstitutionResponse, error) - // Proposal queries proposal details based on ProposalID. - Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) - // Proposals queries all proposals based on given status. - Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) - // Vote queries voted information based on proposalID, voterAddr. - Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) - // Votes queries votes of a given proposal. - Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) - // Params queries all parameters of the gov module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Deposit queries single deposit information based proposalID, depositAddr. - Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) - // Deposits queries all deposits of a single proposal. - Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) - // TallyResult queries the tally of a proposal vote. - TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) - // MinDeposit queries the minimum deposit currently - // required for a proposal to enter voting period. - MinDeposit(ctx context.Context, in *QueryMinDepositRequest, opts ...grpc.CallOption) (*QueryMinDepositResponse, error) - // MinInitialDeposit queries the minimum initial deposit - // currently required for a proposal to be submitted. - MinInitialDeposit(ctx context.Context, in *QueryMinInitialDepositRequest, opts ...grpc.CallOption) (*QueryMinInitialDepositResponse, error) - // Quorums queries the dynamically set quorums. - Quorums(ctx context.Context, in *QueryQuorumsRequest, opts ...grpc.CallOption) (*QueryQuorumsResponse, error) - // ParticipationEMAs queries the state of the proposal participation exponential moving averages. - ParticipationEMAs(ctx context.Context, in *QueryParticipationEMAsRequest, opts ...grpc.CallOption) (*QueryParticipationEMAsResponse, error) +func (m *QueryGovernorRequest) GetGovernorAddress() string { + if m != nil { + return m.GovernorAddress + } + return "" } -type queryClient struct { - cc grpc1.ClientConn +// QueryGovernorResponse is the response type for the Query/Governor RPC method. +type QueryGovernorResponse struct { + // governor defines the requested governor. + Governor *Governor `protobuf:"bytes,1,opt,name=governor,proto3" json:"governor,omitempty"` } -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} +func (m *QueryGovernorResponse) Reset() { *m = QueryGovernorResponse{} } +func (m *QueryGovernorResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorResponse) ProtoMessage() {} +func (*QueryGovernorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{27} } - -func (c *queryClient) Constitution(ctx context.Context, in *QueryConstitutionRequest, opts ...grpc.CallOption) (*QueryConstitutionResponse, error) { - out := new(QueryConstitutionResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Constitution", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGovernorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) { - out := new(QueryProposalResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Proposal", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGovernorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryGovernorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorResponse.Merge(m, src) +} +func (m *QueryGovernorResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorResponse.DiscardUnknown(m) } -func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) { - out := new(QueryProposalsResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Proposals", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryGovernorResponse proto.InternalMessageInfo + +func (m *QueryGovernorResponse) GetGovernor() *Governor { + if m != nil { + return m.Governor } - return out, nil + return nil } -func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) { - out := new(QueryVoteResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Vote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +// QueryGovernorsRequest is the request type for the Query/Governors RPC method. +type QueryGovernorsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) { - out := new(QueryVotesResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Votes", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGovernorsRequest) Reset() { *m = QueryGovernorsRequest{} } +func (m *QueryGovernorsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorsRequest) ProtoMessage() {} +func (*QueryGovernorsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{28} +} +func (m *QueryGovernorsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryGovernorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorsRequest.Merge(m, src) +} +func (m *QueryGovernorsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorsRequest.DiscardUnknown(m) } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryGovernorsRequest proto.InternalMessageInfo + +func (m *QueryGovernorsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination } - return out, nil + return nil } -func (c *queryClient) Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) { - out := new(QueryDepositResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Deposit", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +// QueryGovernorsResponse is the response type for the Query/Governors RPC method. +type QueryGovernorsResponse struct { + // governors defines the requested governors. + Governors []*Governor `protobuf:"bytes,1,rep,name=governors,proto3" json:"governors,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) { - out := new(QueryDepositsResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Deposits", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGovernorsResponse) Reset() { *m = QueryGovernorsResponse{} } +func (m *QueryGovernorsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorsResponse) ProtoMessage() {} +func (*QueryGovernorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{29} +} +func (m *QueryGovernorsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryGovernorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorsResponse.Merge(m, src) +} +func (m *QueryGovernorsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorsResponse.DiscardUnknown(m) } -func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) { - out := new(QueryTallyResultResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/TallyResult", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryGovernorsResponse proto.InternalMessageInfo + +func (m *QueryGovernorsResponse) GetGovernors() []*Governor { + if m != nil { + return m.Governors } - return out, nil + return nil } -func (c *queryClient) MinDeposit(ctx context.Context, in *QueryMinDepositRequest, opts ...grpc.CallOption) (*QueryMinDepositResponse, error) { - out := new(QueryMinDepositResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/MinDeposit", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGovernorsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination } - return out, nil + return nil } -func (c *queryClient) MinInitialDeposit(ctx context.Context, in *QueryMinInitialDepositRequest, opts ...grpc.CallOption) (*QueryMinInitialDepositResponse, error) { - out := new(QueryMinInitialDepositResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/MinInitialDeposit", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +// QueryGovernanceDelegationsRequest is the request type for the Query/GovernanceDelegations RPC method. +type QueryGovernanceDelegationsRequest struct { + // governor_address defines the address of the governor. + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (c *queryClient) Quorums(ctx context.Context, in *QueryQuorumsRequest, opts ...grpc.CallOption) (*QueryQuorumsResponse, error) { - out := new(QueryQuorumsResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Quorums", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGovernanceDelegationsRequest) Reset() { *m = QueryGovernanceDelegationsRequest{} } +func (m *QueryGovernanceDelegationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGovernanceDelegationsRequest) ProtoMessage() {} +func (*QueryGovernanceDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{30} +} +func (m *QueryGovernanceDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernanceDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernanceDelegationsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryGovernanceDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernanceDelegationsRequest.Merge(m, src) +} +func (m *QueryGovernanceDelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernanceDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernanceDelegationsRequest.DiscardUnknown(m) } -func (c *queryClient) ParticipationEMAs(ctx context.Context, in *QueryParticipationEMAsRequest, opts ...grpc.CallOption) (*QueryParticipationEMAsResponse, error) { - out := new(QueryParticipationEMAsResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/ParticipationEMAs", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryGovernanceDelegationsRequest proto.InternalMessageInfo + +func (m *QueryGovernanceDelegationsRequest) GetGovernorAddress() string { + if m != nil { + return m.GovernorAddress } - return out, nil + return "" } -// QueryServer is the server API for Query service. -type QueryServer interface { - // Constitution queries the chain's constitution. - Constitution(context.Context, *QueryConstitutionRequest) (*QueryConstitutionResponse, error) - // Proposal queries proposal details based on ProposalID. - Proposal(context.Context, *QueryProposalRequest) (*QueryProposalResponse, error) - // Proposals queries all proposals based on given status. - Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error) - // Vote queries voted information based on proposalID, voterAddr. - Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error) - // Votes queries votes of a given proposal. - Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error) - // Params queries all parameters of the gov module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Deposit queries single deposit information based proposalID, depositAddr. - Deposit(context.Context, *QueryDepositRequest) (*QueryDepositResponse, error) - // Deposits queries all deposits of a single proposal. - Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) - // TallyResult queries the tally of a proposal vote. - TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) - // MinDeposit queries the minimum deposit currently - // required for a proposal to enter voting period. - MinDeposit(context.Context, *QueryMinDepositRequest) (*QueryMinDepositResponse, error) - // MinInitialDeposit queries the minimum initial deposit - // currently required for a proposal to be submitted. - MinInitialDeposit(context.Context, *QueryMinInitialDepositRequest) (*QueryMinInitialDepositResponse, error) - // Quorums queries the dynamically set quorums. - Quorums(context.Context, *QueryQuorumsRequest) (*QueryQuorumsResponse, error) - // ParticipationEMAs queries the state of the proposal participation exponential moving averages. - ParticipationEMAs(context.Context, *QueryParticipationEMAsRequest) (*QueryParticipationEMAsResponse, error) +func (m *QueryGovernanceDelegationsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil } -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { +// QueryGovernanceDelegationsResponse is the response type for the Query/GovernanceDelegations RPC method. +type QueryGovernanceDelegationsResponse struct { + // delegations defines the requested delegations. + Delegations []*GovernanceDelegation `protobuf:"bytes,1,rep,name=delegations,proto3" json:"delegations,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (*UnimplementedQueryServer) Constitution(ctx context.Context, req *QueryConstitutionRequest) (*QueryConstitutionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Constitution not implemented") +func (m *QueryGovernanceDelegationsResponse) Reset() { *m = QueryGovernanceDelegationsResponse{} } +func (m *QueryGovernanceDelegationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGovernanceDelegationsResponse) ProtoMessage() {} +func (*QueryGovernanceDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{31} } -func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") +func (m *QueryGovernanceDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented") +func (m *QueryGovernanceDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernanceDelegationsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } -func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest) (*QueryVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +func (m *QueryGovernanceDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernanceDelegationsResponse.Merge(m, src) } -func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented") +func (m *QueryGovernanceDelegationsResponse) XXX_Size() int { + return m.Size() } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +func (m *QueryGovernanceDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernanceDelegationsResponse.DiscardUnknown(m) } -func (*UnimplementedQueryServer) Deposit(ctx context.Context, req *QueryDepositRequest) (*QueryDepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") + +var xxx_messageInfo_QueryGovernanceDelegationsResponse proto.InternalMessageInfo + +func (m *QueryGovernanceDelegationsResponse) GetDelegations() []*GovernanceDelegation { + if m != nil { + return m.Delegations + } + return nil } -func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented") + +func (m *QueryGovernanceDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil } -func (*UnimplementedQueryServer) TallyResult(ctx context.Context, req *QueryTallyResultRequest) (*QueryTallyResultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented") + +// QueryGovernanceDelegationRequest is the request type for the Query/GovernanceDelegation RPC method. +type QueryGovernanceDelegationRequest struct { + // delegator_address defines the address of the delegator. + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` } -func (*UnimplementedQueryServer) MinDeposit(ctx context.Context, req *QueryMinDepositRequest) (*QueryMinDepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MinDeposit not implemented") + +func (m *QueryGovernanceDelegationRequest) Reset() { *m = QueryGovernanceDelegationRequest{} } +func (m *QueryGovernanceDelegationRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGovernanceDelegationRequest) ProtoMessage() {} +func (*QueryGovernanceDelegationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{32} } -func (*UnimplementedQueryServer) MinInitialDeposit(ctx context.Context, req *QueryMinInitialDepositRequest) (*QueryMinInitialDepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MinInitialDeposit not implemented") +func (m *QueryGovernanceDelegationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (*UnimplementedQueryServer) Quorums(ctx context.Context, req *QueryQuorumsRequest) (*QueryQuorumsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Quorums not implemented") +func (m *QueryGovernanceDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernanceDelegationRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } -func (*UnimplementedQueryServer) ParticipationEMAs(ctx context.Context, req *QueryParticipationEMAsRequest) (*QueryParticipationEMAsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ParticipationEMAs not implemented") +func (m *QueryGovernanceDelegationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernanceDelegationRequest.Merge(m, src) } - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) +func (m *QueryGovernanceDelegationRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernanceDelegationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernanceDelegationRequest.DiscardUnknown(m) } -func _Query_Constitution_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryConstitutionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Constitution(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Constitution", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Constitution(ctx, req.(*QueryConstitutionRequest)) +var xxx_messageInfo_QueryGovernanceDelegationRequest proto.InternalMessageInfo + +func (m *QueryGovernanceDelegationRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress } - return interceptor(ctx, in, info, handler) + return "" } -func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryProposalRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Proposal(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Proposal", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) - } - return interceptor(ctx, in, info, handler) +// QueryGovernanceDelegationResponse is the response type for the Query/GovernanceDelegation RPC method. +type QueryGovernanceDelegationResponse struct { + // governor_address defines the address of the governor. + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` } -func _Query_Proposals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryProposalsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Proposals(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Proposals", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) +func (m *QueryGovernanceDelegationResponse) Reset() { *m = QueryGovernanceDelegationResponse{} } +func (m *QueryGovernanceDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGovernanceDelegationResponse) ProtoMessage() {} +func (*QueryGovernanceDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{33} +} +func (m *QueryGovernanceDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernanceDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernanceDelegationResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryGovernanceDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernanceDelegationResponse.Merge(m, src) +} +func (m *QueryGovernanceDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernanceDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernanceDelegationResponse.DiscardUnknown(m) } -func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryVoteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Vote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Vote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest)) +var xxx_messageInfo_QueryGovernanceDelegationResponse proto.InternalMessageInfo + +func (m *QueryGovernanceDelegationResponse) GetGovernorAddress() string { + if m != nil { + return m.GovernorAddress } - return interceptor(ctx, in, info, handler) + return "" } -func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryVotesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Votes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Votes", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest)) - } - return interceptor(ctx, in, info, handler) +// QueryGovernorValSharesRequest is the request type for the Query/GovernorValShares RPC method. +type QueryGovernorValSharesRequest struct { + // governor_address defines the address of the governor. + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` + // pagination defines the pagination in the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) +func (m *QueryGovernorValSharesRequest) Reset() { *m = QueryGovernorValSharesRequest{} } +func (m *QueryGovernorValSharesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorValSharesRequest) ProtoMessage() {} +func (*QueryGovernorValSharesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{34} +} +func (m *QueryGovernorValSharesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernorValSharesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorValSharesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryGovernorValSharesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorValSharesRequest.Merge(m, src) +} +func (m *QueryGovernorValSharesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorValSharesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorValSharesRequest.DiscardUnknown(m) } -func _Query_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDepositRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Deposit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Deposit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Deposit(ctx, req.(*QueryDepositRequest)) +var xxx_messageInfo_QueryGovernorValSharesRequest proto.InternalMessageInfo + +func (m *QueryGovernorValSharesRequest) GetGovernorAddress() string { + if m != nil { + return m.GovernorAddress } - return interceptor(ctx, in, info, handler) + return "" } -func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDepositsRequest) - if err := dec(in); err != nil { - return nil, err +func (m *QueryGovernorValSharesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination } - if interceptor == nil { - return srv.(QueryServer).Deposits(ctx, in) + return nil +} + +// QueryGovernorValSharesResponse is the response type for the Query/GovernorValShares RPC method. +type QueryGovernorValSharesResponse struct { + // val_shares defines the requested validator shares. + ValShares []*GovernorValShares `protobuf:"bytes,1,rep,name=val_shares,json=valShares,proto3" json:"val_shares,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGovernorValSharesResponse) Reset() { *m = QueryGovernorValSharesResponse{} } +func (m *QueryGovernorValSharesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorValSharesResponse) ProtoMessage() {} +func (*QueryGovernorValSharesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{35} +} +func (m *QueryGovernorValSharesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernorValSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorValSharesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Deposits", +} +func (m *QueryGovernorValSharesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorValSharesResponse.Merge(m, src) +} +func (m *QueryGovernorValSharesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorValSharesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorValSharesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGovernorValSharesResponse proto.InternalMessageInfo + +func (m *QueryGovernorValSharesResponse) GetValShares() []*GovernorValShares { + if m != nil { + return m.ValShares } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Deposits(ctx, req.(*QueryDepositsRequest)) + return nil +} + +func (m *QueryGovernorValSharesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination } - return interceptor(ctx, in, info, handler) + return nil } -func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTallyResultRequest) - if err := dec(in); err != nil { +func init() { + proto.RegisterType((*QueryConstitutionRequest)(nil), "atomone.gov.v1.QueryConstitutionRequest") + proto.RegisterType((*QueryConstitutionResponse)(nil), "atomone.gov.v1.QueryConstitutionResponse") + proto.RegisterType((*QueryProposalRequest)(nil), "atomone.gov.v1.QueryProposalRequest") + proto.RegisterType((*QueryProposalResponse)(nil), "atomone.gov.v1.QueryProposalResponse") + proto.RegisterType((*QueryProposalsRequest)(nil), "atomone.gov.v1.QueryProposalsRequest") + proto.RegisterType((*QueryProposalsResponse)(nil), "atomone.gov.v1.QueryProposalsResponse") + proto.RegisterType((*QueryVoteRequest)(nil), "atomone.gov.v1.QueryVoteRequest") + proto.RegisterType((*QueryVoteResponse)(nil), "atomone.gov.v1.QueryVoteResponse") + proto.RegisterType((*QueryVotesRequest)(nil), "atomone.gov.v1.QueryVotesRequest") + proto.RegisterType((*QueryVotesResponse)(nil), "atomone.gov.v1.QueryVotesResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "atomone.gov.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "atomone.gov.v1.QueryParamsResponse") + proto.RegisterType((*QueryDepositRequest)(nil), "atomone.gov.v1.QueryDepositRequest") + proto.RegisterType((*QueryDepositResponse)(nil), "atomone.gov.v1.QueryDepositResponse") + proto.RegisterType((*QueryDepositsRequest)(nil), "atomone.gov.v1.QueryDepositsRequest") + proto.RegisterType((*QueryDepositsResponse)(nil), "atomone.gov.v1.QueryDepositsResponse") + proto.RegisterType((*QueryTallyResultRequest)(nil), "atomone.gov.v1.QueryTallyResultRequest") + proto.RegisterType((*QueryTallyResultResponse)(nil), "atomone.gov.v1.QueryTallyResultResponse") + proto.RegisterType((*QueryMinDepositRequest)(nil), "atomone.gov.v1.QueryMinDepositRequest") + proto.RegisterType((*QueryMinDepositResponse)(nil), "atomone.gov.v1.QueryMinDepositResponse") + proto.RegisterType((*QueryMinInitialDepositRequest)(nil), "atomone.gov.v1.QueryMinInitialDepositRequest") + proto.RegisterType((*QueryMinInitialDepositResponse)(nil), "atomone.gov.v1.QueryMinInitialDepositResponse") + proto.RegisterType((*QueryQuorumsRequest)(nil), "atomone.gov.v1.QueryQuorumsRequest") + proto.RegisterType((*QueryQuorumsResponse)(nil), "atomone.gov.v1.QueryQuorumsResponse") + proto.RegisterType((*QueryParticipationEMAsRequest)(nil), "atomone.gov.v1.QueryParticipationEMAsRequest") + proto.RegisterType((*QueryParticipationEMAsResponse)(nil), "atomone.gov.v1.QueryParticipationEMAsResponse") + proto.RegisterType((*QueryGovernorRequest)(nil), "atomone.gov.v1.QueryGovernorRequest") + proto.RegisterType((*QueryGovernorResponse)(nil), "atomone.gov.v1.QueryGovernorResponse") + proto.RegisterType((*QueryGovernorsRequest)(nil), "atomone.gov.v1.QueryGovernorsRequest") + proto.RegisterType((*QueryGovernorsResponse)(nil), "atomone.gov.v1.QueryGovernorsResponse") + proto.RegisterType((*QueryGovernanceDelegationsRequest)(nil), "atomone.gov.v1.QueryGovernanceDelegationsRequest") + proto.RegisterType((*QueryGovernanceDelegationsResponse)(nil), "atomone.gov.v1.QueryGovernanceDelegationsResponse") + proto.RegisterType((*QueryGovernanceDelegationRequest)(nil), "atomone.gov.v1.QueryGovernanceDelegationRequest") + proto.RegisterType((*QueryGovernanceDelegationResponse)(nil), "atomone.gov.v1.QueryGovernanceDelegationResponse") + proto.RegisterType((*QueryGovernorValSharesRequest)(nil), "atomone.gov.v1.QueryGovernorValSharesRequest") + proto.RegisterType((*QueryGovernorValSharesResponse)(nil), "atomone.gov.v1.QueryGovernorValSharesResponse") +} + +func init() { proto.RegisterFile("atomone/gov/v1/query.proto", fileDescriptor_2290d0188dd70223) } + +var fileDescriptor_2290d0188dd70223 = []byte{ + // 1763 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0xcd, 0x6f, 0x13, 0xc7, + 0x1b, 0xce, 0x3a, 0x1f, 0x24, 0x6f, 0x42, 0x48, 0x86, 0x04, 0x1c, 0x93, 0x38, 0x64, 0x09, 0xf9, + 0x40, 0xd8, 0x8b, 0xc3, 0xa7, 0xf8, 0xfd, 0x68, 0x21, 0x24, 0xa4, 0x48, 0xa5, 0x0d, 0x06, 0x71, + 0x68, 0x0f, 0xd6, 0xc6, 0x5e, 0x2d, 0x2b, 0xd9, 0xbb, 0x8e, 0x77, 0x6d, 0x1a, 0xa5, 0x11, 0x6a, + 0xa5, 0x4a, 0x05, 0xa9, 0x12, 0x55, 0x55, 0x55, 0x45, 0xea, 0xb5, 0x97, 0x5e, 0xc3, 0xa1, 0xb7, + 0xf6, 0xc6, 0x11, 0xd1, 0x4b, 0x4f, 0x55, 0x05, 0xbd, 0xf5, 0x9f, 0xa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 0x55, 0x78, 0xbc, + 0xcc, 0xfd, 0xfa, 0x86, 0x17, 0xfb, 0x23, 0x1a, 0xdd, 0x7d, 0x7d, 0x6d, 0xa5, 0x91, 0xdb, 0xe8, + 0xa3, 0xff, 0x0d, 0x3b, 0xfb, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x23, 0xfc, 0x73, 0x5f, 0xf0, + 0x1b, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Constitution queries the chain's constitution. + Constitution(ctx context.Context, in *QueryConstitutionRequest, opts ...grpc.CallOption) (*QueryConstitutionResponse, error) + // Proposal queries proposal details based on ProposalID. + Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) + // Proposals queries all proposals based on given status. + Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) + // Vote queries voted information based on proposalID, voterAddr. + Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) + // Params queries all parameters of the gov module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Deposit queries single deposit information based proposalID, depositAddr. + Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) + // Deposits queries all deposits of a single proposal. + Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) + // TallyResult queries the tally of a proposal vote. + TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) + // MinDeposit queries the minimum deposit currently + // required for a proposal to enter voting period. + MinDeposit(ctx context.Context, in *QueryMinDepositRequest, opts ...grpc.CallOption) (*QueryMinDepositResponse, error) + // MinInitialDeposit queries the minimum initial deposit + // currently required for a proposal to be submitted. + MinInitialDeposit(ctx context.Context, in *QueryMinInitialDepositRequest, opts ...grpc.CallOption) (*QueryMinInitialDepositResponse, error) + // Quorums queries the dynamically set quorums. + Quorums(ctx context.Context, in *QueryQuorumsRequest, opts ...grpc.CallOption) (*QueryQuorumsResponse, error) + // ParticipationEMAs queries the state of the proposal participation exponential moving averages. + ParticipationEMAs(ctx context.Context, in *QueryParticipationEMAsRequest, opts ...grpc.CallOption) (*QueryParticipationEMAsResponse, error) + // Governor queries governor information based on governor address. + Governor(ctx context.Context, in *QueryGovernorRequest, opts ...grpc.CallOption) (*QueryGovernorResponse, error) + // Governors queries all governors. + Governors(ctx context.Context, in *QueryGovernorsRequest, opts ...grpc.CallOption) (*QueryGovernorsResponse, error) + // GovernanceDelegations queries all delegations of a governor. + GovernanceDelegations(ctx context.Context, in *QueryGovernanceDelegationsRequest, opts ...grpc.CallOption) (*QueryGovernanceDelegationsResponse, error) + // GovernanceDelegation queries a delegation + GovernanceDelegation(ctx context.Context, in *QueryGovernanceDelegationRequest, opts ...grpc.CallOption) (*QueryGovernanceDelegationResponse, error) + // GovernorValShares queries all governor virtual validator shares resulting from all governance delegations. + GovernorValShares(ctx context.Context, in *QueryGovernorValSharesRequest, opts ...grpc.CallOption) (*QueryGovernorValSharesResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Constitution(ctx context.Context, in *QueryConstitutionRequest, opts ...grpc.CallOption) (*QueryConstitutionResponse, error) { + out := new(QueryConstitutionResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Constitution", in, out, opts...) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).TallyResult(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/TallyResult", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TallyResult(ctx, req.(*QueryTallyResultRequest)) - } - return interceptor(ctx, in, info, handler) + return out, nil } -func _Query_MinDeposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryMinDepositRequest) - if err := dec(in); err != nil { +func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) { + out := new(QueryProposalResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Proposal", in, out, opts...) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).MinDeposit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/MinDeposit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).MinDeposit(ctx, req.(*QueryMinDepositRequest)) - } - return interceptor(ctx, in, info, handler) + return out, nil } -func _Query_MinInitialDeposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryMinInitialDepositRequest) - if err := dec(in); err != nil { +func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) { + out := new(QueryProposalsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Proposals", in, out, opts...) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).MinInitialDeposit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/MinInitialDeposit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).MinInitialDeposit(ctx, req.(*QueryMinInitialDepositRequest)) - } - return interceptor(ctx, in, info, handler) + return out, nil } -func _Query_Quorums_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryQuorumsRequest) - if err := dec(in); err != nil { +func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) { + out := new(QueryVoteResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Vote", in, out, opts...) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).Quorums(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Quorums", + return out, nil +} + +func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) { + out := new(QueryVotesResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Votes", in, out, opts...) + if err != nil { + return nil, err } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Quorums(ctx, req.(*QueryQuorumsRequest)) + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err } - return interceptor(ctx, in, info, handler) + return out, nil } -func _Query_ParticipationEMAs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParticipationEMAsRequest) - if err := dec(in); err != nil { +func (c *queryClient) Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) { + out := new(QueryDepositResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Deposit", in, out, opts...) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).ParticipationEMAs(ctx, in) + return out, nil +} + +func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) { + out := new(QueryDepositsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Deposits", in, out, opts...) + if err != nil { + return nil, err } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/ParticipationEMAs", + return out, nil +} + +func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) { + out := new(QueryTallyResultResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/TallyResult", in, out, opts...) + if err != nil { + return nil, err } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ParticipationEMAs(ctx, req.(*QueryParticipationEMAsRequest)) + return out, nil +} + +func (c *queryClient) MinDeposit(ctx context.Context, in *QueryMinDepositRequest, opts ...grpc.CallOption) (*QueryMinDepositResponse, error) { + out := new(QueryMinDepositResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/MinDeposit", in, out, opts...) + if err != nil { + return nil, err } - return interceptor(ctx, in, info, handler) + return out, nil } -var Query_serviceDesc = _Query_serviceDesc -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "atomone.gov.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Constitution", - Handler: _Query_Constitution_Handler, - }, - { - MethodName: "Proposal", - Handler: _Query_Proposal_Handler, - }, - { - MethodName: "Proposals", - Handler: _Query_Proposals_Handler, - }, - { - MethodName: "Vote", - Handler: _Query_Vote_Handler, - }, - { - MethodName: "Votes", - Handler: _Query_Votes_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "Deposit", - Handler: _Query_Deposit_Handler, - }, - { - MethodName: "Deposits", - Handler: _Query_Deposits_Handler, - }, - { - MethodName: "TallyResult", - Handler: _Query_TallyResult_Handler, - }, - { - MethodName: "MinDeposit", - Handler: _Query_MinDeposit_Handler, - }, - { - MethodName: "MinInitialDeposit", - Handler: _Query_MinInitialDeposit_Handler, - }, - { - MethodName: "Quorums", - Handler: _Query_Quorums_Handler, - }, - { - MethodName: "ParticipationEMAs", - Handler: _Query_ParticipationEMAs_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "atomone/gov/v1/query.proto", -} - -func (m *QueryConstitutionRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) MinInitialDeposit(ctx context.Context, in *QueryMinInitialDepositRequest, opts ...grpc.CallOption) (*QueryMinInitialDepositResponse, error) { + out := new(QueryMinInitialDepositResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/MinInitialDeposit", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryConstitutionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryConstitutionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil + return out, nil } -func (m *QueryConstitutionResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Quorums(ctx context.Context, in *QueryQuorumsRequest, opts ...grpc.CallOption) (*QueryQuorumsResponse, error) { + out := new(QueryQuorumsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Quorums", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryConstitutionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryConstitutionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Constitution) > 0 { - i -= len(m.Constitution) - copy(dAtA[i:], m.Constitution) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Constitution))) - i-- - dAtA[i] = 0xa +func (c *queryClient) ParticipationEMAs(ctx context.Context, in *QueryParticipationEMAsRequest, opts ...grpc.CallOption) (*QueryParticipationEMAsResponse, error) { + out := new(QueryParticipationEMAsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/ParticipationEMAs", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryProposalRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Governor(ctx context.Context, in *QueryGovernorRequest, opts ...grpc.CallOption) (*QueryGovernorResponse, error) { + out := new(QueryGovernorResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Governor", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 +func (c *queryClient) Governors(ctx context.Context, in *QueryGovernorsRequest, opts ...grpc.CallOption) (*QueryGovernorsResponse, error) { + out := new(QueryGovernorsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Governors", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryProposalResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GovernanceDelegations(ctx context.Context, in *QueryGovernanceDelegationsRequest, opts ...grpc.CallOption) (*QueryGovernanceDelegationsResponse, error) { + out := new(QueryGovernanceDelegationsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/GovernanceDelegations", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryProposalResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proposal != nil { - { - size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (c *queryClient) GovernanceDelegation(ctx context.Context, in *QueryGovernanceDelegationRequest, opts ...grpc.CallOption) (*QueryGovernanceDelegationResponse, error) { + out := new(QueryGovernanceDelegationResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/GovernanceDelegation", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryProposalsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GovernorValShares(ctx context.Context, in *QueryGovernorValSharesRequest, opts ...grpc.CallOption) (*QueryGovernorValSharesResponse, error) { + out := new(QueryGovernorValSharesResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/GovernorValShares", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryProposalsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// QueryServer is the server API for Query service. +type QueryServer interface { + // Constitution queries the chain's constitution. + Constitution(context.Context, *QueryConstitutionRequest) (*QueryConstitutionResponse, error) + // Proposal queries proposal details based on ProposalID. + Proposal(context.Context, *QueryProposalRequest) (*QueryProposalResponse, error) + // Proposals queries all proposals based on given status. + Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error) + // Vote queries voted information based on proposalID, voterAddr. + Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error) + // Params queries all parameters of the gov module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Deposit queries single deposit information based proposalID, depositAddr. + Deposit(context.Context, *QueryDepositRequest) (*QueryDepositResponse, error) + // Deposits queries all deposits of a single proposal. + Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) + // TallyResult queries the tally of a proposal vote. + TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) + // MinDeposit queries the minimum deposit currently + // required for a proposal to enter voting period. + MinDeposit(context.Context, *QueryMinDepositRequest) (*QueryMinDepositResponse, error) + // MinInitialDeposit queries the minimum initial deposit + // currently required for a proposal to be submitted. + MinInitialDeposit(context.Context, *QueryMinInitialDepositRequest) (*QueryMinInitialDepositResponse, error) + // Quorums queries the dynamically set quorums. + Quorums(context.Context, *QueryQuorumsRequest) (*QueryQuorumsResponse, error) + // ParticipationEMAs queries the state of the proposal participation exponential moving averages. + ParticipationEMAs(context.Context, *QueryParticipationEMAsRequest) (*QueryParticipationEMAsResponse, error) + // Governor queries governor information based on governor address. + Governor(context.Context, *QueryGovernorRequest) (*QueryGovernorResponse, error) + // Governors queries all governors. + Governors(context.Context, *QueryGovernorsRequest) (*QueryGovernorsResponse, error) + // GovernanceDelegations queries all delegations of a governor. + GovernanceDelegations(context.Context, *QueryGovernanceDelegationsRequest) (*QueryGovernanceDelegationsResponse, error) + // GovernanceDelegation queries a delegation + GovernanceDelegation(context.Context, *QueryGovernanceDelegationRequest) (*QueryGovernanceDelegationResponse, error) + // GovernorValShares queries all governor virtual validator shares resulting from all governance delegations. + GovernorValShares(context.Context, *QueryGovernorValSharesRequest) (*QueryGovernorValSharesResponse, error) } -func (m *QueryProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) - i-- - dAtA[i] = 0x1a - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalStatus != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalStatus)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { } -func (m *QueryProposalsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (*UnimplementedQueryServer) Constitution(ctx context.Context, req *QueryConstitutionRequest) (*QueryConstitutionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Constitution not implemented") } - -func (m *QueryProposalsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") } - -func (m *QueryProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Proposals) > 0 { - for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Proposals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil +func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented") } - -func (m *QueryVoteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest) (*QueryVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +} +func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Deposit(ctx context.Context, req *QueryDepositRequest) (*QueryDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") +} +func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented") +} +func (*UnimplementedQueryServer) TallyResult(ctx context.Context, req *QueryTallyResultRequest) (*QueryTallyResultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented") +} +func (*UnimplementedQueryServer) MinDeposit(ctx context.Context, req *QueryMinDepositRequest) (*QueryMinDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MinDeposit not implemented") +} +func (*UnimplementedQueryServer) MinInitialDeposit(ctx context.Context, req *QueryMinInitialDepositRequest) (*QueryMinInitialDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MinInitialDeposit not implemented") +} +func (*UnimplementedQueryServer) Quorums(ctx context.Context, req *QueryQuorumsRequest) (*QueryQuorumsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Quorums not implemented") +} +func (*UnimplementedQueryServer) ParticipationEMAs(ctx context.Context, req *QueryParticipationEMAsRequest) (*QueryParticipationEMAsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ParticipationEMAs not implemented") +} +func (*UnimplementedQueryServer) Governor(ctx context.Context, req *QueryGovernorRequest) (*QueryGovernorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Governor not implemented") +} +func (*UnimplementedQueryServer) Governors(ctx context.Context, req *QueryGovernorsRequest) (*QueryGovernorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Governors not implemented") +} +func (*UnimplementedQueryServer) GovernanceDelegations(ctx context.Context, req *QueryGovernanceDelegationsRequest) (*QueryGovernanceDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GovernanceDelegations not implemented") +} +func (*UnimplementedQueryServer) GovernanceDelegation(ctx context.Context, req *QueryGovernanceDelegationRequest) (*QueryGovernanceDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GovernanceDelegation not implemented") +} +func (*UnimplementedQueryServer) GovernorValShares(ctx context.Context, req *QueryGovernorValSharesRequest) (*QueryGovernorValSharesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GovernorValShares not implemented") } -func (m *QueryVoteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) } -func (m *QueryVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 +func _Query_Constitution_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConstitutionRequest) + if err := dec(in); err != nil { + return nil, err } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 + if interceptor == nil { + return srv.(QueryServer).Constitution(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Constitution", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Constitution(ctx, req.(*QueryConstitutionRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVoteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposalRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryVoteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Vote != nil { - { - size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + if interceptor == nil { + return srv.(QueryServer).Proposal(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Proposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVotesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Proposals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposalsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Proposals(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Proposals", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVotesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Vote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Vote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 +func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVotesRequest) + if err := dec(in); err != nil { + return nil, err } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 + if interceptor == nil { + return srv.(QueryServer).Votes(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Votes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVotesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVotesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDepositRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Deposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Deposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Deposit(ctx, req.(*QueryDepositRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 +func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDepositsRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.Votes) > 0 { - for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if interceptor == nil { + return srv.(QueryServer).Deposits(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Deposits", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Deposits(ctx, req.(*QueryDepositsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTallyResultRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).TallyResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/TallyResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TallyResult(ctx, req.(*QueryTallyResultRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_MinDeposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMinDepositRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).MinDeposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/MinDeposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).MinDeposit(ctx, req.(*QueryMinDepositRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ParamsType) > 0 { - i -= len(m.ParamsType) - copy(dAtA[i:], m.ParamsType) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ParamsType))) - i-- - dAtA[i] = 0xa +func _Query_MinInitialDeposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMinInitialDepositRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).MinInitialDeposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/MinInitialDeposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).MinInitialDeposit(ctx, req.(*QueryMinInitialDepositRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Quorums_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryQuorumsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Quorums(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Quorums", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Quorums(ctx, req.(*QueryQuorumsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_ParticipationEMAs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParticipationEMAsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ParticipationEMAs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/ParticipationEMAs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ParticipationEMAs(ctx, req.(*QueryParticipationEMAsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 +func _Query_Governor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGovernorRequest) + if err := dec(in); err != nil { + return nil, err } - if m.TallyParams != nil { - { - size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a + if interceptor == nil { + return srv.(QueryServer).Governor(ctx, in) } - if m.DepositParams != nil { - { - size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Governor", } - if m.VotingParams != nil { - { - size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Governor(ctx, req.(*QueryGovernorRequest)) } - return len(dAtA) - i, nil + return interceptor(ctx, in, info, handler) } -func (m *QueryDepositRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Governors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGovernorsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Governors(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Governors", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Governors(ctx, req.(*QueryGovernorsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDepositRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_GovernanceDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGovernanceDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GovernanceDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/GovernanceDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GovernanceDelegations(ctx, req.(*QueryGovernanceDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func _Query_GovernanceDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGovernanceDelegationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GovernanceDelegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/GovernanceDelegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GovernanceDelegation(ctx, req.(*QueryGovernanceDelegationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GovernorValShares_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGovernorValSharesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GovernorValShares(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/GovernorValShares", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GovernorValShares(ctx, req.(*QueryGovernorValSharesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var Query_serviceDesc = _Query_serviceDesc +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "atomone.gov.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Constitution", + Handler: _Query_Constitution_Handler, + }, + { + MethodName: "Proposal", + Handler: _Query_Proposal_Handler, + }, + { + MethodName: "Proposals", + Handler: _Query_Proposals_Handler, + }, + { + MethodName: "Vote", + Handler: _Query_Vote_Handler, + }, + { + MethodName: "Votes", + Handler: _Query_Votes_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Deposit", + Handler: _Query_Deposit_Handler, + }, + { + MethodName: "Deposits", + Handler: _Query_Deposits_Handler, + }, + { + MethodName: "TallyResult", + Handler: _Query_TallyResult_Handler, + }, + { + MethodName: "MinDeposit", + Handler: _Query_MinDeposit_Handler, + }, + { + MethodName: "MinInitialDeposit", + Handler: _Query_MinInitialDeposit_Handler, + }, + { + MethodName: "Quorums", + Handler: _Query_Quorums_Handler, + }, + { + MethodName: "ParticipationEMAs", + Handler: _Query_ParticipationEMAs_Handler, + }, + { + MethodName: "Governor", + Handler: _Query_Governor_Handler, + }, + { + MethodName: "Governors", + Handler: _Query_Governors_Handler, + }, + { + MethodName: "GovernanceDelegations", + Handler: _Query_GovernanceDelegations_Handler, + }, + { + MethodName: "GovernanceDelegation", + Handler: _Query_GovernanceDelegation_Handler, + }, + { + MethodName: "GovernorValShares", + Handler: _Query_GovernorValShares_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "atomone/gov/v1/query.proto", +} + +func (m *QueryConstitutionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConstitutionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConstitutionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) + return len(dAtA) - i, nil +} + +func (m *QueryConstitutionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConstitutionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConstitutionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Constitution) > 0 { + i -= len(m.Constitution) + copy(dAtA[i:], m.Constitution) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Constitution))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryProposalRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l if m.ProposalId != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) i-- @@ -2527,7 +2822,7 @@ func (m *QueryDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryDepositResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryProposalResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2537,19 +2832,19 @@ func (m *QueryDepositResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryDepositResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryProposalResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Deposit != nil { + if m.Proposal != nil { { - size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2562,7 +2857,7 @@ func (m *QueryDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryDepositsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryProposalsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2572,12 +2867,12 @@ func (m *QueryDepositsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryDepositsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryProposalsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryDepositsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2592,17 +2887,31 @@ func (m *QueryDepositsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x22 + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x1a + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) + i-- dAtA[i] = 0x12 } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + if m.ProposalStatus != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalStatus)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryDepositsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryProposalsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2612,12 +2921,12 @@ func (m *QueryDepositsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryDepositsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryProposalsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2634,10 +2943,10 @@ func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Deposits) > 0 { - for iNdEx := len(m.Deposits) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Proposals) > 0 { + for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Deposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Proposals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2651,7 +2960,7 @@ func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryTallyResultRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryVoteRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2661,16 +2970,23 @@ func (m *QueryTallyResultRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryTallyResultRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryVoteRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryTallyResultRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } if m.ProposalId != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) i-- @@ -2679,7 +2995,7 @@ func (m *QueryTallyResultRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryTallyResultResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryVoteResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2689,19 +3005,19 @@ func (m *QueryTallyResultResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryTallyResultResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryVoteResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Tally != nil { + if m.Vote != nil { { - size, err := m.Tally.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2714,7 +3030,7 @@ func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryMinDepositRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryVotesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2724,43 +3040,72 @@ func (m *QueryMinDepositRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryMinDepositRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryVotesRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryMinDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - return len(dAtA) - i, nil -} - -func (m *QueryMinDepositResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryVotesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } return dAtA[:n], nil } -func (m *QueryMinDepositResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryVotesResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryMinDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.MinDeposit) > 0 { - for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Votes) > 0 { + for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2774,7 +3119,7 @@ func (m *QueryMinDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryMinInitialDepositRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2784,20 +3129,27 @@ func (m *QueryMinInitialDepositRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryMinInitialDepositRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryMinInitialDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.ParamsType) > 0 { + i -= len(m.ParamsType) + copy(dAtA[i:], m.ParamsType) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ParamsType))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } -func (m *QueryMinInitialDepositResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2807,34 +3159,68 @@ func (m *QueryMinInitialDepositResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryMinInitialDepositResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryMinInitialDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.MinInitialDeposit) > 0 { - for iNdEx := len(m.MinInitialDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MinInitialDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.TallyParams != nil { + { + size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.DepositParams != nil { + { + size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.VotingParams != nil { + { + size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryQuorumsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryDepositRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2844,20 +3230,32 @@ func (m *QueryQuorumsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryQuorumsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryDepositRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryQuorumsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } -func (m *QueryQuorumsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryDepositResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2867,41 +3265,32 @@ func (m *QueryQuorumsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryQuorumsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryDepositResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryQuorumsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.LawQuorum) > 0 { - i -= len(m.LawQuorum) - copy(dAtA[i:], m.LawQuorum) - i = encodeVarintQuery(dAtA, i, uint64(len(m.LawQuorum))) - i-- - dAtA[i] = 0x1a - } - if len(m.ConstitutionAmendmentQuorum) > 0 { - i -= len(m.ConstitutionAmendmentQuorum) - copy(dAtA[i:], m.ConstitutionAmendmentQuorum) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ConstitutionAmendmentQuorum))) - i-- - dAtA[i] = 0x12 - } - if len(m.Quorum) > 0 { - i -= len(m.Quorum) - copy(dAtA[i:], m.Quorum) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Quorum))) + if m.Deposit != nil { + { + size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryParticipationEMAsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryDepositsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2911,20 +3300,37 @@ func (m *QueryParticipationEMAsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryParticipationEMAsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryDepositsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParticipationEMAsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryDepositsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } -func (m *QueryParticipationEMAsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryDepositsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2934,447 +3340,2767 @@ func (m *QueryParticipationEMAsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryParticipationEMAsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryDepositsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParticipationEMAsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.LawParticipationEma) > 0 { - i -= len(m.LawParticipationEma) - copy(dAtA[i:], m.LawParticipationEma) - i = encodeVarintQuery(dAtA, i, uint64(len(m.LawParticipationEma))) - i-- - dAtA[i] = 0x1a - } - if len(m.ConstitutionAmendmentParticipationEma) > 0 { - i -= len(m.ConstitutionAmendmentParticipationEma) - copy(dAtA[i:], m.ConstitutionAmendmentParticipationEma) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ConstitutionAmendmentParticipationEma))) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 } - if len(m.ParticipationEma) > 0 { - i -= len(m.ParticipationEma) - copy(dAtA[i:], m.ParticipationEma) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ParticipationEma))) - i-- - dAtA[i] = 0xa + if len(m.Deposits) > 0 { + for iNdEx := len(m.Deposits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QueryTallyResultRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryConstitutionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryConstitutionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Constitution) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryTallyResultRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryProposalRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryTallyResultRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryProposalResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Proposal != nil { - l = m.Proposal.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryTallyResultResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryProposalsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalStatus != 0 { - n += 1 + sovQuery(uint64(m.ProposalStatus)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryTallyResultResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryProposalsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Proposals) > 0 { - for _, e := range m.Proposals { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Tally != nil { + { + size, err := m.Tally.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + return len(dAtA) - i, nil } -func (m *QueryVoteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryMinDepositRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryVoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Vote != nil { - l = m.Vote.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryMinDepositRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryVotesRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryMinDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + return len(dAtA) - i, nil } -func (m *QueryVotesResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryMinDepositResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryMinDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMinDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Votes) > 0 { - for _, e := range m.Votes { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.MinDeposit) > 0 { + for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + return len(dAtA) - i, nil } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ParamsType) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryMinInitialDepositRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryMinInitialDepositRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMinInitialDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.VotingParams != nil { - l = m.VotingParams.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.DepositParams != nil { - l = m.DepositParams.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.TallyParams != nil { - l = m.TallyParams.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + return len(dAtA) - i, nil } -func (m *QueryDepositRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryMinInitialDepositResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n + return dAtA[:n], nil } -func (m *QueryDepositResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryMinInitialDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMinInitialDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Deposit != nil { - l = m.Deposit.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.MinInitialDeposit) > 0 { + for iNdEx := len(m.MinInitialDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinInitialDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return n + return len(dAtA) - i, nil } -func (m *QueryDepositsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryQuorumsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryQuorumsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryQuorumsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + return len(dAtA) - i, nil } -func (m *QueryDepositsResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryQuorumsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryQuorumsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryQuorumsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Deposits) > 0 { - for _, e := range m.Deposits { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if len(m.LawQuorum) > 0 { + i -= len(m.LawQuorum) + copy(dAtA[i:], m.LawQuorum) + i = encodeVarintQuery(dAtA, i, uint64(len(m.LawQuorum))) + i-- + dAtA[i] = 0x1a } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.ConstitutionAmendmentQuorum) > 0 { + i -= len(m.ConstitutionAmendmentQuorum) + copy(dAtA[i:], m.ConstitutionAmendmentQuorum) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConstitutionAmendmentQuorum))) + i-- + dAtA[i] = 0x12 } - return n + if len(m.Quorum) > 0 { + i -= len(m.Quorum) + copy(dAtA[i:], m.Quorum) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Quorum))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryTallyResultRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) +func (m *QueryParticipationEMAsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryTallyResultResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Tally != nil { - l = m.Tally.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryParticipationEMAsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryMinDepositRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryParticipationEMAsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *QueryMinDepositResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryParticipationEMAsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryParticipationEMAsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParticipationEMAsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.MinDeposit) > 0 { - for _, e := range m.MinDeposit { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if len(m.LawParticipationEma) > 0 { + i -= len(m.LawParticipationEma) + copy(dAtA[i:], m.LawParticipationEma) + i = encodeVarintQuery(dAtA, i, uint64(len(m.LawParticipationEma))) + i-- + dAtA[i] = 0x1a } - return n + if len(m.ConstitutionAmendmentParticipationEma) > 0 { + i -= len(m.ConstitutionAmendmentParticipationEma) + copy(dAtA[i:], m.ConstitutionAmendmentParticipationEma) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConstitutionAmendmentParticipationEma))) + i-- + dAtA[i] = 0x12 + } + if len(m.ParticipationEma) > 0 { + i -= len(m.ParticipationEma) + copy(dAtA[i:], m.ParticipationEma) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ParticipationEma))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryMinInitialDepositRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGovernorRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryMinInitialDepositResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryGovernorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.MinInitialDeposit) > 0 { - for _, e := range m.MinInitialDeposit { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryQuorumsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGovernorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryQuorumsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryGovernorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Governor != nil { + { + size, err := m.Governor.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernorsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernorsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Governors) > 0 { + for iNdEx := len(m.Governors) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Governors[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernanceDelegationsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernanceDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernanceDelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernanceDelegationsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernanceDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernanceDelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Delegations) > 0 { + for iNdEx := len(m.Delegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Delegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernanceDelegationRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernanceDelegationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernanceDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernanceDelegationResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernanceDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernanceDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernorValSharesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernorValSharesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorValSharesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernorValSharesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernorValSharesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorValSharesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ValShares) > 0 { + for iNdEx := len(m.ValShares) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ValShares[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryConstitutionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryConstitutionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Constitution) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryProposalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Proposal != nil { + l = m.Proposal.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryProposalsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalStatus != 0 { + n += 1 + sovQuery(uint64(m.ProposalStatus)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryProposalsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Proposals) > 0 { + for _, e := range m.Proposals { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVoteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVoteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Vote != nil { + l = m.Vote.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVotesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVotesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Votes) > 0 { + for _, e := range m.Votes { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ParamsType) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VotingParams != nil { + l = m.VotingParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.DepositParams != nil { + l = m.DepositParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.TallyParams != nil { + l = m.TallyParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Deposit != nil { + l = m.Deposit.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Deposits) > 0 { + for _, e := range m.Deposits { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTallyResultRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryTallyResultResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tally != nil { + l = m.Tally.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryMinDepositRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryMinDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinDeposit) > 0 { + for _, e := range m.MinDeposit { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryMinInitialDepositRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryMinInitialDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinInitialDeposit) > 0 { + for _, e := range m.MinInitialDeposit { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryQuorumsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryQuorumsResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Quorum) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.ConstitutionAmendmentQuorum) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + l = len(m.ConstitutionAmendmentQuorum) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.LawQuorum) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParticipationEMAsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParticipationEMAsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ParticipationEma) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ConstitutionAmendmentParticipationEma) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.LawParticipationEma) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Governor != nil { + l = m.Governor.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Governors) > 0 { + for _, e := range m.Governors { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernanceDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernanceDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Delegations) > 0 { + for _, e := range m.Delegations { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernanceDelegationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernanceDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorValSharesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorValSharesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ValShares) > 0 { + for _, e := range m.ValShares { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryConstitutionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConstitutionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConstitutionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConstitutionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConstitutionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConstitutionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Constitution", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Constitution = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proposal == nil { + m.Proposal = &Proposal{} + } + if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalStatus", wireType) + } + m.ProposalStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalStatus |= ProposalStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposals = append(m.Proposals, &Proposal{}) + if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVoteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryVoteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryVoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Vote == nil { + m.Vote = &Vote{} + } + if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVotesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryVotesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryVotesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Votes = append(m.Votes, &Vote{}) + if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParamsType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ParamsType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotingParams == nil { + m.VotingParams = &VotingParams{} + } + if err := m.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DepositParams == nil { + m.DepositParams = &DepositParams{} + } + if err := m.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TallyParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TallyParams == nil { + m.TallyParams = &TallyParams{} + } + if err := m.TallyParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - l = len(m.LawQuorum) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + return nil +} +func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryDepositRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - return n -} -func (m *QueryParticipationEMAsRequest) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - return n + return nil } - -func (m *QueryParticipationEMAsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ParticipationEma) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ConstitutionAmendmentParticipationEma) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.LawParticipationEma) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Deposit == nil { + m.Deposit = &Deposit{} + } + if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - return n -} -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *QueryConstitutionRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDepositsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3397,12 +6123,67 @@ func (m *QueryConstitutionRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConstitutionRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDepositsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConstitutionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDepositsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3424,7 +6205,7 @@ func (m *QueryConstitutionRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConstitutionResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3447,17 +6228,17 @@ func (m *QueryConstitutionResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConstitutionResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDepositsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConstitutionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDepositsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Constitution", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Deposits", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3467,23 +6248,61 @@ func (m *QueryConstitutionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Constitution = string(dAtA[iNdEx:postIndex]) + m.Deposits = append(m.Deposits, &Deposit{}) + if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3506,7 +6325,7 @@ func (m *QueryConstitutionResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { +func (m *QueryTallyResultRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3529,10 +6348,10 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTallyResultRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTallyResultRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3575,7 +6394,7 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { +func (m *QueryTallyResultResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3598,15 +6417,15 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTallyResultResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTallyResultResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tally", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3633,10 +6452,10 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Proposal == nil { - m.Proposal = &Proposal{} + if m.Tally == nil { + m.Tally = &TallyResult{} } - if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Tally.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3661,7 +6480,7 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryMinDepositRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3684,131 +6503,12 @@ func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryMinDepositRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryMinDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalStatus", wireType) - } - m.ProposalStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalStatus |= ProposalStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Depositor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3830,7 +6530,7 @@ func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryMinDepositResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3853,49 +6553,15 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryMinDepositResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryMinDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proposals = append(m.Proposals, &Proposal{}) - if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3922,10 +6588,8 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.MinDeposit = append(m.MinDeposit, types.Coin{}) + if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3950,7 +6614,7 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryVoteRequest) Unmarshal(dAtA []byte) error { +func (m *QueryMinInitialDepositRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3965,71 +6629,20 @@ func (m *QueryVoteRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryVoteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryMinInitialDepositRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMinInitialDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4051,7 +6664,7 @@ func (m *QueryVoteRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { +func (m *QueryMinInitialDepositResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4074,15 +6687,15 @@ func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryVoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryMinInitialDepositResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryMinInitialDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDeposit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4109,10 +6722,8 @@ func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Vote == nil { - m.Vote = &Vote{} - } - if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.MinInitialDeposit = append(m.MinInitialDeposit, types.Coin{}) + if err := m.MinInitialDeposit[len(m.MinInitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4137,7 +6748,7 @@ func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryVotesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryQuorumsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4160,67 +6771,12 @@ func (m *QueryVotesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryVotesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryQuorumsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryQuorumsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4242,7 +6798,7 @@ func (m *QueryVotesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryQuorumsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4265,17 +6821,17 @@ func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryVotesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryQuorumsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryQuorumsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4285,31 +6841,29 @@ func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Votes = append(m.Votes, &Vote{}) - if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Quorum = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConstitutionAmendmentQuorum", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4319,27 +6873,55 @@ func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} + m.ConstitutionAmendmentQuorum = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LawQuorum", wireType) } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF } + m.LawQuorum = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4362,7 +6944,7 @@ func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParticipationEMAsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4385,44 +6967,12 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParticipationEMAsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParticipationEMAsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParamsType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ParamsType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4444,7 +6994,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParticipationEMAsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4467,53 +7017,17 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParticipationEMAsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParticipationEMAsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingParams", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VotingParams == nil { - m.VotingParams = &VotingParams{} - } - if err := m.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DepositParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ParticipationEma", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4523,33 +7037,29 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.DepositParams == nil { - m.DepositParams = &DepositParams{} - } - if err := m.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ParticipationEma = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TallyParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConstitutionAmendmentParticipationEma", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4559,33 +7069,29 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.TallyParams == nil { - m.TallyParams = &TallyParams{} - } - if err := m.TallyParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ConstitutionAmendmentParticipationEma = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LawParticipationEma", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4595,27 +7101,23 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Params == nil { - m.Params = &Params{} - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.LawParticipationEma = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4638,7 +7140,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4661,34 +7163,15 @@ func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDepositRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4716,7 +7199,7 @@ func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Depositor = string(dAtA[iNdEx:postIndex]) + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4739,7 +7222,7 @@ func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4762,15 +7245,15 @@ func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDepositResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Governor", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4797,10 +7280,10 @@ func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Deposit == nil { - m.Deposit = &Deposit{} + if m.Governor == nil { + m.Governor = &Governor{} } - if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Governor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4825,7 +7308,7 @@ func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDepositsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4848,32 +7331,13 @@ func (m *QueryDepositsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDepositsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } @@ -4930,7 +7394,7 @@ func (m *QueryDepositsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4953,15 +7417,15 @@ func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDepositsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposits", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Governors", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4988,8 +7452,8 @@ func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Deposits = append(m.Deposits, &Deposit{}) - if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Governors = append(m.Governors, &Governor{}) + if err := m.Governors[len(m.Governors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5050,7 +7514,7 @@ func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryTallyResultRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGovernanceDelegationsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5073,17 +7537,17 @@ func (m *QueryTallyResultRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryTallyResultRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernanceDelegationsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTallyResultRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernanceDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) } - m.ProposalId = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5093,64 +7557,27 @@ func (m *QueryTallyResultRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryTallyResultResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryTallyResultResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTallyResultResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tally", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5177,10 +7604,10 @@ func (m *QueryTallyResultResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Tally == nil { - m.Tally = &TallyResult{} + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} } - if err := m.Tally.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5205,57 +7632,7 @@ func (m *QueryTallyResultResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryMinDepositRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryMinDepositRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMinDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryMinDepositResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGovernanceDelegationsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5278,15 +7655,15 @@ func (m *QueryMinDepositResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryMinDepositResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernanceDelegationsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMinDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernanceDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Delegations", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5313,61 +7690,47 @@ func (m *QueryMinDepositResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MinDeposit = append(m.MinDeposit, types.Coin{}) - if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Delegations = append(m.Delegations, &GovernanceDelegation{}) + if err := m.Delegations[len(m.Delegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { return ErrInvalidLengthQuery } - if (iNdEx + skippy) > l { + if postIndex > l { return io.ErrUnexpectedEOF } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryMinInitialDepositRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryMinInitialDepositRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMinInitialDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5389,7 +7752,7 @@ func (m *QueryMinInitialDepositRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryMinInitialDepositResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGovernanceDelegationRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5412,17 +7775,17 @@ func (m *QueryMinInitialDepositResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryMinInitialDepositResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernanceDelegationRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMinInitialDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernanceDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDeposit", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5432,25 +7795,23 @@ func (m *QueryMinInitialDepositResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.MinInitialDeposit = append(m.MinInitialDeposit, types.Coin{}) - if err := m.MinInitialDeposit[len(m.MinInitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5473,7 +7834,7 @@ func (m *QueryMinInitialDepositResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryQuorumsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGovernanceDelegationResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5496,12 +7857,44 @@ func (m *QueryQuorumsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryQuorumsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernanceDelegationResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryQuorumsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernanceDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5523,7 +7916,7 @@ func (m *QueryQuorumsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryQuorumsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorValSharesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5546,15 +7939,15 @@ func (m *QueryQuorumsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryQuorumsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorValSharesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryQuorumsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorValSharesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5582,13 +7975,13 @@ func (m *QueryQuorumsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Quorum = string(dAtA[iNdEx:postIndex]) + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConstitutionAmendmentQuorum", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5598,106 +7991,28 @@ func (m *QueryQuorumsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ConstitutionAmendmentQuorum = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LawQuorum", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} } - m.LawQuorum = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParticipationEMAsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParticipationEMAsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParticipationEMAsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5719,7 +8034,7 @@ func (m *QueryParticipationEMAsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParticipationEMAsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorValSharesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5742,17 +8057,17 @@ func (m *QueryParticipationEMAsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParticipationEMAsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorValSharesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParticipationEMAsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorValSharesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParticipationEma", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValShares", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5762,29 +8077,31 @@ func (m *QueryParticipationEMAsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ParticipationEma = string(dAtA[iNdEx:postIndex]) + m.ValShares = append(m.ValShares, &GovernorValShares{}) + if err := m.ValShares[len(m.ValShares)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConstitutionAmendmentParticipationEma", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5794,55 +8111,27 @@ func (m *QueryParticipationEMAsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ConstitutionAmendmentParticipationEma = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LawParticipationEma", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.LawParticipationEma = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/gov/types/v1/query.pb.gw.go b/x/gov/types/v1/query.pb.gw.go index 62a9fba2..8015eddb 100644 --- a/x/gov/types/v1/query.pb.gw.go +++ b/x/gov/types/v1/query.pb.gw.go @@ -617,6 +617,294 @@ func local_request_Query_ParticipationEMAs_0(ctx context.Context, marshaler runt } +func request_Query_Governor_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + msg, err := client.Governor(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Governor_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + msg, err := server.Governor(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Governors_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Governors_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Governors_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Governors(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Governors_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Governors_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Governors(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_GovernanceDelegations_0 = &utilities.DoubleArray{Encoding: map[string]int{"governor_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_GovernanceDelegations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernanceDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GovernanceDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GovernanceDelegations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GovernanceDelegations_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernanceDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GovernanceDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GovernanceDelegations(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GovernanceDelegation_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernanceDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := client.GovernanceDelegation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GovernanceDelegation_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernanceDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := server.GovernanceDelegation(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_GovernorValShares_0 = &utilities.DoubleArray{Encoding: map[string]int{"governor_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_GovernorValShares_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorValSharesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GovernorValShares_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GovernorValShares(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GovernorValShares_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorValSharesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GovernorValShares_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GovernorValShares(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -922,6 +1210,121 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_Governor_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Governor_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Governor_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Governors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Governors_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Governors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernanceDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GovernanceDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernanceDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernanceDelegation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GovernanceDelegation_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernanceDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernorValShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GovernorValShares_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernorValShares_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1223,6 +1626,106 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_Governor_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Governor_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Governor_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Governors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Governors_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Governors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernanceDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GovernanceDelegations_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernanceDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernanceDelegation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GovernanceDelegation_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernanceDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernorValShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GovernorValShares_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernorValShares_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1252,6 +1755,16 @@ var ( pattern_Query_Quorums_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"atomone", "gov", "v1", "quorums"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ParticipationEMAs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"atomone", "gov", "v1", "participationemas"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Governor_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"atomone", "gov", "v1", "governors", "governor_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Governors_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"atomone", "gov", "v1", "governors"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GovernanceDelegations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"atomone", "gov", "v1", "governors", "governor_address", "delegations"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GovernanceDelegation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"atomone", "gov", "v1", "delegations", "delegator_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GovernorValShares_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"atomone", "gov", "v1", "vshares", "governor_address"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1280,4 +1793,14 @@ var ( forward_Query_Quorums_0 = runtime.ForwardResponseMessage forward_Query_ParticipationEMAs_0 = runtime.ForwardResponseMessage + + forward_Query_Governor_0 = runtime.ForwardResponseMessage + + forward_Query_Governors_0 = runtime.ForwardResponseMessage + + forward_Query_GovernanceDelegations_0 = runtime.ForwardResponseMessage + + forward_Query_GovernanceDelegation_0 = runtime.ForwardResponseMessage + + forward_Query_GovernorValShares_0 = runtime.ForwardResponseMessage ) diff --git a/x/gov/types/v1/tally.go b/x/gov/types/v1/tally.go index 57c163fc..bbbfeccc 100644 --- a/x/gov/types/v1/tally.go +++ b/x/gov/types/v1/tally.go @@ -2,8 +2,35 @@ package v1 import ( "cosmossdk.io/math" + + "github.com/atomone-hub/atomone/x/gov/types" ) +// GovernorGovInfo used for tallying +type GovernorGovInfo struct { + Address types.GovernorAddress // address of the governor + ValShares map[string]math.LegacyDec // shares held for each validator + ValSharesDeductions map[string]math.LegacyDec // deductions from validator's shares when a delegator votes independently + Vote WeightedVoteOptions // vote of the governor +} + +// NewGovernorGovInfo creates a GovernorGovInfo instance +func NewGovernorGovInfo(address types.GovernorAddress, valShares []GovernorValShares, options WeightedVoteOptions) GovernorGovInfo { + valSharesMap := make(map[string]math.LegacyDec) + valSharesDeductionsMap := make(map[string]math.LegacyDec) + for _, valShare := range valShares { + valSharesMap[valShare.ValidatorAddress] = valShare.Shares + valSharesDeductionsMap[valShare.ValidatorAddress] = math.LegacyZeroDec() + } + + return GovernorGovInfo{ + Address: address, + ValShares: valSharesMap, + ValSharesDeductions: valSharesDeductionsMap, + Vote: options, + } +} + // NewTallyResult creates a new TallyResult instance func NewTallyResult(yes, abstain, no math.Int) TallyResult { return TallyResult{ diff --git a/x/gov/types/v1/tx.pb.go b/x/gov/types/v1/tx.pb.go index 791d2634..6e126d22 100644 --- a/x/gov/types/v1/tx.pb.go +++ b/x/gov/types/v1/tx.pb.go @@ -871,6 +871,389 @@ func (m *MsgProposeConstitutionAmendmentResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgProposeConstitutionAmendmentResponse proto.InternalMessageInfo +// MsgCreateGovernor defines a SDK message for creating a new governor. +type MsgCreateGovernor struct { + // address is the base account address that is creating the governor. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Description GovernorDescription `protobuf:"bytes,2,opt,name=description,proto3" json:"description"` +} + +func (m *MsgCreateGovernor) Reset() { *m = MsgCreateGovernor{} } +func (m *MsgCreateGovernor) String() string { return proto.CompactTextString(m) } +func (*MsgCreateGovernor) ProtoMessage() {} +func (*MsgCreateGovernor) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{16} +} +func (m *MsgCreateGovernor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateGovernor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateGovernor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateGovernor) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateGovernor.Merge(m, src) +} +func (m *MsgCreateGovernor) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateGovernor) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateGovernor.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateGovernor proto.InternalMessageInfo + +// MsgCreateGovernorrResponse defines the Msg/CreateGovernor response type. +type MsgCreateGovernorResponse struct { +} + +func (m *MsgCreateGovernorResponse) Reset() { *m = MsgCreateGovernorResponse{} } +func (m *MsgCreateGovernorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateGovernorResponse) ProtoMessage() {} +func (*MsgCreateGovernorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{17} +} +func (m *MsgCreateGovernorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateGovernorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateGovernorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateGovernorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateGovernorResponse.Merge(m, src) +} +func (m *MsgCreateGovernorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateGovernorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateGovernorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateGovernorResponse proto.InternalMessageInfo + +// MsgEditGovernor defines a SDK message for editing an existing governor. +type MsgEditGovernor struct { + // address is the base account address that is editing the corresponding governor. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Description GovernorDescription `protobuf:"bytes,2,opt,name=description,proto3" json:"description"` +} + +func (m *MsgEditGovernor) Reset() { *m = MsgEditGovernor{} } +func (m *MsgEditGovernor) String() string { return proto.CompactTextString(m) } +func (*MsgEditGovernor) ProtoMessage() {} +func (*MsgEditGovernor) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{18} +} +func (m *MsgEditGovernor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditGovernor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditGovernor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgEditGovernor) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditGovernor.Merge(m, src) +} +func (m *MsgEditGovernor) XXX_Size() int { + return m.Size() +} +func (m *MsgEditGovernor) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditGovernor.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditGovernor proto.InternalMessageInfo + +// MsgEditGovernorResponse defines the Msg/EditGovernor response type. +type MsgEditGovernorResponse struct { +} + +func (m *MsgEditGovernorResponse) Reset() { *m = MsgEditGovernorResponse{} } +func (m *MsgEditGovernorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgEditGovernorResponse) ProtoMessage() {} +func (*MsgEditGovernorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{19} +} +func (m *MsgEditGovernorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditGovernorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditGovernorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgEditGovernorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditGovernorResponse.Merge(m, src) +} +func (m *MsgEditGovernorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEditGovernorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditGovernorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditGovernorResponse proto.InternalMessageInfo + +// MsgUpdateGovernorStatus defines a SDK message for updating the status of a governor. +type MsgUpdateGovernorStatus struct { + // address is the base account address that is editing the corresponding governor. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Status GovernorStatus `protobuf:"varint,2,opt,name=status,proto3,enum=atomone.gov.v1.GovernorStatus" json:"status,omitempty"` +} + +func (m *MsgUpdateGovernorStatus) Reset() { *m = MsgUpdateGovernorStatus{} } +func (m *MsgUpdateGovernorStatus) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateGovernorStatus) ProtoMessage() {} +func (*MsgUpdateGovernorStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{20} +} +func (m *MsgUpdateGovernorStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateGovernorStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateGovernorStatus.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateGovernorStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateGovernorStatus.Merge(m, src) +} +func (m *MsgUpdateGovernorStatus) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateGovernorStatus) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateGovernorStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateGovernorStatus proto.InternalMessageInfo + +// MsgUpdateGovernorStatusResponse defines the Msg/UpdateGovernorStatus response type. +type MsgUpdateGovernorStatusResponse struct { +} + +func (m *MsgUpdateGovernorStatusResponse) Reset() { *m = MsgUpdateGovernorStatusResponse{} } +func (m *MsgUpdateGovernorStatusResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateGovernorStatusResponse) ProtoMessage() {} +func (*MsgUpdateGovernorStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{21} +} +func (m *MsgUpdateGovernorStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateGovernorStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateGovernorStatusResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateGovernorStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateGovernorStatusResponse.Merge(m, src) +} +func (m *MsgUpdateGovernorStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateGovernorStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateGovernorStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateGovernorStatusResponse proto.InternalMessageInfo + +// MsgDelegateGovernor defines a SDK message for performing a delegation of governance voting power +// from a delegator to a governor. +type MsgDelegateGovernor struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + GovernorAddress string `protobuf:"bytes,2,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` +} + +func (m *MsgDelegateGovernor) Reset() { *m = MsgDelegateGovernor{} } +func (m *MsgDelegateGovernor) String() string { return proto.CompactTextString(m) } +func (*MsgDelegateGovernor) ProtoMessage() {} +func (*MsgDelegateGovernor) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{22} +} +func (m *MsgDelegateGovernor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegateGovernor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegateGovernor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDelegateGovernor) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegateGovernor.Merge(m, src) +} +func (m *MsgDelegateGovernor) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegateGovernor) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegateGovernor.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegateGovernor proto.InternalMessageInfo + +// MsgDelegateGovernorResponse defines the Msg/Delegate response type. +type MsgDelegateGovernorResponse struct { +} + +func (m *MsgDelegateGovernorResponse) Reset() { *m = MsgDelegateGovernorResponse{} } +func (m *MsgDelegateGovernorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDelegateGovernorResponse) ProtoMessage() {} +func (*MsgDelegateGovernorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{23} +} +func (m *MsgDelegateGovernorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegateGovernorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegateGovernorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDelegateGovernorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegateGovernorResponse.Merge(m, src) +} +func (m *MsgDelegateGovernorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegateGovernorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegateGovernorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegateGovernorResponse proto.InternalMessageInfo + +// MsgUndelegateGovernor defines a SDK message for undelegating governance voting power +type MsgUndelegateGovernor struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` +} + +func (m *MsgUndelegateGovernor) Reset() { *m = MsgUndelegateGovernor{} } +func (m *MsgUndelegateGovernor) String() string { return proto.CompactTextString(m) } +func (*MsgUndelegateGovernor) ProtoMessage() {} +func (*MsgUndelegateGovernor) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{24} +} +func (m *MsgUndelegateGovernor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUndelegateGovernor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUndelegateGovernor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUndelegateGovernor) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUndelegateGovernor.Merge(m, src) +} +func (m *MsgUndelegateGovernor) XXX_Size() int { + return m.Size() +} +func (m *MsgUndelegateGovernor) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUndelegateGovernor.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUndelegateGovernor proto.InternalMessageInfo + +// MsgUndelegateGovernorResponse defines the Msg/UndelegateGovernor response type. +type MsgUndelegateGovernorResponse struct { +} + +func (m *MsgUndelegateGovernorResponse) Reset() { *m = MsgUndelegateGovernorResponse{} } +func (m *MsgUndelegateGovernorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUndelegateGovernorResponse) ProtoMessage() {} +func (*MsgUndelegateGovernorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{25} +} +func (m *MsgUndelegateGovernorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUndelegateGovernorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUndelegateGovernorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUndelegateGovernorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUndelegateGovernorResponse.Merge(m, src) +} +func (m *MsgUndelegateGovernorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUndelegateGovernorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUndelegateGovernorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUndelegateGovernorResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSubmitProposal)(nil), "atomone.gov.v1.MsgSubmitProposal") proto.RegisterType((*MsgSubmitProposalResponse)(nil), "atomone.gov.v1.MsgSubmitProposalResponse") @@ -888,77 +1271,107 @@ func init() { proto.RegisterType((*MsgProposeLawResponse)(nil), "atomone.gov.v1.MsgProposeLawResponse") proto.RegisterType((*MsgProposeConstitutionAmendment)(nil), "atomone.gov.v1.MsgProposeConstitutionAmendment") proto.RegisterType((*MsgProposeConstitutionAmendmentResponse)(nil), "atomone.gov.v1.MsgProposeConstitutionAmendmentResponse") + proto.RegisterType((*MsgCreateGovernor)(nil), "atomone.gov.v1.MsgCreateGovernor") + proto.RegisterType((*MsgCreateGovernorResponse)(nil), "atomone.gov.v1.MsgCreateGovernorResponse") + proto.RegisterType((*MsgEditGovernor)(nil), "atomone.gov.v1.MsgEditGovernor") + proto.RegisterType((*MsgEditGovernorResponse)(nil), "atomone.gov.v1.MsgEditGovernorResponse") + proto.RegisterType((*MsgUpdateGovernorStatus)(nil), "atomone.gov.v1.MsgUpdateGovernorStatus") + proto.RegisterType((*MsgUpdateGovernorStatusResponse)(nil), "atomone.gov.v1.MsgUpdateGovernorStatusResponse") + proto.RegisterType((*MsgDelegateGovernor)(nil), "atomone.gov.v1.MsgDelegateGovernor") + proto.RegisterType((*MsgDelegateGovernorResponse)(nil), "atomone.gov.v1.MsgDelegateGovernorResponse") + proto.RegisterType((*MsgUndelegateGovernor)(nil), "atomone.gov.v1.MsgUndelegateGovernor") + proto.RegisterType((*MsgUndelegateGovernorResponse)(nil), "atomone.gov.v1.MsgUndelegateGovernorResponse") } func init() { proto.RegisterFile("atomone/gov/v1/tx.proto", fileDescriptor_f6c84786701fca8d) } var fileDescriptor_f6c84786701fca8d = []byte{ - // 1026 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4d, 0x6f, 0x1b, 0x45, - 0x18, 0xce, 0xe6, 0xb3, 0x79, 0x03, 0xa9, 0xb2, 0x72, 0xf1, 0x66, 0x09, 0x76, 0xba, 0x2a, 0x6a, - 0x12, 0x91, 0x5d, 0xec, 0x02, 0x15, 0x56, 0x0e, 0xc4, 0x01, 0xa1, 0x4a, 0xb5, 0x5a, 0xb9, 0xe2, - 0x43, 0x1c, 0x88, 0xc6, 0xf6, 0x30, 0x59, 0x29, 0xbb, 0xb3, 0xf2, 0x8c, 0x4d, 0xcc, 0x09, 0x71, - 0x42, 0x9c, 0xf8, 0x19, 0x1c, 0x73, 0xe8, 0xa5, 0x7f, 0x00, 0x55, 0x9c, 0x2a, 0x4e, 0x9c, 0x2a, - 0x94, 0x1c, 0x22, 0x71, 0xe7, 0x88, 0x84, 0x66, 0x67, 0x66, 0xed, 0xf5, 0xae, 0xed, 0x92, 0x03, - 0x17, 0x6b, 0xe7, 0xfd, 0x9a, 0xe7, 0x79, 0x66, 0xde, 0x77, 0x0c, 0x45, 0xc4, 0x69, 0x40, 0x43, - 0xec, 0x11, 0xda, 0xf7, 0xfa, 0x15, 0x8f, 0x9f, 0xb9, 0x51, 0x97, 0x72, 0x6a, 0xae, 0x2b, 0x87, - 0x4b, 0x68, 0xdf, 0xed, 0x57, 0xec, 0x52, 0x9b, 0xb2, 0x80, 0x32, 0xaf, 0x85, 0x18, 0xf6, 0xfa, - 0x95, 0x16, 0xe6, 0xa8, 0xe2, 0xb5, 0xa9, 0x1f, 0xca, 0x78, 0xdb, 0x1a, 0x2b, 0x24, 0xd2, 0xa4, - 0xa7, 0x40, 0x28, 0xa1, 0xf1, 0xa7, 0x27, 0xbe, 0x94, 0x75, 0x53, 0xd6, 0x3b, 0x96, 0x0e, 0xb9, - 0xd0, 0x2e, 0x42, 0x29, 0x39, 0xc5, 0x5e, 0xbc, 0x6a, 0xf5, 0xbe, 0xf1, 0x50, 0x38, 0x50, 0xae, - 0xa2, 0x42, 0x11, 0x30, 0x22, 0x36, 0x09, 0x18, 0x51, 0x8e, 0x0d, 0x14, 0xf8, 0x21, 0xf5,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8, 0x9a, 0xda, 0x40, 0xde, 0xe4, 0x3a, 0xb9, 0x09, - 0xf6, 0xfd, 0xff, 0x98, 0xa0, 0xa1, 0xd8, 0x4b, 0xdf, 0x8b, 0x11, 0x56, 0xff, 0xf4, 0xf9, 0x45, - 0xc9, 0x78, 0x71, 0x51, 0x32, 0xfe, 0xbc, 0x28, 0x19, 0x3f, 0x5f, 0x96, 0xe6, 0x5e, 0x5c, 0x96, - 0xe6, 0xfe, 0xb8, 0x2c, 0xcd, 0x7d, 0xb5, 0x4f, 0x7c, 0x7e, 0xd2, 0x6b, 0xb9, 0x6d, 0x1a, 0x78, - 0x6a, 0x8f, 0xfd, 0x93, 0x5e, 0xcb, 0x4b, 0x77, 0x1e, 0x1f, 0x44, 0x98, 0x89, 0xff, 0xe7, 0xcb, - 0xf1, 0x9f, 0xa8, 0x7b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xec, 0xe9, 0xac, 0xe1, 0x0b, - 0x00, 0x00, + // 1358 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0x36, 0x4d, 0xd2, 0xbc, 0x7c, 0xbf, 0x69, 0xb3, 0xb8, 0xc4, 0xd9, 0xa4, 0x76, 0xba, + 0x2d, 0x6a, 0x52, 0xc8, 0x2e, 0x76, 0xa1, 0x15, 0xa6, 0x42, 0x34, 0x69, 0x55, 0x55, 0xaa, 0xd5, + 0xca, 0x55, 0x01, 0x71, 0x68, 0xb4, 0xf6, 0x0e, 0x9b, 0x85, 0xec, 0x8e, 0xb5, 0x33, 0x36, 0x0d, + 0x27, 0xc4, 0xa9, 0xe2, 0xc4, 0x9f, 0x50, 0x89, 0x0b, 0xc7, 0x1c, 0x7a, 0xe9, 0x95, 0x03, 0x54, + 0x08, 0xa4, 0x8a, 0x13, 0xa7, 0x0a, 0x35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, 0x5b, 0x0a, 0xa3, 0x58, 0x0a, 0x91, + 0xd9, 0x5c, 0x80, 0xf9, 0x9c, 0x29, 0xdd, 0x13, 0xd0, 0x24, 0x9e, 0xd8, 0xee, 0x87, 0xac, 0xca, + 0x45, 0x98, 0x4e, 0x0e, 0x1b, 0x3c, 0xba, 0x32, 0x03, 0xa8, 0x7e, 0x19, 0x26, 0x9d, 0x00, 0xf7, + 0x42, 0x9a, 0x14, 0xe7, 0x60, 0x67, 0x54, 0x12, 0xd3, 0x58, 0x61, 0x7b, 0x44, 0x66, 0x8b, 0xab, + 0x70, 0x32, 0x5b, 0x85, 0x44, 0x96, 0x59, 0x02, 0x7d, 0x30, 0x92, 0xda, 0x1f, 0xf3, 0xb6, 0xb8, + 0xdb, 0x75, 0x1d, 0x8a, 0x6e, 0x3b, 0x91, 0x13, 0x90, 0x58, 0xc9, 0x60, 0x57, 0x6a, 0xa3, 0x94, + 0x48, 0xa8, 0xfe, 0x16, 0x4c, 0x76, 0x59, 0x06, 0x26, 0x7f, 0xa6, 0xfe, 0x72, 0x7e, 0x99, 0x79, + 0xfe, 0x8c, 0x0c, 0x1e, 0xd0, 0xb8, 0x50, 0xdc, 0xea, 0xcb, 0x42, 0xc6, 0x7d, 0x71, 0x41, 0xe5, + 0x78, 0x26, 0x4b, 0x9a, 0x36, 0x49, 0x59, 0x9f, 0xc1, 0xff, 0x9b, 0xc4, 0xe3, 0x47, 0x1f, 0xba, + 0xe9, 0x7c, 0x7a, 0x58, 0x4d, 0x8d, 0x5a, 0x91, 0x58, 0x45, 0x45, 0x6c, 0x30, 0x95, 0x39, 0x0f, + 0x27, 0x33, 0x06, 0x49, 0x6a, 0x57, 0x83, 0xea, 0xc0, 0xb3, 0x81, 0x43, 0x42, 0x7d, 0xda, 0x8b, + 0xbb, 0xfc, 0x4a, 0x80, 0x42, 0x37, 0x88, 0x4f, 0xc4, 0xc3, 0xd6, 0x3e, 0x3e, 0x49, 0x45, 0x12, + 0x79, 0x92, 0x0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c, 0xb2, + 0xaf, 0x5b, 0xe6, 0x7c, 0xa0, 0xc1, 0xd2, 0xbe, 0xf7, 0xb5, 0x3d, 0x3c, 0x8f, 0x32, 0xc0, 0xb8, + 0xf4, 0x37, 0x03, 0x24, 0x95, 0x7b, 0x30, 0x9b, 0xbb, 0x5b, 0x55, 0x8d, 0x9e, 0x85, 0x28, 0x1b, + 0x5d, 0x7d, 0xa5, 0xc5, 0x0b, 0x93, 0xb9, 0xce, 0x54, 0x0b, 0x93, 0x06, 0x28, 0x17, 0x46, 0x75, + 0x85, 0xe8, 0x5d, 0x28, 0x29, 0xaf, 0x8f, 0xe1, 0x2b, 0x9b, 0x05, 0x1a, 0xf6, 0x01, 0x81, 0x72, + 0x46, 0x17, 0x4e, 0x14, 0x0e, 0xf2, 0x33, 0xca, 0xe6, 0xcc, 0x82, 0x8c, 0x57, 0x0f, 0x00, 0x92, + 0xb3, 0x7c, 0x0c, 0xba, 0xe2, 0x14, 0x55, 0x75, 0x56, 0x11, 0x66, 0xac, 0x1d, 0x08, 0x26, 0xe6, + 0x32, 0x26, 0x3e, 0x8f, 0xaf, 0xfa, 0xf5, 0xeb, 0x4f, 0x9e, 0x57, 0xb4, 0xa7, 0xcf, 0x2b, 0xda, + 0xaf, 0xcf, 0x2b, 0xda, 0x57, 0x7b, 0x95, 0xb1, 0xa7, 0x7b, 0x95, 0xb1, 0x5f, 0xf6, 0x2a, 0x63, + 0x1f, 0xae, 0x79, 0x3e, 0xdd, 0xea, 0xb5, 0xad, 0x0e, 0x0e, 0xec, 0x24, 0xf3, 0xda, 0x56, 0xaf, + 0x6d, 0x67, 0x9f, 0x79, 0x74, 0xa7, 0x8b, 0x88, 0xdd, 0xaf, 0xb5, 0x27, 0xd9, 0x3f, 0xf6, 0x0b, + 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xf0, 0x7c, 0xb5, 0x4e, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -996,6 +1409,18 @@ type MsgClient interface { // ProposeConstitutionAmendment defines a governance operation for proposing a // new constitution amendment. The authority is defined in the keeper. ProposeConstitutionAmendment(ctx context.Context, in *MsgProposeConstitutionAmendment, opts ...grpc.CallOption) (*MsgProposeConstitutionAmendmentResponse, error) + // CreateGovernor defines a method to create a new governor. + CreateGovernor(ctx context.Context, in *MsgCreateGovernor, opts ...grpc.CallOption) (*MsgCreateGovernorResponse, error) + // EditGovernor defines a method to edit an existing governor. + // It also sets its status. + EditGovernor(ctx context.Context, in *MsgEditGovernor, opts ...grpc.CallOption) (*MsgEditGovernorResponse, error) + // UpdateGovernorStatus defines a method to update the status of a governor. + UpdateGovernorStatus(ctx context.Context, in *MsgUpdateGovernorStatus, opts ...grpc.CallOption) (*MsgUpdateGovernorStatusResponse, error) + // DelegateGovernor defines a method to delegate a non-zero percentange of + // governance voting power from a delegator to a governor. + DelegateGovernor(ctx context.Context, in *MsgDelegateGovernor, opts ...grpc.CallOption) (*MsgDelegateGovernorResponse, error) + // UndelegateGovernor defines a method to undelegate governance voting power + UndelegateGovernor(ctx context.Context, in *MsgUndelegateGovernor, opts ...grpc.CallOption) (*MsgUndelegateGovernorResponse, error) } type msgClient struct { @@ -1078,6 +1503,51 @@ func (c *msgClient) ProposeConstitutionAmendment(ctx context.Context, in *MsgPro return out, nil } +func (c *msgClient) CreateGovernor(ctx context.Context, in *MsgCreateGovernor, opts ...grpc.CallOption) (*MsgCreateGovernorResponse, error) { + out := new(MsgCreateGovernorResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Msg/CreateGovernor", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) EditGovernor(ctx context.Context, in *MsgEditGovernor, opts ...grpc.CallOption) (*MsgEditGovernorResponse, error) { + out := new(MsgEditGovernorResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Msg/EditGovernor", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateGovernorStatus(ctx context.Context, in *MsgUpdateGovernorStatus, opts ...grpc.CallOption) (*MsgUpdateGovernorStatusResponse, error) { + out := new(MsgUpdateGovernorStatusResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Msg/UpdateGovernorStatus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DelegateGovernor(ctx context.Context, in *MsgDelegateGovernor, opts ...grpc.CallOption) (*MsgDelegateGovernorResponse, error) { + out := new(MsgDelegateGovernorResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Msg/DelegateGovernor", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UndelegateGovernor(ctx context.Context, in *MsgUndelegateGovernor, opts ...grpc.CallOption) (*MsgUndelegateGovernorResponse, error) { + out := new(MsgUndelegateGovernorResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Msg/UndelegateGovernor", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // SubmitProposal defines a method to create new proposal given the messages. @@ -1103,6 +1573,18 @@ type MsgServer interface { // ProposeConstitutionAmendment defines a governance operation for proposing a // new constitution amendment. The authority is defined in the keeper. ProposeConstitutionAmendment(context.Context, *MsgProposeConstitutionAmendment) (*MsgProposeConstitutionAmendmentResponse, error) + // CreateGovernor defines a method to create a new governor. + CreateGovernor(context.Context, *MsgCreateGovernor) (*MsgCreateGovernorResponse, error) + // EditGovernor defines a method to edit an existing governor. + // It also sets its status. + EditGovernor(context.Context, *MsgEditGovernor) (*MsgEditGovernorResponse, error) + // UpdateGovernorStatus defines a method to update the status of a governor. + UpdateGovernorStatus(context.Context, *MsgUpdateGovernorStatus) (*MsgUpdateGovernorStatusResponse, error) + // DelegateGovernor defines a method to delegate a non-zero percentange of + // governance voting power from a delegator to a governor. + DelegateGovernor(context.Context, *MsgDelegateGovernor) (*MsgDelegateGovernorResponse, error) + // UndelegateGovernor defines a method to undelegate governance voting power + UndelegateGovernor(context.Context, *MsgUndelegateGovernor) (*MsgUndelegateGovernorResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1133,6 +1615,21 @@ func (*UnimplementedMsgServer) ProposeLaw(ctx context.Context, req *MsgProposeLa func (*UnimplementedMsgServer) ProposeConstitutionAmendment(ctx context.Context, req *MsgProposeConstitutionAmendment) (*MsgProposeConstitutionAmendmentResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ProposeConstitutionAmendment not implemented") } +func (*UnimplementedMsgServer) CreateGovernor(ctx context.Context, req *MsgCreateGovernor) (*MsgCreateGovernorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateGovernor not implemented") +} +func (*UnimplementedMsgServer) EditGovernor(ctx context.Context, req *MsgEditGovernor) (*MsgEditGovernorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EditGovernor not implemented") +} +func (*UnimplementedMsgServer) UpdateGovernorStatus(ctx context.Context, req *MsgUpdateGovernorStatus) (*MsgUpdateGovernorStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateGovernorStatus not implemented") +} +func (*UnimplementedMsgServer) DelegateGovernor(ctx context.Context, req *MsgDelegateGovernor) (*MsgDelegateGovernorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegateGovernor not implemented") +} +func (*UnimplementedMsgServer) UndelegateGovernor(ctx context.Context, req *MsgUndelegateGovernor) (*MsgUndelegateGovernorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UndelegateGovernor not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1282,17 +1779,107 @@ func _Msg_ProposeConstitutionAmendment_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } -var Msg_serviceDesc = _Msg_serviceDesc -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "atomone.gov.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SubmitProposal", - Handler: _Msg_SubmitProposal_Handler, - }, - { - MethodName: "ExecLegacyContent", +func _Msg_CreateGovernor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateGovernor) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateGovernor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Msg/CreateGovernor", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateGovernor(ctx, req.(*MsgCreateGovernor)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_EditGovernor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEditGovernor) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EditGovernor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Msg/EditGovernor", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EditGovernor(ctx, req.(*MsgEditGovernor)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateGovernorStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateGovernorStatus) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateGovernorStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Msg/UpdateGovernorStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateGovernorStatus(ctx, req.(*MsgUpdateGovernorStatus)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DelegateGovernor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDelegateGovernor) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DelegateGovernor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Msg/DelegateGovernor", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DelegateGovernor(ctx, req.(*MsgDelegateGovernor)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UndelegateGovernor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUndelegateGovernor) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UndelegateGovernor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Msg/UndelegateGovernor", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UndelegateGovernor(ctx, req.(*MsgUndelegateGovernor)) + } + return interceptor(ctx, in, info, handler) +} + +var Msg_serviceDesc = _Msg_serviceDesc +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "atomone.gov.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SubmitProposal", + Handler: _Msg_SubmitProposal_Handler, + }, + { + MethodName: "ExecLegacyContent", Handler: _Msg_ExecLegacyContent_Handler, }, { @@ -1319,6 +1906,26 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ProposeConstitutionAmendment", Handler: _Msg_ProposeConstitutionAmendment_Handler, }, + { + MethodName: "CreateGovernor", + Handler: _Msg_CreateGovernor_Handler, + }, + { + MethodName: "EditGovernor", + Handler: _Msg_EditGovernor_Handler, + }, + { + MethodName: "UpdateGovernorStatus", + Handler: _Msg_UpdateGovernorStatus_Handler, + }, + { + MethodName: "DelegateGovernor", + Handler: _Msg_DelegateGovernor_Handler, + }, + { + MethodName: "UndelegateGovernor", + Handler: _Msg_UndelegateGovernor_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "atomone/gov/v1/tx.proto", @@ -1893,127 +2500,424 @@ func (m *MsgProposeConstitutionAmendmentResponse) MarshalToSizedBuffer(dAtA []by return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgCreateGovernor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgSubmitProposal) Size() (n int) { - if m == nil { - return 0 - } + +func (m *MsgCreateGovernor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateGovernor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Messages) > 0 { - for _, e := range m.Messages { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if len(m.InitialDeposit) > 0 { - for _, e := range m.InitialDeposit { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - l = len(m.Proposer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Metadata) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Title) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Summary) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *MsgSubmitProposalResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) +func (m *MsgCreateGovernorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *MsgExecLegacyContent) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n +func (m *MsgCreateGovernorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgExecLegacyContentResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgCreateGovernorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *MsgVote) Size() (n int) { - if m == nil { - return 0 +func (m *MsgEditGovernor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *MsgEditGovernor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditGovernor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Option != 0 { - n += 1 + sovTx(uint64(m.Option)) + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - l = len(m.Metadata) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *MsgVoteResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgEditGovernorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *MsgEditGovernorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditGovernorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *MsgVoteWeighted) Size() (n int) { - if m == nil { - return 0 +func (m *MsgUpdateGovernorStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateGovernorStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateGovernorStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Status != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateGovernorStatusResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateGovernorStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateGovernorStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDelegateGovernor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDelegateGovernor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegateGovernor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDelegateGovernorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDelegateGovernorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegateGovernorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUndelegateGovernor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUndelegateGovernor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUndelegateGovernor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUndelegateGovernorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUndelegateGovernorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUndelegateGovernorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSubmitProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Messages) > 0 { + for _, e := range m.Messages { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.InitialDeposit) > 0 { + for _, e := range m.InitialDeposit { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Metadata) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Title) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Summary) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + return n +} + +func (m *MsgExecLegacyContent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgExecLegacyContentResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgVote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Option != 0 { + n += 1 + sovTx(uint64(m.Option)) + } + l = len(m.Metadata) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgVoteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgVoteWeighted) Size() (n int) { + if m == nil { + return 0 } var l int _ = l @@ -2149,12 +3053,133 @@ func (m *MsgProposeConstitutionAmendmentResponse) Size() (n int) { return n } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} +func (m *MsgCreateGovernor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgCreateGovernorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgEditGovernor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgEditGovernorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateGovernorStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovTx(uint64(m.Status)) + } + return n +} + +func (m *MsgUpdateGovernorStatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDelegateGovernor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDelegateGovernorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUndelegateGovernor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUndelegateGovernorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2222,7 +3247,875 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InitialDeposit", wireType) } - var msglen int + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) + if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Summary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitProposalResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExecLegacyContent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgExecLegacyContent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecLegacyContent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &types.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExecLegacyContentResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgExecLegacyContentResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecLegacyContentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVote) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgVote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVoteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgVoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgVoteWeighted: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteWeighted: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, &WeightedVoteOption{}) + if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVoteWeightedResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgVoteWeightedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteWeightedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeposit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2232,29 +4125,14 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.ProposalId |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) - if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2282,13 +4160,13 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Proposer = string(dAtA[iNdEx:postIndex]) + m.Depositor = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2298,27 +4176,129 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Metadata = string(dAtA[iNdEx:postIndex]) + m.Amount = append(m.Amount, types1.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 5: + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2346,13 +4326,13 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Title = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2362,23 +4342,24 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Summary = string(dAtA[iNdEx:postIndex]) + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2401,7 +4382,7 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSubmitProposalResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2424,31 +4405,12 @@ func (m *MsgSubmitProposalResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitProposalResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2470,7 +4432,7 @@ func (m *MsgSubmitProposalResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgExecLegacyContent) Unmarshal(dAtA []byte) error { +func (m *MsgProposeLaw) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2493,49 +4455,13 @@ func (m *MsgExecLegacyContent) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgExecLegacyContent: wiretype end group for non-group") + return fmt.Errorf("proto: MsgProposeLaw: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExecLegacyContent: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgProposeLaw: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Content == nil { - m.Content = &types.Any{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } @@ -2588,7 +4514,7 @@ func (m *MsgExecLegacyContent) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgExecLegacyContentResponse) Unmarshal(dAtA []byte) error { +func (m *MsgProposeLawResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2611,10 +4537,10 @@ func (m *MsgExecLegacyContentResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgExecLegacyContentResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgProposeLawResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExecLegacyContentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgProposeLawResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2638,7 +4564,7 @@ func (m *MsgExecLegacyContentResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVote) Unmarshal(dAtA []byte) error { +func (m *MsgProposeConstitutionAmendment) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2661,34 +4587,15 @@ func (m *MsgVote) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVote: wiretype end group for non-group") + return fmt.Errorf("proto: MsgProposeConstitutionAmendment: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVote: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgProposeConstitutionAmendment: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2716,30 +4623,11 @@ func (m *MsgVote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Voter = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) - } - m.Option = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Option |= VoteOption(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amendment", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2767,7 +4655,7 @@ func (m *MsgVote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Metadata = string(dAtA[iNdEx:postIndex]) + m.Amendment = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2790,7 +4678,7 @@ func (m *MsgVote) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVoteResponse) Unmarshal(dAtA []byte) error { +func (m *MsgProposeConstitutionAmendmentResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2813,10 +4701,10 @@ func (m *MsgVoteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgProposeConstitutionAmendmentResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgProposeConstitutionAmendmentResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2840,7 +4728,7 @@ func (m *MsgVoteResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { +func (m *MsgCreateGovernor) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2863,34 +4751,15 @@ func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVoteWeighted: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateGovernor: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteWeighted: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateGovernor: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2918,11 +4787,11 @@ func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Voter = string(dAtA[iNdEx:postIndex]) + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2949,43 +4818,10 @@ func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Options = append(m.Options, &WeightedVoteOption{}) - if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metadata = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3007,7 +4843,7 @@ func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVoteWeightedResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCreateGovernorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3030,10 +4866,10 @@ func (m *MsgVoteWeightedResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVoteWeightedResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateGovernorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteWeightedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateGovernorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3057,7 +4893,7 @@ func (m *MsgVoteWeightedResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDeposit) Unmarshal(dAtA []byte) error { +func (m *MsgEditGovernor) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3080,34 +4916,15 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDeposit: wiretype end group for non-group") + return fmt.Errorf("proto: MsgEditGovernor: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgEditGovernor: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3135,11 +4952,11 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Depositor = string(dAtA[iNdEx:postIndex]) + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3166,8 +4983,7 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types1.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3192,7 +5008,7 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { +func (m *MsgEditGovernorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3215,10 +5031,10 @@ func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDepositResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgEditGovernorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgEditGovernorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3242,7 +5058,7 @@ func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateGovernorStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3265,15 +5081,15 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateGovernorStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateGovernorStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3301,13 +5117,13 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var msglen int + m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3317,25 +5133,11 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Status |= GovernorStatus(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3357,7 +5159,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateGovernorStatusResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3380,10 +5182,10 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateGovernorStatusResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateGovernorStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3407,7 +5209,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgProposeLaw) Unmarshal(dAtA []byte) error { +func (m *MsgDelegateGovernor) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3430,15 +5232,15 @@ func (m *MsgProposeLaw) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgProposeLaw: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDelegateGovernor: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgProposeLaw: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDelegateGovernor: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3466,7 +5268,39 @@ func (m *MsgProposeLaw) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3489,7 +5323,7 @@ func (m *MsgProposeLaw) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgProposeLawResponse) Unmarshal(dAtA []byte) error { +func (m *MsgDelegateGovernorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3512,10 +5346,10 @@ func (m *MsgProposeLawResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgProposeLawResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDelegateGovernorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgProposeLawResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDelegateGovernorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3539,7 +5373,7 @@ func (m *MsgProposeLawResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgProposeConstitutionAmendment) Unmarshal(dAtA []byte) error { +func (m *MsgUndelegateGovernor) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3562,47 +5396,15 @@ func (m *MsgProposeConstitutionAmendment) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgProposeConstitutionAmendment: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUndelegateGovernor: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgProposeConstitutionAmendment: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUndelegateGovernor: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amendment", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3630,7 +5432,7 @@ func (m *MsgProposeConstitutionAmendment) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amendment = string(dAtA[iNdEx:postIndex]) + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3653,7 +5455,7 @@ func (m *MsgProposeConstitutionAmendment) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgProposeConstitutionAmendmentResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUndelegateGovernorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3676,10 +5478,10 @@ func (m *MsgProposeConstitutionAmendmentResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgProposeConstitutionAmendmentResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUndelegateGovernorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgProposeConstitutionAmendmentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUndelegateGovernorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/gov/types/v1/vote.go b/x/gov/types/v1/vote.go index cd6d2a21..794782e4 100644 --- a/x/gov/types/v1/vote.go +++ b/x/gov/types/v1/vote.go @@ -76,6 +76,19 @@ func (w *WeightedVoteOption) IsValid() bool { return ValidVoteOption(w.Option) } +var oneDecStr = math.LegacyOneDec().String() + +func (v WeightedVoteOption) Power(totalPower math.LegacyDec) math.LegacyDec { + // v.Weight is very often equal to 1, because most voters do not + // use weighted votes. By using this stat, we can save on calls to + // the costly `math.LegacyNewDecFromStr` function. + if v.Weight == oneDecStr { + return totalPower + } + weight, _ := math.LegacyNewDecFromStr(v.Weight) + return totalPower.Mul(weight) +} + // NewNonSplitVoteOption creates a single option vote with weight 1 func NewNonSplitVoteOption(option VoteOption) WeightedVoteOptions { return WeightedVoteOptions{{option, math.LegacyNewDec(1).String()}}