From 77fc5ce791c64313237fcb1838067050dbfa8eeb Mon Sep 17 00:00:00 2001 From: Shogo Hyodo Date: Wed, 19 Oct 2022 14:20:51 +0900 Subject: [PATCH 1/5] fix: remove `VRFProve` (#731) * Remove `VRFProve` * Update `CHANGELOG.md` --- CHANGELOG.md | 1 + crypto/ledger/ledger_secp256k1.go | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10f0a01cf9..f6cb9eb2ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,6 +107,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (baseapp) [\#724](https://github.com/line/lbm-sdk/pull/724) add checking pubkey type from validator params * (x/staking) [\#726](https://github.com/line/lbm-sdk/pull/726) check allowedList size in StakeAuthorization.Accept() * (x/staking) [\#728](https://github.com/line/lbm-sdk/pull/728) fix typo in unbondingToUnbonded() panic +* (crypto) [\#731](https://github.com/line/lbm-sdk/pull/731) remove VRFProve function * (x/foundation) [\#732](https://github.com/line/lbm-sdk/pull/732) add verification on accounts into x/foundation Grants cli ### Breaking Changes diff --git a/crypto/ledger/ledger_secp256k1.go b/crypto/ledger/ledger_secp256k1.go index 7c8c669d57..9b5feb9de4 100644 --- a/crypto/ledger/ledger_secp256k1.go +++ b/crypto/ledger/ledger_secp256k1.go @@ -5,7 +5,6 @@ import ( "os" "github.com/btcsuite/btcd/btcec" - "github.com/line/ostracon/crypto" "github.com/pkg/errors" tmbtcec "github.com/tendermint/btcd/btcec" @@ -91,10 +90,6 @@ func (pkl PrivKeyLedgerSecp256k1) PubKey() types.PubKey { return pkl.CachedPubKey } -func (pkl PrivKeyLedgerSecp256k1) VRFProve(seed []byte) (crypto.Proof, error) { - return nil, nil -} - // Sign returns a secp256k1 signature for the corresponding message func (pkl PrivKeyLedgerSecp256k1) Sign(message []byte) ([]byte, error) { device, err := getDevice() From 392277a33519d289154e8da27f05f9a6788ab076 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Wed, 19 Oct 2022 06:02:16 +0000 Subject: [PATCH 2/5] refactor: add UpdateParams to x/foundation (#729) * Update comments in tx.proto * Remove UpdateFoundationParamsProposal Replace the proposal into the corresponding msg. * Remove old logics and add stubs * Implement MsgUpdateParams * Implement UpdateParams * Implement cli * Update name of the corresponding event * Update CHANGELOG.md --- CHANGELOG.md | 1 + docs/core/proto-docs.md | 94 ++-- proto/lbm/foundation/v1/event.proto | 4 +- proto/lbm/foundation/v1/foundation.proto | 15 - proto/lbm/foundation/v1/tx.proto | 45 +- simapp/app.go | 3 - x/foundation/client/cli/tx.go | 54 +- x/foundation/client/proposal_handler.go | 9 - x/foundation/client/testutil/tx.go | 64 ++- x/foundation/codec.go | 6 +- x/foundation/event.pb.go | 144 +++--- x/foundation/foundation.pb.go | 512 +++++-------------- x/foundation/keeper/handler.go | 19 - x/foundation/keeper/msg_server.go | 20 + x/foundation/keeper/msg_server_test.go | 45 ++ x/foundation/keeper/proposal.go | 16 - x/foundation/msgs.go | 21 + x/foundation/msgs_test.go | 46 ++ x/foundation/proposal.go | 42 -- x/foundation/proposal_test.go | 62 --- x/foundation/tx.pb.go | 599 ++++++++++++++++++----- 21 files changed, 948 insertions(+), 873 deletions(-) delete mode 100644 x/foundation/client/proposal_handler.go delete mode 100644 x/foundation/keeper/handler.go delete mode 100644 x/foundation/proposal.go delete mode 100644 x/foundation/proposal_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index f6cb9eb2ce..6c08a29c1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/bank) [\#716](https://github.com/line/lbm-sdk/pull/716) remove useless DenomMetadata key function * (x/foundation) [\#704](https://github.com/line/lbm-sdk/pull/704) update x/foundation params * (x/wasm) [\#695](https://github.com/line/lbm-sdk/pull/695) fix to prevent external filesystem dependency of simulation +* (x/foundation) [\#729](https://github.com/line/lbm-sdk/pull/729) add UpdateParams to x/foundation ### Bug Fixes * (x/wasm) [\#453](https://github.com/line/lbm-sdk/pull/453) modify wasm grpc query api path diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index d2ce347bad..e14036c0dc 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -1114,7 +1114,6 @@ - [Proposal](#lbm.foundation.v1.Proposal) - [TallyResult](#lbm.foundation.v1.TallyResult) - [ThresholdDecisionPolicy](#lbm.foundation.v1.ThresholdDecisionPolicy) - - [UpdateFoundationParamsProposal](#lbm.foundation.v1.UpdateFoundationParamsProposal) - [Vote](#lbm.foundation.v1.Vote) - [ProposalExecutorResult](#lbm.foundation.v1.ProposalExecutorResult) @@ -1130,8 +1129,8 @@ - [EventRevoke](#lbm.foundation.v1.EventRevoke) - [EventSubmitProposal](#lbm.foundation.v1.EventSubmitProposal) - [EventUpdateDecisionPolicy](#lbm.foundation.v1.EventUpdateDecisionPolicy) - - [EventUpdateFoundationParams](#lbm.foundation.v1.EventUpdateFoundationParams) - [EventUpdateMembers](#lbm.foundation.v1.EventUpdateMembers) + - [EventUpdateParams](#lbm.foundation.v1.EventUpdateParams) - [EventVote](#lbm.foundation.v1.EventVote) - [EventWithdrawFromTreasury](#lbm.foundation.v1.EventWithdrawFromTreasury) - [EventWithdrawProposal](#lbm.foundation.v1.EventWithdrawProposal) @@ -1187,6 +1186,8 @@ - [MsgUpdateDecisionPolicyResponse](#lbm.foundation.v1.MsgUpdateDecisionPolicyResponse) - [MsgUpdateMembers](#lbm.foundation.v1.MsgUpdateMembers) - [MsgUpdateMembersResponse](#lbm.foundation.v1.MsgUpdateMembersResponse) + - [MsgUpdateParams](#lbm.foundation.v1.MsgUpdateParams) + - [MsgUpdateParamsResponse](#lbm.foundation.v1.MsgUpdateParamsResponse) - [MsgVote](#lbm.foundation.v1.MsgVote) - [MsgVoteResponse](#lbm.foundation.v1.MsgVoteResponse) - [MsgWithdrawFromTreasury](#lbm.foundation.v1.MsgWithdrawFromTreasury) @@ -16986,25 +16987,6 @@ satisfies the two following conditions: - - -### UpdateFoundationParamsProposal -UpdateFoundationParamsProposal details a proposal to update params of foundation module. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | | -| `description` | [string](#string) | | | -| `params` | [Params](#lbm.foundation.v1.Params) | | params defines the x/foundation parameters to update. - -Note: All parameters must be supplied. | - - - - - - ### Vote @@ -17212,30 +17194,30 @@ EventUpdateDecisionPolicy is an event emitted when the decision policy have been - + -### EventUpdateFoundationParams -EventUpdateFoundationParams is emitted after updating foundation parameters. +### EventUpdateMembers +EventUpdateMembers is an event emitted when the members have been updated. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `params` | [Params](#lbm.foundation.v1.Params) | | | +| `member_updates` | [MemberRequest](#lbm.foundation.v1.MemberRequest) | repeated | | - + -### EventUpdateMembers -EventUpdateMembers is an event emitted when the members have been updated. +### EventUpdateParams +EventUpdateParams is emitted after updating foundation parameters. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `member_updates` | [MemberRequest](#lbm.foundation.v1.MemberRequest) | repeated | | +| `params` | [Params](#lbm.foundation.v1.Params) | | | @@ -17775,7 +17757,7 @@ MsgExecResponse is the Msg/Exec request type. ### MsgFundTreasury -MsgFundTreasury represents a message to fund the treasury. +MsgFundTreasury is the Msg/FundTreasury request type. | Field | Type | Label | Description | @@ -17791,7 +17773,7 @@ MsgFundTreasury represents a message to fund the treasury. ### MsgFundTreasuryResponse -MsgFundTreasuryResponse defines the Msg/FundTreasury response type. +MsgFundTreasuryResponse is the Msg/FundTreasury response type. @@ -17801,7 +17783,7 @@ MsgFundTreasuryResponse defines the Msg/FundTreasury response type. ### MsgGovMint -MsgGovMint represents a message to mint coins to the treasury. +MsgGovMint is the Msg/GovMint request type. | Field | Type | Label | Description | @@ -17817,7 +17799,7 @@ MsgGovMint represents a message to mint coins to the treasury. ### MsgGovMintResponse -MsgGovMintResponse defines the Msg/GovMint response type. +MsgGovMintResponse is the Msg/GovMint response type. @@ -17827,7 +17809,7 @@ MsgGovMintResponse defines the Msg/GovMint response type. ### MsgGrant -MsgGrant is a request type for Grant method. It declares authorization to the grantee +MsgGrant is the Msg/Grant request type. on behalf of the foundation. @@ -17845,7 +17827,7 @@ on behalf of the foundation. ### MsgGrantResponse -MsgGrantResponse defines the Msg/MsgGrant response type. +MsgGrantResponse is the Msg/MsgGrant response type. @@ -17880,8 +17862,7 @@ MsgLeaveFoundationResponse is the Msg/LeaveFoundation response type. ### MsgRevoke -MsgRevoke revokes any authorization with the provided sdk.Msg type -to the grantee on behalf of the foundation. +MsgRevoke is the Msg/Revoke request type. | Field | Type | Label | Description | @@ -17898,7 +17879,7 @@ to the grantee on behalf of the foundation. ### MsgRevokeResponse -MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. +MsgRevokeResponse is the Msg/MsgRevokeResponse response type. @@ -17990,6 +17971,34 @@ MsgUpdateMembersResponse is the Msg/UpdateMembers response type. + + +### MsgUpdateParams +MsgUpdateParams is the Msg/UpdateParams request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority is the address of the operator account. | +| `params` | [Params](#lbm.foundation.v1.Params) | | params defines the x/foundation parameters to update. + +NOTE: All parameters must be supplied. | + + + + + + + + +### MsgUpdateParamsResponse +MsgUpdateParamsResponse is the Msg/UpdateParams response type. + + + + + + ### MsgVote @@ -18022,7 +18031,7 @@ MsgVoteResponse is the Msg/Vote response type. ### MsgWithdrawFromTreasury -MsgWithdrawFromTreasury represents a message to withdraw coins from the treasury. +MsgWithdrawFromTreasury is the Msg/WithdrawFromTreasury request type. | Field | Type | Label | Description | @@ -18039,7 +18048,7 @@ MsgWithdrawFromTreasury represents a message to withdraw coins from the treasury ### MsgWithdrawFromTreasuryResponse -MsgWithdrawFromTreasuryResponse defines the Msg/WithdrawFromTreasury response type. +MsgWithdrawFromTreasuryResponse is the Msg/WithdrawFromTreasury response type. @@ -18097,6 +18106,7 @@ Msg defines the foundation Msg service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `UpdateParams` | [MsgUpdateParams](#lbm.foundation.v1.MsgUpdateParams) | [MsgUpdateParamsResponse](#lbm.foundation.v1.MsgUpdateParamsResponse) | UpdateParams defines an operation for updating the x/foundation module parameters. | | | `FundTreasury` | [MsgFundTreasury](#lbm.foundation.v1.MsgFundTreasury) | [MsgFundTreasuryResponse](#lbm.foundation.v1.MsgFundTreasuryResponse) | FundTreasury defines a method to fund the treasury. | | | `WithdrawFromTreasury` | [MsgWithdrawFromTreasury](#lbm.foundation.v1.MsgWithdrawFromTreasury) | [MsgWithdrawFromTreasuryResponse](#lbm.foundation.v1.MsgWithdrawFromTreasuryResponse) | WithdrawFromTreasury defines a method to withdraw coins from the treasury. | | | `UpdateMembers` | [MsgUpdateMembers](#lbm.foundation.v1.MsgUpdateMembers) | [MsgUpdateMembersResponse](#lbm.foundation.v1.MsgUpdateMembersResponse) | UpdateMembers updates the foundation members. | | @@ -18106,8 +18116,8 @@ Msg defines the foundation Msg service. | `Vote` | [MsgVote](#lbm.foundation.v1.MsgVote) | [MsgVoteResponse](#lbm.foundation.v1.MsgVoteResponse) | Vote allows a voter to vote on a proposal. | | | `Exec` | [MsgExec](#lbm.foundation.v1.MsgExec) | [MsgExecResponse](#lbm.foundation.v1.MsgExecResponse) | Exec executes a proposal. | | | `LeaveFoundation` | [MsgLeaveFoundation](#lbm.foundation.v1.MsgLeaveFoundation) | [MsgLeaveFoundationResponse](#lbm.foundation.v1.MsgLeaveFoundationResponse) | LeaveFoundation allows a member to leave the foundation. | | -| `Grant` | [MsgGrant](#lbm.foundation.v1.MsgGrant) | [MsgGrantResponse](#lbm.foundation.v1.MsgGrantResponse) | Grant grants the provided authorization to the grantee with authority of the foundation. If there is already a grant for the given (granter, grantee, Authorization) tuple, then the grant will be overwritten. | | -| `Revoke` | [MsgRevoke](#lbm.foundation.v1.MsgRevoke) | [MsgRevokeResponse](#lbm.foundation.v1.MsgRevokeResponse) | Revoke revokes any authorization corresponding to the provided method name on the granter that has been granted to the grantee. | | +| `Grant` | [MsgGrant](#lbm.foundation.v1.MsgGrant) | [MsgGrantResponse](#lbm.foundation.v1.MsgGrantResponse) | Grant grants the provided authorization to the grantee with authority of the foundation. If there is already a grant for the given (grantee, Authorization) tuple, then the grant will be overwritten. | | +| `Revoke` | [MsgRevoke](#lbm.foundation.v1.MsgRevoke) | [MsgRevokeResponse](#lbm.foundation.v1.MsgRevokeResponse) | Revoke revokes any authorization corresponding to the provided method name that has been granted to the grantee. | | | `GovMint` | [MsgGovMint](#lbm.foundation.v1.MsgGovMint) | [MsgGovMintResponse](#lbm.foundation.v1.MsgGovMintResponse) | GovMint defines a gov mint coins to the treasury. | | diff --git a/proto/lbm/foundation/v1/event.proto b/proto/lbm/foundation/v1/event.proto index 146d3df1e2..48355ba3f1 100644 --- a/proto/lbm/foundation/v1/event.proto +++ b/proto/lbm/foundation/v1/event.proto @@ -11,8 +11,8 @@ import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; import "lbm/foundation/v1/foundation.proto"; -// EventUpdateFoundationParams is emitted after updating foundation parameters. -message EventUpdateFoundationParams { +// EventUpdateParams is emitted after updating foundation parameters. +message EventUpdateParams { Params params = 1 [(gogoproto.nullable) = false]; } diff --git a/proto/lbm/foundation/v1/foundation.proto b/proto/lbm/foundation/v1/foundation.proto index c1f1df2962..aa838fea1f 100644 --- a/proto/lbm/foundation/v1/foundation.proto +++ b/proto/lbm/foundation/v1/foundation.proto @@ -18,21 +18,6 @@ message Params { repeated string censored_msg_type_urls = 2; } -// UpdateFoundationParamsProposal details a proposal to update params of foundation module. -message UpdateFoundationParamsProposal { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - string title = 1; - string description = 2; - - // params defines the x/foundation parameters to update. - // - // Note: All parameters must be supplied. - Params params = 3 [(gogoproto.nullable) = false]; -} - // Member represents a foundation member with an account address and metadata. message Member { // address is the member's account address. diff --git a/proto/lbm/foundation/v1/tx.proto b/proto/lbm/foundation/v1/tx.proto index 56d826b427..1718e2f43c 100644 --- a/proto/lbm/foundation/v1/tx.proto +++ b/proto/lbm/foundation/v1/tx.proto @@ -15,6 +15,10 @@ option (gogoproto.goproto_getters_all) = false; // Msg defines the foundation Msg service. service Msg { + // UpdateParams defines an operation for updating the x/foundation module + // parameters. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // FundTreasury defines a method to fund the treasury. rpc FundTreasury(MsgFundTreasury) returns (MsgFundTreasuryResponse); @@ -44,28 +48,42 @@ service Msg { // Grant grants the provided authorization to the grantee with authority of // the foundation. If there is already a grant for the given - // (granter, grantee, Authorization) tuple, then the grant will be overwritten. + // (grantee, Authorization) tuple, then the grant will be overwritten. rpc Grant(MsgGrant) returns (MsgGrantResponse); - // Revoke revokes any authorization corresponding to the provided method name on the - // granter that has been granted to the grantee. + // Revoke revokes any authorization corresponding to the provided method name + // that has been granted to the grantee. rpc Revoke(MsgRevoke) returns (MsgRevokeResponse); // GovMint defines a gov mint coins to the treasury. rpc GovMint(MsgGovMint) returns (MsgGovMintResponse); } -// MsgFundTreasury represents a message to fund the treasury. +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + // authority is the address of the operator account. + string authority = 1; + + // params defines the x/foundation parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse is the Msg/UpdateParams response type. +message MsgUpdateParamsResponse {} + +// MsgFundTreasury is the Msg/FundTreasury request type. message MsgFundTreasury { string from = 1; repeated cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/line/lbm-sdk/types.Coins"]; } -// MsgFundTreasuryResponse defines the Msg/FundTreasury response type. +// MsgFundTreasuryResponse is the Msg/FundTreasury response type. message MsgFundTreasuryResponse {} -// MsgWithdrawFromTreasury represents a message to withdraw coins from the treasury. +// MsgWithdrawFromTreasury is the Msg/WithdrawFromTreasury request type. message MsgWithdrawFromTreasury { string operator = 1; string to = 2; @@ -73,7 +91,7 @@ message MsgWithdrawFromTreasury { [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/line/lbm-sdk/types.Coins"]; } -// MsgWithdrawFromTreasuryResponse defines the Msg/WithdrawFromTreasury response type. +// MsgWithdrawFromTreasuryResponse is the Msg/WithdrawFromTreasury response type. message MsgWithdrawFromTreasuryResponse {} // MsgUpdateMembers is the Msg/UpdateMembers request type. @@ -193,7 +211,7 @@ message MsgLeaveFoundation { // MsgLeaveFoundationResponse is the Msg/LeaveFoundation response type. message MsgLeaveFoundationResponse {} -// MsgGrant is a request type for Grant method. It declares authorization to the grantee +// MsgGrant is the Msg/Grant request type. // on behalf of the foundation. message MsgGrant { string operator = 1; @@ -203,26 +221,25 @@ message MsgGrant { [(cosmos_proto.accepts_interface) = "github.com/line/lbm-sdk/x/foundation.Authorization"]; } -// MsgGrantResponse defines the Msg/MsgGrant response type. +// MsgGrantResponse is the Msg/MsgGrant response type. message MsgGrantResponse {} -// MsgRevoke revokes any authorization with the provided sdk.Msg type -// to the grantee on behalf of the foundation. +// MsgRevoke is the Msg/Revoke request type. message MsgRevoke { string operator = 1; string grantee = 2; string msg_type_url = 3; } -// MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. +// MsgRevokeResponse is the Msg/MsgRevokeResponse response type. message MsgRevokeResponse {} -// MsgGovMint represents a message to mint coins to the treasury. +// MsgGovMint is the Msg/GovMint request type. message MsgGovMint { string operator = 1; repeated cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/line/lbm-sdk/types.Coins"]; } -// MsgGovMintResponse defines the Msg/GovMint response type. +// MsgGovMintResponse is the Msg/GovMint response type. message MsgGovMintResponse {} diff --git a/simapp/app.go b/simapp/app.go index 0ec2228aa7..a5af2c3722 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -69,7 +69,6 @@ import ( feegrantkeeper "github.com/line/lbm-sdk/x/feegrant/keeper" feegrantmodule "github.com/line/lbm-sdk/x/feegrant/module" "github.com/line/lbm-sdk/x/foundation" - foundationclient "github.com/line/lbm-sdk/x/foundation/client" foundationkeeper "github.com/line/lbm-sdk/x/foundation/keeper" foundationmodule "github.com/line/lbm-sdk/x/foundation/module" "github.com/line/lbm-sdk/x/genutil" @@ -150,7 +149,6 @@ var ( gov.NewAppModuleBasic( append( wasmclient.ProposalHandlers, - foundationclient.UpdateFoundationParamsProposalHandler, paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, @@ -471,7 +469,6 @@ func NewSimApp( AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)). - AddRoute(foundation.RouterKey, foundationkeeper.NewProposalHandler(app.FoundationKeeper)). AddRoute(wasm.RouterKey, wasmkeeper.NewWasmProposalHandler(app.WasmKeeper, wasmlbmtypes.EnableAllProposals)) govKeeper := govkeeper.NewKeeper( diff --git a/x/foundation/client/cli/tx.go b/x/foundation/client/cli/tx.go index 6b700a6874..e412d74410 100644 --- a/x/foundation/client/cli/tx.go +++ b/x/foundation/client/cli/tx.go @@ -13,8 +13,6 @@ import ( "github.com/line/lbm-sdk/codec" sdk "github.com/line/lbm-sdk/types" "github.com/line/lbm-sdk/x/foundation" - "github.com/line/lbm-sdk/x/gov/client/cli" - govtypes "github.com/line/lbm-sdk/x/gov/types" ) // Proposal flags @@ -130,6 +128,7 @@ func NewTxCmd() *cobra.Command { } txCmd.AddCommand( + NewTxCmdUpdateParams(), NewTxCmdFundTreasury(), NewTxCmdWithdrawFromTreasury(), NewTxCmdUpdateMembers(), @@ -147,13 +146,12 @@ func NewTxCmd() *cobra.Command { return txCmd } -// NewProposalCmdUpdateFoundationParams implements the command to submit an update-foundation-params proposal -func NewProposalCmdUpdateFoundationParams() *cobra.Command { +func NewTxCmdUpdateParams() *cobra.Command { cmd := &cobra.Command{ - Use: "update-foundation-params [params-json]", - Args: cobra.ExactArgs(1), - Short: "Submit an update foundation params proposal", - Long: `Submit an update foundation params proposal. + Use: "update-params [authority] [params-json]", + Args: cobra.ExactArgs(2), + Short: "Update params", + Long: `Update x/foundation parameters. Example of the content of params-json: @@ -166,55 +164,33 @@ Example of the content of params-json: } `, RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - from := clientCtx.GetFromAddress() - - depositStr, err := cmd.Flags().GetString(cli.FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { + authority := args[0] + if err := cmd.Flags().Set(flags.FlagFrom, authority); err != nil { return err } - title, err := cmd.Flags().GetString(cli.FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(cli.FlagDescription) + clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - params, err := parseParams(clientCtx.Codec, args[0]) + params, err := parseParams(clientCtx.Codec, args[1]) if err != nil { return err } - content := foundation.NewUpdateFoundationParamsProposal(title, description, *params) - msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err + msg := foundation.MsgUpdateParams{ + Authority: authority, + Params: *params, } - if err := msg.ValidateBasic(); err != nil { return err } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) }, } - cmd.Flags().String(cli.FlagTitle, "", "title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "description of proposal") - cmd.Flags().String(cli.FlagDeposit, "", "deposit of proposal") - + flags.AddTxFlagsToCmd(cmd) return cmd } diff --git a/x/foundation/client/proposal_handler.go b/x/foundation/client/proposal_handler.go deleted file mode 100644 index c44bdc1a35..0000000000 --- a/x/foundation/client/proposal_handler.go +++ /dev/null @@ -1,9 +0,0 @@ -package client - -import ( - "github.com/line/lbm-sdk/x/foundation/client/cli" - "github.com/line/lbm-sdk/x/foundation/client/rest" - govclient "github.com/line/lbm-sdk/x/gov/client" -) - -var UpdateFoundationParamsProposalHandler = govclient.NewProposalHandler(cli.NewProposalCmdUpdateFoundationParams, rest.DummyRESTHandler) diff --git a/x/foundation/client/testutil/tx.go b/x/foundation/client/testutil/tx.go index 2d23ee405f..9f85692e80 100644 --- a/x/foundation/client/testutil/tx.go +++ b/x/foundation/client/testutil/tx.go @@ -4,8 +4,6 @@ import ( "fmt" "time" - "github.com/gogo/protobuf/proto" - "github.com/line/lbm-sdk/client/flags" clitestutil "github.com/line/lbm-sdk/testutil/cli" "github.com/line/lbm-sdk/testutil/testdata" @@ -15,54 +13,48 @@ import ( "github.com/line/lbm-sdk/x/foundation/client/cli" ) -func (s *IntegrationTestSuite) TestNewProposalCmdUpdateFoundationParams() { +func (s *IntegrationTestSuite) TestNewTxCmdUpdateParams() { val := s.network.Validators[0] - commonFlags := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)))), + commonArgs := []string{ + fmt.Sprintf("--%s", flags.FlagGenerateOnly), } - testCases := []struct { - name string - args []string - expectErr bool - expectedCode uint32 - respType proto.Message + testCases := map[string]struct { + args []string + valid bool }{ - { - "wrong number of args", - commonFlags, - true, 0, nil, + "valid transaction": { + []string{ + s.operator.String(), + fmt.Sprintf(`{"foundation_tax": "%s"}`, sdk.ZeroDec()), + }, + true, }, - { - "valid transaction", - append([]string{ + "wrong number of args": { + []string{ + s.operator.String(), fmt.Sprintf(`{"foundation_tax": "%s"}`, sdk.ZeroDec()), - }, commonFlags...), - false, 0, &sdk.TxResponse{}, + "extra", + }, + false, }, } - for _, tc := range testCases { + for name, tc := range testCases { tc := tc - s.Run(tc.name, func() { - cmd := cli.NewProposalCmdUpdateFoundationParams() - flags.AddTxFlagsToCmd(cmd) - - out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, tc.args) - if tc.expectErr { + s.Run(name, func() { + cmd := cli.NewTxCmdUpdateParams() + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, append(tc.args, commonArgs...)) + if !tc.valid { s.Require().Error(err) - } else { - s.Require().NoError(err) - s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out) - - txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code) + return } + s.Require().NoError(err) + + var res txtypes.Tx + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &res), out) }) } } diff --git a/x/foundation/codec.go b/x/foundation/codec.go index c3c79328ea..167f58fbc2 100644 --- a/x/foundation/codec.go +++ b/x/foundation/codec.go @@ -4,15 +4,11 @@ import ( "github.com/line/lbm-sdk/codec/types" sdk "github.com/line/lbm-sdk/types" "github.com/line/lbm-sdk/types/msgservice" - govtypes "github.com/line/lbm-sdk/x/gov/types" ) func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations((*govtypes.Content)(nil), - &UpdateFoundationParamsProposal{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, &MsgFundTreasury{}, &MsgWithdrawFromTreasury{}, &MsgUpdateMembers{}, diff --git a/x/foundation/event.pb.go b/x/foundation/event.pb.go index 339ed3fb52..40abeb1423 100644 --- a/x/foundation/event.pb.go +++ b/x/foundation/event.pb.go @@ -27,23 +27,23 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// EventUpdateFoundationParams is emitted after updating foundation parameters. -type EventUpdateFoundationParams struct { +// EventUpdateParams is emitted after updating foundation parameters. +type EventUpdateParams struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } -func (m *EventUpdateFoundationParams) Reset() { *m = EventUpdateFoundationParams{} } -func (m *EventUpdateFoundationParams) String() string { return proto.CompactTextString(m) } -func (*EventUpdateFoundationParams) ProtoMessage() {} -func (*EventUpdateFoundationParams) Descriptor() ([]byte, []int) { +func (m *EventUpdateParams) Reset() { *m = EventUpdateParams{} } +func (m *EventUpdateParams) String() string { return proto.CompactTextString(m) } +func (*EventUpdateParams) ProtoMessage() {} +func (*EventUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_2b66c645bbb34fbc, []int{0} } -func (m *EventUpdateFoundationParams) XXX_Unmarshal(b []byte) error { +func (m *EventUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventUpdateFoundationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventUpdateFoundationParams.Marshal(b, m, deterministic) + return xxx_messageInfo_EventUpdateParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -53,19 +53,19 @@ func (m *EventUpdateFoundationParams) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *EventUpdateFoundationParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventUpdateFoundationParams.Merge(m, src) +func (m *EventUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventUpdateParams.Merge(m, src) } -func (m *EventUpdateFoundationParams) XXX_Size() int { +func (m *EventUpdateParams) XXX_Size() int { return m.Size() } -func (m *EventUpdateFoundationParams) XXX_DiscardUnknown() { - xxx_messageInfo_EventUpdateFoundationParams.DiscardUnknown(m) +func (m *EventUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_EventUpdateParams.DiscardUnknown(m) } -var xxx_messageInfo_EventUpdateFoundationParams proto.InternalMessageInfo +var xxx_messageInfo_EventUpdateParams proto.InternalMessageInfo -func (m *EventUpdateFoundationParams) GetParams() Params { +func (m *EventUpdateParams) GetParams() Params { if m != nil { return m.Params } @@ -680,7 +680,7 @@ func (m *EventGovMint) GetAmount() github_com_line_lbm_sdk_types.Coins { } func init() { - proto.RegisterType((*EventUpdateFoundationParams)(nil), "lbm.foundation.v1.EventUpdateFoundationParams") + proto.RegisterType((*EventUpdateParams)(nil), "lbm.foundation.v1.EventUpdateParams") proto.RegisterType((*EventFundTreasury)(nil), "lbm.foundation.v1.EventFundTreasury") proto.RegisterType((*EventWithdrawFromTreasury)(nil), "lbm.foundation.v1.EventWithdrawFromTreasury") proto.RegisterType((*EventUpdateMembers)(nil), "lbm.foundation.v1.EventUpdateMembers") @@ -699,55 +699,55 @@ func init() { proto.RegisterFile("lbm/foundation/v1/event.proto", fileDescriptor var fileDescriptor_2b66c645bbb34fbc = []byte{ // 734 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x41, 0x4f, 0xd4, 0x4e, - 0x14, 0xdf, 0xc2, 0x66, 0xff, 0x7f, 0x06, 0x58, 0xc3, 0x88, 0x71, 0x81, 0xd8, 0xdd, 0x54, 0x0f, - 0x18, 0xb3, 0xad, 0x8b, 0x07, 0x8d, 0x89, 0x24, 0xac, 0x82, 0x31, 0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 0x98, - 0xf5, 0x80, 0xda, 0x3d, 0x8d, 0x60, 0x25, 0xb9, 0x1f, 0xc1, 0x90, 0x80, 0x49, 0x94, 0x89, 0x6d, - 0xca, 0xa2, 0x3d, 0x55, 0x4d, 0x29, 0xba, 0x68, 0x43, 0x5a, 0x87, 0xfb, 0xcd, 0xe6, 0x45, 0x37, - 0xb0, 0xeb, 0x48, 0xa2, 0x3d, 0x7b, 0x69, 0x90, 0xce, 0x1d, 0x66, 0xb7, 0x7c, 0x30, 0xae, 0x04, - 0xbb, 0x38, 0xa7, 0x3b, 0xf8, 0x9f, 0x14, 0x37, 0xc0, 0x04, 0xe1, 0x61, 0x47, 0x9e, 0x5c, 0x27, - 0x63, 0xb1, 0x1e, 0x21, 0x20, 0x3c, 0x5c, 0xef, 0xa6, 0x78, 0x83, 0xc5, 0x56, 0x02, 0x26, 0x8a, - 0xa9, 0xd0, 0x7c, 0x35, 0x4a, 0xc4, 0xc0, 0xa5, 0x1b, 0x97, 0x71, 0xe9, 0xed, 0xc5, 0x83, 0x63, - 0xd3, 0x38, 0x3a, 0x36, 0x8d, 0x5f, 0xc7, 0xa6, 0xf1, 0xf9, 0xc4, 0x2c, 0x1d, 0x9d, 0x98, 0xa5, - 0xef, 0x27, 0x66, 0xe9, 0xf5, 0xad, 0x8b, 0x87, 0x75, 0xba, 0x2e, 0x5e, 0x45, 0x0d, 0xf9, 0xde, - 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0x0c, 0x20, 0xbd, 0x64, 0x06, 0x00, 0x00, -} - -func (m *EventUpdateFoundationParams) Marshal() (dAtA []byte, err error) { + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x41, 0x4f, 0x14, 0x4b, + 0x10, 0xde, 0x81, 0xcd, 0xbe, 0x47, 0x03, 0xfb, 0xc2, 0x3c, 0x5e, 0xde, 0xc2, 0xcb, 0xdb, 0xdd, + 0x8c, 0x1e, 0x30, 0x66, 0x67, 0x5c, 0x3c, 0x68, 0x4c, 0x24, 0x61, 0x15, 0x8c, 0x09, 0x24, 0x38, + 0x82, 0x26, 0x1e, 0xdc, 0xf4, 0xcc, 0x34, 0xc3, 0x84, 0xe9, 0xa9, 0xb1, 0xbb, 0x67, 0x64, 0xb9, + 0x7a, 0xd0, 0xc4, 0x8b, 0x3f, 0xc1, 0xb3, 0x17, 0x2f, 0xfc, 0x08, 0xc2, 0x89, 0xa3, 0x27, 0x35, + 0xf0, 0x47, 0x4c, 0xf7, 0xf4, 0x2e, 0xbb, 0x01, 0x34, 0x31, 0xe1, 0x56, 0xd5, 0xf5, 0xd5, 0x57, + 0x5f, 0x55, 0x57, 0xa1, 0xff, 0x63, 0x8f, 0x3a, 0xdb, 0x90, 0x25, 0x01, 0x16, 0x11, 0x24, 0x4e, + 0xde, 0x76, 0x48, 0x4e, 0x12, 0x61, 0xa7, 0x0c, 0x04, 0x98, 0x33, 0xb1, 0x47, 0xed, 0xb3, 0xb0, + 0x9d, 0xb7, 0xe7, 0x67, 0x43, 0x08, 0x41, 0x45, 0x1d, 0x69, 0x15, 0xc0, 0xf9, 0xb9, 0x10, 0x20, + 0x8c, 0x89, 0xa3, 0x3c, 0x2f, 0xdb, 0x76, 0x70, 0xd2, 0xeb, 0x87, 0x7c, 0xe0, 0x14, 0x78, 0xb7, + 0xc8, 0x29, 0x1c, 0x1d, 0xaa, 0x17, 0x9e, 0xe3, 0x61, 0x4e, 0x9c, 0xbc, 0xed, 0x11, 0x81, 0xdb, + 0x8e, 0x0f, 0x51, 0xa2, 0xe3, 0xd6, 0x79, 0x75, 0x43, 0x62, 0x14, 0xc6, 0x5a, 0x43, 0x33, 0x2b, + 0x52, 0xf1, 0x56, 0x1a, 0x60, 0x41, 0x36, 0x30, 0xc3, 0x94, 0x9b, 0x77, 0x50, 0x25, 0x55, 0x56, + 0xcd, 0x68, 0x1a, 0x0b, 0x93, 0x8b, 0x73, 0xf6, 0xb9, 0x46, 0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18, 0x4e, 0x84, 0x04, 0x86, 0xd2, 0x20, 0xac, + 0x0f, 0xd4, 0xee, 0x59, 0x84, 0x28, 0xc9, 0x83, 0x08, 0x31, 0x29, 0x9a, 0xc6, 0x99, 0xd8, 0x01, + 0x16, 0xed, 0xab, 0x6a, 0x4a, 0xd1, 0x65, 0x1b, 0xd2, 0x3e, 0x3a, 0x68, 0xb5, 0x2e, 0xbb, 0x81, + 0x3d, 0x47, 0x12, 0xed, 0xdb, 0xcb, 0xc3, 0x74, 0xee, 0x28, 0xbb, 0xe5, 0xa3, 0x49, 0x25, 0xd8, + 0x25, 0x39, 0xec, 0x92, 0xdf, 0x52, 0xdc, 0x44, 0x53, 0x94, 0x87, 0x5d, 0x79, 0x72, 0xdd, 0x8c, + 0xc5, 0x7a, 0x84, 0x88, 0xf2, 0x70, 0xb3, 0x97, 0x92, 0x2d, 0x16, 0x5b, 0x09, 0x9a, 0x2a, 0xa6, + 0x02, 0xf9, 0x7a, 0x94, 0x88, 0xa1, 0x4b, 0x37, 0xae, 0xe2, 0xd2, 0x3b, 0x4b, 0x87, 0x27, 0x75, + 0xe3, 0xf8, 0xa4, 0x6e, 0x7c, 0x3f, 0xa9, 0x1b, 0x1f, 0x4e, 0xeb, 0xa5, 0xe3, 0xd3, 0x7a, 0xe9, + 0xcb, 0x69, 0xbd, 0xf4, 0xe2, 0xfa, 0xe5, 0xc3, 0x3a, 0x5b, 0x17, 0xaf, 0xa2, 0x86, 0x7c, 0xfb, + 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb0, 0x7a, 0x7f, 0x44, 0x5a, 0x06, 0x00, 0x00, +} + +func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -757,12 +757,12 @@ func (m *EventUpdateFoundationParams) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventUpdateFoundationParams) MarshalTo(dAtA []byte) (int, error) { +func (m *EventUpdateParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventUpdateFoundationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1245,7 +1245,7 @@ func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *EventUpdateFoundationParams) Size() (n int) { +func (m *EventUpdateParams) Size() (n int) { if m == nil { return 0 } @@ -1451,7 +1451,7 @@ func sovEvent(x uint64) (n int) { func sozEvent(x uint64) (n int) { return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *EventUpdateFoundationParams) Unmarshal(dAtA []byte) error { +func (m *EventUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1474,10 +1474,10 @@ func (m *EventUpdateFoundationParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventUpdateFoundationParams: wiretype end group for non-group") + return fmt.Errorf("proto: EventUpdateParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventUpdateFoundationParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/foundation/foundation.pb.go b/x/foundation/foundation.pb.go index 25cba72548..e03c975ca4 100644 --- a/x/foundation/foundation.pb.go +++ b/x/foundation/foundation.pb.go @@ -202,48 +202,6 @@ func (m *Params) GetCensoredMsgTypeUrls() []string { return nil } -// UpdateFoundationParamsProposal details a proposal to update params of foundation module. -type UpdateFoundationParamsProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - // params defines the x/foundation parameters to update. - // - // Note: All parameters must be supplied. - Params Params `protobuf:"bytes,3,opt,name=params,proto3" json:"params"` -} - -func (m *UpdateFoundationParamsProposal) Reset() { *m = UpdateFoundationParamsProposal{} } -func (*UpdateFoundationParamsProposal) ProtoMessage() {} -func (*UpdateFoundationParamsProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{1} -} -func (m *UpdateFoundationParamsProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UpdateFoundationParamsProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UpdateFoundationParamsProposal.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 *UpdateFoundationParamsProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateFoundationParamsProposal.Merge(m, src) -} -func (m *UpdateFoundationParamsProposal) XXX_Size() int { - return m.Size() -} -func (m *UpdateFoundationParamsProposal) XXX_DiscardUnknown() { - xxx_messageInfo_UpdateFoundationParamsProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_UpdateFoundationParamsProposal proto.InternalMessageInfo - // Member represents a foundation member with an account address and metadata. type Member struct { // address is the member's account address. @@ -258,7 +216,7 @@ func (m *Member) Reset() { *m = Member{} } func (m *Member) String() string { return proto.CompactTextString(m) } func (*Member) ProtoMessage() {} func (*Member) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{2} + return fileDescriptor_1980496a233f02f4, []int{1} } func (m *Member) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -324,7 +282,7 @@ func (m *MemberRequest) Reset() { *m = MemberRequest{} } func (m *MemberRequest) String() string { return proto.CompactTextString(m) } func (*MemberRequest) ProtoMessage() {} func (*MemberRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{3} + return fileDescriptor_1980496a233f02f4, []int{2} } func (m *MemberRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -391,7 +349,7 @@ func (m *ThresholdDecisionPolicy) Reset() { *m = ThresholdDecisionPolicy func (m *ThresholdDecisionPolicy) String() string { return proto.CompactTextString(m) } func (*ThresholdDecisionPolicy) ProtoMessage() {} func (*ThresholdDecisionPolicy) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{4} + return fileDescriptor_1980496a233f02f4, []int{3} } func (m *ThresholdDecisionPolicy) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -444,7 +402,7 @@ func (m *PercentageDecisionPolicy) Reset() { *m = PercentageDecisionPoli func (m *PercentageDecisionPolicy) String() string { return proto.CompactTextString(m) } func (*PercentageDecisionPolicy) ProtoMessage() {} func (*PercentageDecisionPolicy) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{5} + return fileDescriptor_1980496a233f02f4, []int{4} } func (m *PercentageDecisionPolicy) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -503,7 +461,7 @@ func (m *DecisionPolicyWindows) Reset() { *m = DecisionPolicyWindows{} } func (m *DecisionPolicyWindows) String() string { return proto.CompactTextString(m) } func (*DecisionPolicyWindows) ProtoMessage() {} func (*DecisionPolicyWindows) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{6} + return fileDescriptor_1980496a233f02f4, []int{5} } func (m *DecisionPolicyWindows) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -556,7 +514,7 @@ func (m *OutsourcingDecisionPolicy) Reset() { *m = OutsourcingDecisionPo func (m *OutsourcingDecisionPolicy) String() string { return proto.CompactTextString(m) } func (*OutsourcingDecisionPolicy) ProtoMessage() {} func (*OutsourcingDecisionPolicy) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{7} + return fileDescriptor_1980496a233f02f4, []int{6} } func (m *OutsourcingDecisionPolicy) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -611,7 +569,7 @@ func (m *FoundationInfo) Reset() { *m = FoundationInfo{} } func (m *FoundationInfo) String() string { return proto.CompactTextString(m) } func (*FoundationInfo) ProtoMessage() {} func (*FoundationInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{8} + return fileDescriptor_1980496a233f02f4, []int{7} } func (m *FoundationInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -679,7 +637,7 @@ func (m *Proposal) Reset() { *m = Proposal{} } func (m *Proposal) String() string { return proto.CompactTextString(m) } func (*Proposal) ProtoMessage() {} func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{9} + return fileDescriptor_1980496a233f02f4, []int{8} } func (m *Proposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -724,7 +682,7 @@ func (m *TallyResult) Reset() { *m = TallyResult{} } func (m *TallyResult) String() string { return proto.CompactTextString(m) } func (*TallyResult) ProtoMessage() {} func (*TallyResult) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{10} + return fileDescriptor_1980496a233f02f4, []int{9} } func (m *TallyResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -771,7 +729,7 @@ func (m *Vote) Reset() { *m = Vote{} } func (m *Vote) String() string { return proto.CompactTextString(m) } func (*Vote) ProtoMessage() {} func (*Vote) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{11} + return fileDescriptor_1980496a233f02f4, []int{10} } func (m *Vote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -844,7 +802,7 @@ func (m *Pool) Reset() { *m = Pool{} } func (m *Pool) String() string { return proto.CompactTextString(m) } func (*Pool) ProtoMessage() {} func (*Pool) Descriptor() ([]byte, []int) { - return fileDescriptor_1980496a233f02f4, []int{12} + return fileDescriptor_1980496a233f02f4, []int{11} } func (m *Pool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -885,7 +843,6 @@ func init() { proto.RegisterEnum("lbm.foundation.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) proto.RegisterEnum("lbm.foundation.v1.ProposalExecutorResult", ProposalExecutorResult_name, ProposalExecutorResult_value) proto.RegisterType((*Params)(nil), "lbm.foundation.v1.Params") - proto.RegisterType((*UpdateFoundationParamsProposal)(nil), "lbm.foundation.v1.UpdateFoundationParamsProposal") proto.RegisterType((*Member)(nil), "lbm.foundation.v1.Member") proto.RegisterType((*MemberRequest)(nil), "lbm.foundation.v1.MemberRequest") proto.RegisterType((*ThresholdDecisionPolicy)(nil), "lbm.foundation.v1.ThresholdDecisionPolicy") @@ -904,96 +861,92 @@ func init() { } var fileDescriptor_1980496a233f02f4 = []byte{ - // 1415 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcf, 0x6f, 0xdb, 0xc6, - 0x12, 0x16, 0x25, 0x59, 0x96, 0xc7, 0xb6, 0xac, 0x6c, 0xfc, 0x12, 0xd9, 0x49, 0x24, 0x47, 0x08, - 0x1e, 0x9c, 0x00, 0x91, 0x9e, 0x13, 0x3c, 0x3c, 0xbc, 0x5c, 0x0a, 0x49, 0xa6, 0x1b, 0x15, 0x8e, - 0xa4, 0x50, 0x94, 0xdd, 0x16, 0x28, 0x08, 0x4a, 0x5c, 0x4b, 0x44, 0x49, 0x2e, 0xcb, 0x5d, 0xca, - 0xd6, 0xa9, 0xd7, 0xdc, 0x92, 0x63, 0x6e, 0x0d, 0xd0, 0x4b, 0xd1, 0x73, 0x81, 0x16, 0x01, 0x7a, - 0x4f, 0x7b, 0x28, 0x82, 0x5e, 0x5a, 0xf4, 0x90, 0x14, 0xce, 0xa5, 0x97, 0xfe, 0x0f, 0xc5, 0xf2, - 0x87, 0x7e, 0x59, 0x71, 0xab, 0x02, 0xbd, 0x79, 0x76, 0xe6, 0xfb, 0xf8, 0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0x8d, 0xfc, 0xfc, 0x26, 0x1b, 0xf9, 0xf0, 0xc6, 0xdb, 0xfa, 0xed, - 0x64, 0xec, 0x5f, 0xb1, 0x76, 0xc2, 0xeb, 0xff, 0xbb, 0x7f, 0x04, 0x00, 0x00, 0xff, 0xff, 0xbd, - 0x56, 0x92, 0xf7, 0xb1, 0x0d, 0x00, 0x00, + // 1348 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xda, 0x8e, 0xe3, 0x3c, 0x37, 0x8e, 0x3b, 0x0d, 0xad, 0x93, 0xb6, 0xb6, 0x6b, 0x55, + 0x28, 0xad, 0x54, 0x9b, 0xa4, 0xe2, 0x40, 0x2f, 0xc8, 0x3f, 0x36, 0xd4, 0x28, 0xb5, 0xdd, 0xf5, + 0x3a, 0x01, 0x24, 0xb4, 0x1a, 0x7b, 0x27, 0xf6, 0x8a, 0xdd, 0x1d, 0xb3, 0x33, 0xeb, 0xc4, 0x27, + 0xae, 0xbd, 0xb5, 0x47, 0x8e, 0x48, 0x5c, 0x10, 0x67, 0x24, 0x50, 0x25, 0xee, 0x85, 0x03, 0xaa, + 0xb8, 0x80, 0x38, 0xb4, 0x28, 0x3d, 0xf3, 0x3f, 0xa0, 0xfd, 0xe5, 0xd8, 0x8e, 0x13, 0x30, 0x12, + 0x37, 0xbf, 0x79, 0xdf, 0xf7, 0xed, 0xf7, 0xde, 0xbe, 0x37, 0x5a, 0x43, 0x5e, 0xef, 0x18, 0xc5, + 0x43, 0x6a, 0x9b, 0x2a, 0xe6, 0x1a, 0x35, 0x8b, 0xc3, 0xed, 0x89, 0xa8, 0x30, 0xb0, 0x28, 0xa7, + 0xe8, 0xb2, 0xde, 0x31, 0x0a, 0x13, 0xa7, 0xc3, 0xed, 0xcd, 0xf5, 0x1e, 0xed, 0x51, 0x37, 0x5b, + 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0x73, 0x22, 0x05, 0x21, 0xda, 0x84, 0xb8, 0x41, 0x38, + 0x56, 0x31, 0xc7, 0xe9, 0xb0, 0x9b, 0x1a, 0xc7, 0xe8, 0x7d, 0x88, 0x63, 0x55, 0x25, 0xaa, 0x82, + 0x79, 0x3a, 0x9a, 0x13, 0xb6, 0x12, 0x3b, 0x9b, 0x05, 0xaf, 0x75, 0x85, 0xa0, 0x75, 0x05, 0x39, + 0xe8, 0x6d, 0x39, 0xee, 0x14, 0xf7, 0xec, 0x75, 0x56, 0x70, 0xc5, 0x89, 0x5a, 0xe2, 0xf9, 0x4f, + 0x61, 0xd5, 0x33, 0x20, 0x91, 0xcf, 0x6d, 0xc2, 0xf8, 0x05, 0x3e, 0xae, 0x42, 0xcc, 0x22, 0x06, + 0x1d, 0x12, 0xd7, 0x45, 0x5c, 0xf2, 0xa3, 0x29, 0x7f, 0x91, 0x69, 0x7f, 0xf9, 0xe7, 0x02, 0x5c, + 0x93, 0xfb, 0x16, 0x61, 0x7d, 0xaa, 0xab, 0x55, 0xd2, 0xd5, 0x98, 0x46, 0xcd, 0x26, 0xd5, 0xb5, + 0xee, 0x08, 0x7d, 0x00, 0x2b, 0x3c, 0x48, 0x2d, 0xde, 0xfd, 0x53, 0x2e, 0x2a, 0xc3, 0xf2, 0x91, + 0x66, 0xaa, 0xf4, 0x88, 0xb9, 0xce, 0x12, 0x3b, 0x5b, 0x85, 0x33, 0x83, 0x5a, 0x98, 0x7e, 0xf8, + 0x81, 0x87, 0x97, 0x02, 0xe2, 0x03, 0xf4, 0xeb, 0x77, 0xf7, 0x92, 0xd3, 0x98, 0xfc, 0x8f, 0x02, + 0xa4, 0x9b, 0xc4, 0xea, 0x12, 0x93, 0xe3, 0x1e, 0x99, 0x71, 0x5f, 0x03, 0x18, 0x8c, 0x73, 0x8b, + 0xdb, 0x9f, 0x20, 0xff, 0x6f, 0xfe, 0x7f, 0x10, 0xe0, 0xad, 0xb9, 0x34, 0xf4, 0x10, 0x56, 0x87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x7e, 0x24, 0x56, 0xda, 0x72, 0x43, + 0x52, 0x24, 0xb1, 0xd5, 0xde, 0x93, 0x67, 0x2a, 0xbc, 0x0d, 0xb9, 0x73, 0x91, 0xf5, 0x86, 0xac, + 0x48, 0xed, 0x7a, 0x4a, 0xb8, 0x10, 0xd5, 0x6a, 0x57, 0x2a, 0x62, 0xab, 0x95, 0x0a, 0x5f, 0x88, + 0xda, 0x2d, 0xd5, 0xf6, 0xda, 0x92, 0x98, 0x8a, 0x78, 0xe6, 0xcb, 0xe5, 0x6f, 0x4e, 0x32, 0xc2, + 0x8b, 0x93, 0x8c, 0xf0, 0xf2, 0x24, 0x23, 0xfc, 0x79, 0x92, 0x11, 0x9e, 0xbd, 0xc9, 0x84, 0x5e, + 0xbe, 0xc9, 0x84, 0x7e, 0x7f, 0x93, 0x09, 0x7d, 0x72, 0xfb, 0xbc, 0x79, 0x3b, 0x9e, 0xf8, 0xa3, + 0xd3, 0x89, 0xb9, 0xf3, 0x7f, 0xff, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x11, 0x4b, 0x29, 0xa0, + 0x0f, 0x0d, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -1427,53 +1380,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *UpdateFoundationParamsProposal) 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 *UpdateFoundationParamsProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UpdateFoundationParamsProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintFoundation(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintFoundation(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintFoundation(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *Member) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1494,12 +1400,12 @@ func (m *Member) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.AddedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.AddedAt):]) - if err2 != nil { - return 0, err2 + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.AddedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.AddedAt):]) + if err1 != nil { + return 0, err1 } - i -= n2 - i = encodeVarintFoundation(dAtA, i, uint64(n2)) + i -= n1 + i = encodeVarintFoundation(dAtA, i, uint64(n1)) i-- dAtA[i] = 0x22 if len(m.Metadata) > 0 { @@ -1676,21 +1582,21 @@ func (m *DecisionPolicyWindows) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MinExecutionPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MinExecutionPeriod):]) + n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MinExecutionPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MinExecutionPeriod):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintFoundation(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x12 + n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod):]) if err5 != nil { return 0, err5 } i -= n5 i = encodeVarintFoundation(dAtA, i, uint64(n5)) i-- - dAtA[i] = 0x12 - n6, err6 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod):]) - if err6 != nil { - return 0, err6 - } - i -= n6 - i = encodeVarintFoundation(dAtA, i, uint64(n6)) - i-- dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1821,12 +1727,12 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x48 } - n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingPeriodEnd, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingPeriodEnd):]) - if err8 != nil { - return 0, err8 + n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingPeriodEnd, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingPeriodEnd):]) + if err7 != nil { + return 0, err7 } - i -= n8 - i = encodeVarintFoundation(dAtA, i, uint64(n8)) + i -= n7 + i = encodeVarintFoundation(dAtA, i, uint64(n7)) i-- dAtA[i] = 0x42 { @@ -1849,12 +1755,12 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x28 } - n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) - if err10 != nil { - return 0, err10 + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) + if err9 != nil { + return 0, err9 } - i -= n10 - i = encodeVarintFoundation(dAtA, i, uint64(n10)) + i -= n9 + i = encodeVarintFoundation(dAtA, i, uint64(n9)) i-- dAtA[i] = 0x22 if len(m.Proposers) > 0 { @@ -1964,12 +1870,12 @@ func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) - if err11 != nil { - return 0, err11 + n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) + if err10 != nil { + return 0, err10 } - i -= n11 - i = encodeVarintFoundation(dAtA, i, uint64(n11)) + i -= n10 + i = encodeVarintFoundation(dAtA, i, uint64(n10)) i-- dAtA[i] = 0x2a if len(m.Metadata) > 0 { @@ -2064,25 +1970,6 @@ func (m *Params) Size() (n int) { return n } -func (m *UpdateFoundationParamsProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovFoundation(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovFoundation(uint64(l)) - } - l = m.Params.Size() - n += 1 + l + sovFoundation(uint64(l)) - return n -} - func (m *Member) Size() (n int) { if m == nil { return 0 @@ -2422,153 +2309,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } -func (m *UpdateFoundationParamsProposal) 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 ErrIntOverflowFoundation - } - 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: UpdateFoundationParamsProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UpdateFoundationParamsProposal: 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) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFoundation - } - 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 ErrInvalidLengthFoundation - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthFoundation - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFoundation - } - 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 ErrInvalidLengthFoundation - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthFoundation - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 ErrIntOverflowFoundation - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthFoundation - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthFoundation - } - 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 := skipFoundation(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthFoundation - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Member) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/foundation/keeper/handler.go b/x/foundation/keeper/handler.go deleted file mode 100644 index a5a14ad290..0000000000 --- a/x/foundation/keeper/handler.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper - -import ( - sdk "github.com/line/lbm-sdk/types" - sdkerrors "github.com/line/lbm-sdk/types/errors" - "github.com/line/lbm-sdk/x/foundation" - govtypes "github.com/line/lbm-sdk/x/gov/types" -) - -func NewProposalHandler(k Keeper) govtypes.Handler { - return func(ctx sdk.Context, content govtypes.Content) error { - switch c := content.(type) { - case *foundation.UpdateFoundationParamsProposal: - return k.handleUpdateFoundationParamsProposal(ctx, c) - default: - return sdkerrors.ErrUnknownRequest.Wrapf("unrecognized foundation proposal content type: %T", c) - } - } -} diff --git a/x/foundation/keeper/msg_server.go b/x/foundation/keeper/msg_server.go index 5cdd3e8eac..0f8eb9f513 100644 --- a/x/foundation/keeper/msg_server.go +++ b/x/foundation/keeper/msg_server.go @@ -24,6 +24,26 @@ func NewMsgServer(keeper Keeper) foundation.MsgServer { var _ foundation.MsgServer = msgServer{} +func (s msgServer) UpdateParams(c context.Context, req *foundation.MsgUpdateParams) (*foundation.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + if err := s.keeper.validateOperator(ctx, req.Authority); err != nil { + return nil, err + } + + if err := s.keeper.UpdateParams(ctx, req.Params); err != nil { + return nil, err + } + + if err := ctx.EventManager().EmitTypedEvent(&foundation.EventUpdateParams{ + Params: req.Params, + }); err != nil { + panic(err) + } + + return &foundation.MsgUpdateParamsResponse{}, nil +} + // FundTreasury defines a method to fund the treasury. func (s msgServer) FundTreasury(c context.Context, req *foundation.MsgFundTreasury) (*foundation.MsgFundTreasuryResponse, error) { ctx := sdk.UnwrapSDKContext(c) diff --git a/x/foundation/keeper/msg_server_test.go b/x/foundation/keeper/msg_server_test.go index eafae5c9cb..4b828ef6eb 100644 --- a/x/foundation/keeper/msg_server_test.go +++ b/x/foundation/keeper/msg_server_test.go @@ -9,6 +9,51 @@ import ( "github.com/line/lbm-sdk/x/stakingplus" ) +func (s *KeeperTestSuite) TestMsgUpdateParams() { + testCases := map[string]struct { + authority sdk.AccAddress + params foundation.Params + valid bool + }{ + "valid request": { + authority: s.operator, + params: foundation.DefaultParams(), + valid: true, + }, + "invalid authority": { + authority: s.stranger, + params: foundation.DefaultParams(), + }, + "enabling feature": { + authority: s.operator, + params: foundation.Params{ + FoundationTax: sdk.ZeroDec(), + CensoredMsgTypeUrls: []string{ + sdk.MsgTypeURL((*testdata.TestMsg)(nil)), + }, + }, + }, + } + + for name, tc := range testCases { + s.Run(name, func() { + ctx, _ := s.ctx.CacheContext() + + req := &foundation.MsgUpdateParams{ + Authority: tc.authority.String(), + Params: tc.params, + } + res, err := s.msgServer.UpdateParams(sdk.WrapSDKContext(ctx), req) + if !tc.valid { + s.Require().Error(err) + return + } + s.Require().NoError(err) + s.Require().NotNil(res) + }) + } +} + func (s *KeeperTestSuite) TestMsgFundTreasury() { testCases := map[string]struct { amount sdk.Int diff --git a/x/foundation/keeper/proposal.go b/x/foundation/keeper/proposal.go index b44e87eeb4..608937e9ce 100644 --- a/x/foundation/keeper/proposal.go +++ b/x/foundation/keeper/proposal.go @@ -8,22 +8,6 @@ import ( "github.com/line/lbm-sdk/x/foundation" ) -// handleUpdateFoundationParamsProposal is a handler for update foundation params proposal -func (k Keeper) handleUpdateFoundationParamsProposal(ctx sdk.Context, p *foundation.UpdateFoundationParamsProposal) error { - params := p.Params - if err := k.UpdateParams(ctx, params); err != nil { - return err - } - - if err := ctx.EventManager().EmitTypedEvent(&foundation.EventUpdateFoundationParams{ - Params: params, - }); err != nil { - panic(err) - } - - return nil -} - func (k Keeper) newProposalID(ctx sdk.Context) uint64 { id := k.getPreviousProposalID(ctx) + 1 k.setPreviousProposalID(ctx, id) diff --git a/x/foundation/msgs.go b/x/foundation/msgs.go index 58a984cf68..99e802fda7 100644 --- a/x/foundation/msgs.go +++ b/x/foundation/msgs.go @@ -8,6 +8,27 @@ import ( sdkerrors "github.com/line/lbm-sdk/types/errors" ) +var _ sdk.Msg = (*MsgUpdateParams)(nil) + +// ValidateBasic implements Msg. +func (m MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid authority address: %s", m.Authority) + } + + if err := m.Params.ValidateBasic(); err != nil { + return err + } + + return nil +} + +// GetSigners implements Msg. +func (m MsgUpdateParams) GetSigners() []sdk.AccAddress { + signer := sdk.MustAccAddressFromBech32(m.Authority) + return []sdk.AccAddress{signer} +} + var _ sdk.Msg = (*MsgFundTreasury)(nil) // ValidateBasic implements Msg. diff --git a/x/foundation/msgs_test.go b/x/foundation/msgs_test.go index f7544ab5e4..26efbe3e6a 100644 --- a/x/foundation/msgs_test.go +++ b/x/foundation/msgs_test.go @@ -12,6 +12,52 @@ import ( "github.com/line/lbm-sdk/x/foundation" ) +func TestMsgUpdateParams(t *testing.T) { + addrs := make([]sdk.AccAddress, 1) + for i := range addrs { + addrs[i] = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) + } + + testCases := map[string]struct { + authority sdk.AccAddress + params foundation.Params + valid bool + }{ + "valid msg": { + authority: addrs[0], + params: foundation.Params{ + FoundationTax: sdk.ZeroDec(), + }, + valid: true, + }, + "invalid authority": { + params: foundation.Params{ + FoundationTax: sdk.ZeroDec(), + }, + }, + "invalid params": { + authority: addrs[0], + params: foundation.Params{}, + }, + } + + for name, tc := range testCases { + msg := foundation.MsgUpdateParams{ + Authority: tc.authority.String(), + Params: tc.params, + } + + err := msg.ValidateBasic() + if !tc.valid { + require.Error(t, err, name) + continue + } + require.NoError(t, err, name) + + require.Equal(t, []sdk.AccAddress{tc.authority}, msg.GetSigners(), name) + } +} + func TestMsgFundTreasury(t *testing.T) { addrs := make([]sdk.AccAddress, 1) for i := range addrs { diff --git a/x/foundation/proposal.go b/x/foundation/proposal.go deleted file mode 100644 index da5d7641e3..0000000000 --- a/x/foundation/proposal.go +++ /dev/null @@ -1,42 +0,0 @@ -package foundation - -import ( - yaml "gopkg.in/yaml.v2" - - govtypes "github.com/line/lbm-sdk/x/gov/types" -) - -const ( - // ProposalTypeUpdateFoundationParams updates parameters of foundation. - ProposalTypeUpdateFoundationParams = "UpdateFoundationParams" -) - -func NewUpdateFoundationParamsProposal(title, description string, params Params) govtypes.Content { - return &UpdateFoundationParamsProposal{title, description, params} -} - -// Assert proposals implements govtypes.Content at compile-time -var _ govtypes.Content = (*UpdateFoundationParamsProposal)(nil) - -func init() { - govtypes.RegisterProposalType(ProposalTypeUpdateFoundationParams) -} - -func (p *UpdateFoundationParamsProposal) GetTitle() string { return p.Title } -func (p *UpdateFoundationParamsProposal) GetDescription() string { return p.Description } -func (p *UpdateFoundationParamsProposal) ProposalRoute() string { return RouterKey } -func (p *UpdateFoundationParamsProposal) ProposalType() string { - return ProposalTypeUpdateFoundationParams -} -func (p *UpdateFoundationParamsProposal) ValidateBasic() error { - if err := p.Params.ValidateBasic(); err != nil { - return err - } - - return nil -} - -func (p UpdateFoundationParamsProposal) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/foundation/proposal_test.go b/x/foundation/proposal_test.go deleted file mode 100644 index ce202a6ea8..0000000000 --- a/x/foundation/proposal_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package foundation_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/line/lbm-sdk/types" - "github.com/line/lbm-sdk/x/foundation" -) - -func TestUpdateFoundationParamsProposal(t *testing.T) { - title := "hello" - description := "world" - - testCases := map[string]struct { - params foundation.Params - valid bool - stringified string - }{ - "valid proposal": { - params: foundation.Params{ - FoundationTax: sdk.OneDec(), - CensoredMsgTypeUrls: []string{ - sdk.MsgTypeURL((*foundation.MsgWithdrawFromTreasury)(nil)), - }, - }, - valid: true, - stringified: fmt.Sprintf(`title: %s -description: %s -params: - foundationtax: "%s" - censoredmsgtypeurls: - - %s -`, title, description, sdk.OneDec(), sdk.MsgTypeURL((*foundation.MsgWithdrawFromTreasury)(nil))), - }, - "invalid tax rate": { - params: foundation.Params{ - FoundationTax: sdk.NewDec(2), - }, - }, - } - - for name, tc := range testCases { - proposal := foundation.NewUpdateFoundationParamsProposal(title, description, tc.params) - - require.Equal(t, title, proposal.GetTitle(), name) - require.Equal(t, description, proposal.GetDescription(), name) - require.Equal(t, foundation.RouterKey, proposal.ProposalRoute(), name) - require.Equal(t, foundation.ProposalTypeUpdateFoundationParams, proposal.ProposalType(), name) - - err := proposal.ValidateBasic() - if !tc.valid { - require.Error(t, err, name) - continue - } - require.NoError(t, err, name) - - require.Equal(t, tc.stringified, proposal.String(), name) - } -} diff --git a/x/foundation/tx.pb.go b/x/foundation/tx.pb.go index 388e7c3966..c12e1dfd9a 100644 --- a/x/foundation/tx.pb.go +++ b/x/foundation/tx.pb.go @@ -64,7 +64,87 @@ func (Exec) EnumDescriptor() ([]byte, []int) { return fileDescriptor_5ec2105611cae3ff, []int{0} } -// MsgFundTreasury represents a message to fund the treasury. +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + // authority is the address of the operator account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/foundation parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_5ec2105611cae3ff, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +// MsgUpdateParamsResponse is the Msg/UpdateParams response type. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5ec2105611cae3ff, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +// MsgFundTreasury is the Msg/FundTreasury request type. type MsgFundTreasury struct { From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` Amount github_com_line_lbm_sdk_types.Coins `protobuf:"bytes,2,rep,name=amount,proto3,castrepeated=github.com/line/lbm-sdk/types.Coins" json:"amount"` @@ -74,7 +154,7 @@ func (m *MsgFundTreasury) Reset() { *m = MsgFundTreasury{} } func (m *MsgFundTreasury) String() string { return proto.CompactTextString(m) } func (*MsgFundTreasury) ProtoMessage() {} func (*MsgFundTreasury) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{0} + return fileDescriptor_5ec2105611cae3ff, []int{2} } func (m *MsgFundTreasury) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -103,7 +183,7 @@ func (m *MsgFundTreasury) XXX_DiscardUnknown() { var xxx_messageInfo_MsgFundTreasury proto.InternalMessageInfo -// MsgFundTreasuryResponse defines the Msg/FundTreasury response type. +// MsgFundTreasuryResponse is the Msg/FundTreasury response type. type MsgFundTreasuryResponse struct { } @@ -111,7 +191,7 @@ func (m *MsgFundTreasuryResponse) Reset() { *m = MsgFundTreasuryResponse func (m *MsgFundTreasuryResponse) String() string { return proto.CompactTextString(m) } func (*MsgFundTreasuryResponse) ProtoMessage() {} func (*MsgFundTreasuryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{1} + return fileDescriptor_5ec2105611cae3ff, []int{3} } func (m *MsgFundTreasuryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -140,7 +220,7 @@ func (m *MsgFundTreasuryResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgFundTreasuryResponse proto.InternalMessageInfo -// MsgWithdrawFromTreasury represents a message to withdraw coins from the treasury. +// MsgWithdrawFromTreasury is the Msg/WithdrawFromTreasury request type. type MsgWithdrawFromTreasury struct { Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` @@ -151,7 +231,7 @@ func (m *MsgWithdrawFromTreasury) Reset() { *m = MsgWithdrawFromTreasury func (m *MsgWithdrawFromTreasury) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawFromTreasury) ProtoMessage() {} func (*MsgWithdrawFromTreasury) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{2} + return fileDescriptor_5ec2105611cae3ff, []int{4} } func (m *MsgWithdrawFromTreasury) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -180,7 +260,7 @@ func (m *MsgWithdrawFromTreasury) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithdrawFromTreasury proto.InternalMessageInfo -// MsgWithdrawFromTreasuryResponse defines the Msg/WithdrawFromTreasury response type. +// MsgWithdrawFromTreasuryResponse is the Msg/WithdrawFromTreasury response type. type MsgWithdrawFromTreasuryResponse struct { } @@ -188,7 +268,7 @@ func (m *MsgWithdrawFromTreasuryResponse) Reset() { *m = MsgWithdrawFrom func (m *MsgWithdrawFromTreasuryResponse) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawFromTreasuryResponse) ProtoMessage() {} func (*MsgWithdrawFromTreasuryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{3} + return fileDescriptor_5ec2105611cae3ff, []int{5} } func (m *MsgWithdrawFromTreasuryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -230,7 +310,7 @@ func (m *MsgUpdateMembers) Reset() { *m = MsgUpdateMembers{} } func (m *MsgUpdateMembers) String() string { return proto.CompactTextString(m) } func (*MsgUpdateMembers) ProtoMessage() {} func (*MsgUpdateMembers) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{4} + return fileDescriptor_5ec2105611cae3ff, []int{6} } func (m *MsgUpdateMembers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -267,7 +347,7 @@ func (m *MsgUpdateMembersResponse) Reset() { *m = MsgUpdateMembersRespon func (m *MsgUpdateMembersResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateMembersResponse) ProtoMessage() {} func (*MsgUpdateMembersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{5} + return fileDescriptor_5ec2105611cae3ff, []int{7} } func (m *MsgUpdateMembersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -308,7 +388,7 @@ func (m *MsgUpdateDecisionPolicy) Reset() { *m = MsgUpdateDecisionPolicy func (m *MsgUpdateDecisionPolicy) String() string { return proto.CompactTextString(m) } func (*MsgUpdateDecisionPolicy) ProtoMessage() {} func (*MsgUpdateDecisionPolicy) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{6} + return fileDescriptor_5ec2105611cae3ff, []int{8} } func (m *MsgUpdateDecisionPolicy) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -345,7 +425,7 @@ func (m *MsgUpdateDecisionPolicyResponse) Reset() { *m = MsgUpdateDecisi func (m *MsgUpdateDecisionPolicyResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateDecisionPolicyResponse) ProtoMessage() {} func (*MsgUpdateDecisionPolicyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{7} + return fileDescriptor_5ec2105611cae3ff, []int{9} } func (m *MsgUpdateDecisionPolicyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -393,7 +473,7 @@ func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } func (m *MsgSubmitProposal) String() string { return proto.CompactTextString(m) } func (*MsgSubmitProposal) ProtoMessage() {} func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{8} + return fileDescriptor_5ec2105611cae3ff, []int{10} } func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -432,7 +512,7 @@ func (m *MsgSubmitProposalResponse) Reset() { *m = MsgSubmitProposalResp func (m *MsgSubmitProposalResponse) String() string { return proto.CompactTextString(m) } func (*MsgSubmitProposalResponse) ProtoMessage() {} func (*MsgSubmitProposalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{9} + return fileDescriptor_5ec2105611cae3ff, []int{11} } func (m *MsgSubmitProposalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -473,7 +553,7 @@ func (m *MsgWithdrawProposal) Reset() { *m = MsgWithdrawProposal{} } func (m *MsgWithdrawProposal) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawProposal) ProtoMessage() {} func (*MsgWithdrawProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{10} + return fileDescriptor_5ec2105611cae3ff, []int{12} } func (m *MsgWithdrawProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -510,7 +590,7 @@ func (m *MsgWithdrawProposalResponse) Reset() { *m = MsgWithdrawProposal func (m *MsgWithdrawProposalResponse) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawProposalResponse) ProtoMessage() {} func (*MsgWithdrawProposalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{11} + return fileDescriptor_5ec2105611cae3ff, []int{13} } func (m *MsgWithdrawProposalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -558,7 +638,7 @@ func (m *MsgVote) Reset() { *m = MsgVote{} } func (m *MsgVote) String() string { return proto.CompactTextString(m) } func (*MsgVote) ProtoMessage() {} func (*MsgVote) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{12} + return fileDescriptor_5ec2105611cae3ff, []int{14} } func (m *MsgVote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -595,7 +675,7 @@ func (m *MsgVoteResponse) Reset() { *m = MsgVoteResponse{} } func (m *MsgVoteResponse) String() string { return proto.CompactTextString(m) } func (*MsgVoteResponse) ProtoMessage() {} func (*MsgVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{13} + return fileDescriptor_5ec2105611cae3ff, []int{15} } func (m *MsgVoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -636,7 +716,7 @@ func (m *MsgExec) Reset() { *m = MsgExec{} } func (m *MsgExec) String() string { return proto.CompactTextString(m) } func (*MsgExec) ProtoMessage() {} func (*MsgExec) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{14} + return fileDescriptor_5ec2105611cae3ff, []int{16} } func (m *MsgExec) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -673,7 +753,7 @@ func (m *MsgExecResponse) Reset() { *m = MsgExecResponse{} } func (m *MsgExecResponse) String() string { return proto.CompactTextString(m) } func (*MsgExecResponse) ProtoMessage() {} func (*MsgExecResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{15} + return fileDescriptor_5ec2105611cae3ff, []int{17} } func (m *MsgExecResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -712,7 +792,7 @@ func (m *MsgLeaveFoundation) Reset() { *m = MsgLeaveFoundation{} } func (m *MsgLeaveFoundation) String() string { return proto.CompactTextString(m) } func (*MsgLeaveFoundation) ProtoMessage() {} func (*MsgLeaveFoundation) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{16} + return fileDescriptor_5ec2105611cae3ff, []int{18} } func (m *MsgLeaveFoundation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -749,7 +829,7 @@ func (m *MsgLeaveFoundationResponse) Reset() { *m = MsgLeaveFoundationRe func (m *MsgLeaveFoundationResponse) String() string { return proto.CompactTextString(m) } func (*MsgLeaveFoundationResponse) ProtoMessage() {} func (*MsgLeaveFoundationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{17} + return fileDescriptor_5ec2105611cae3ff, []int{19} } func (m *MsgLeaveFoundationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -778,7 +858,7 @@ func (m *MsgLeaveFoundationResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgLeaveFoundationResponse proto.InternalMessageInfo -// MsgGrant is a request type for Grant method. It declares authorization to the grantee +// MsgGrant is the Msg/Grant request type. // on behalf of the foundation. type MsgGrant struct { Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` @@ -790,7 +870,7 @@ func (m *MsgGrant) Reset() { *m = MsgGrant{} } func (m *MsgGrant) String() string { return proto.CompactTextString(m) } func (*MsgGrant) ProtoMessage() {} func (*MsgGrant) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{18} + return fileDescriptor_5ec2105611cae3ff, []int{20} } func (m *MsgGrant) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -819,7 +899,7 @@ func (m *MsgGrant) XXX_DiscardUnknown() { var xxx_messageInfo_MsgGrant proto.InternalMessageInfo -// MsgGrantResponse defines the Msg/MsgGrant response type. +// MsgGrantResponse is the Msg/MsgGrant response type. type MsgGrantResponse struct { } @@ -827,7 +907,7 @@ func (m *MsgGrantResponse) Reset() { *m = MsgGrantResponse{} } func (m *MsgGrantResponse) String() string { return proto.CompactTextString(m) } func (*MsgGrantResponse) ProtoMessage() {} func (*MsgGrantResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{19} + return fileDescriptor_5ec2105611cae3ff, []int{21} } func (m *MsgGrantResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -856,8 +936,7 @@ func (m *MsgGrantResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgGrantResponse proto.InternalMessageInfo -// MsgRevoke revokes any authorization with the provided sdk.Msg type -// to the grantee on behalf of the foundation. +// MsgRevoke is the Msg/Revoke request type. type MsgRevoke struct { Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"` @@ -868,7 +947,7 @@ func (m *MsgRevoke) Reset() { *m = MsgRevoke{} } func (m *MsgRevoke) String() string { return proto.CompactTextString(m) } func (*MsgRevoke) ProtoMessage() {} func (*MsgRevoke) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{20} + return fileDescriptor_5ec2105611cae3ff, []int{22} } func (m *MsgRevoke) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -897,7 +976,7 @@ func (m *MsgRevoke) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRevoke proto.InternalMessageInfo -// MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. +// MsgRevokeResponse is the Msg/MsgRevokeResponse response type. type MsgRevokeResponse struct { } @@ -905,7 +984,7 @@ func (m *MsgRevokeResponse) Reset() { *m = MsgRevokeResponse{} } func (m *MsgRevokeResponse) String() string { return proto.CompactTextString(m) } func (*MsgRevokeResponse) ProtoMessage() {} func (*MsgRevokeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{21} + return fileDescriptor_5ec2105611cae3ff, []int{23} } func (m *MsgRevokeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -934,7 +1013,7 @@ func (m *MsgRevokeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRevokeResponse proto.InternalMessageInfo -// MsgGovMint represents a message to mint coins to the treasury. +// MsgGovMint is the Msg/GovMint request type. type MsgGovMint struct { Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` Amount github_com_line_lbm_sdk_types.Coins `protobuf:"bytes,2,rep,name=amount,proto3,castrepeated=github.com/line/lbm-sdk/types.Coins" json:"amount"` @@ -944,7 +1023,7 @@ func (m *MsgGovMint) Reset() { *m = MsgGovMint{} } func (m *MsgGovMint) String() string { return proto.CompactTextString(m) } func (*MsgGovMint) ProtoMessage() {} func (*MsgGovMint) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{22} + return fileDescriptor_5ec2105611cae3ff, []int{24} } func (m *MsgGovMint) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -973,7 +1052,7 @@ func (m *MsgGovMint) XXX_DiscardUnknown() { var xxx_messageInfo_MsgGovMint proto.InternalMessageInfo -// MsgGovMintResponse defines the Msg/GovMint response type. +// MsgGovMintResponse is the Msg/GovMint response type. type MsgGovMintResponse struct { } @@ -981,7 +1060,7 @@ func (m *MsgGovMintResponse) Reset() { *m = MsgGovMintResponse{} } func (m *MsgGovMintResponse) String() string { return proto.CompactTextString(m) } func (*MsgGovMintResponse) ProtoMessage() {} func (*MsgGovMintResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5ec2105611cae3ff, []int{23} + return fileDescriptor_5ec2105611cae3ff, []int{25} } func (m *MsgGovMintResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1012,6 +1091,8 @@ var xxx_messageInfo_MsgGovMintResponse proto.InternalMessageInfo func init() { proto.RegisterEnum("lbm.foundation.v1.Exec", Exec_name, Exec_value) + proto.RegisterType((*MsgUpdateParams)(nil), "lbm.foundation.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "lbm.foundation.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgFundTreasury)(nil), "lbm.foundation.v1.MsgFundTreasury") proto.RegisterType((*MsgFundTreasuryResponse)(nil), "lbm.foundation.v1.MsgFundTreasuryResponse") proto.RegisterType((*MsgWithdrawFromTreasury)(nil), "lbm.foundation.v1.MsgWithdrawFromTreasury") @@ -1041,76 +1122,80 @@ func init() { func init() { proto.RegisterFile("lbm/foundation/v1/tx.proto", fileDescriptor_5ec2105611cae3ff) } var fileDescriptor_5ec2105611cae3ff = []byte{ - // 1097 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcf, 0x4f, 0xe3, 0x46, - 0x14, 0x8e, 0x21, 0xfc, 0x7a, 0x40, 0x00, 0x6f, 0xd4, 0x0d, 0x5e, 0x08, 0xa9, 0x61, 0x2b, 0x04, - 0xc5, 0x2e, 0xa9, 0xda, 0x53, 0x2f, 0x0b, 0x4b, 0x2a, 0xa4, 0x75, 0x97, 0x7a, 0xa1, 0xbf, 0x0e, - 0x1b, 0x4d, 0xe2, 0xc1, 0xb8, 0x1b, 0x7b, 0x5c, 0xcf, 0x38, 0x85, 0x4a, 0x3d, 0x56, 0xea, 0xb1, - 0xff, 0x44, 0xa5, 0xaa, 0xea, 0x91, 0x3f, 0xa0, 0x47, 0xb4, 0xa7, 0x3d, 0xf6, 0xd4, 0x1f, 0x70, - 0xee, 0xff, 0x50, 0x79, 0x6c, 0xcf, 0xc6, 0xc1, 0x09, 0x51, 0xa5, 0xbd, 0x79, 0xe6, 0x7d, 0xf3, - 0xbd, 0xef, 0x7b, 0x33, 0x7e, 0x0f, 0x94, 0x4e, 0xcb, 0xd5, 0x4f, 0x49, 0xe8, 0x59, 0x88, 0x39, - 0xc4, 0xd3, 0xbb, 0xbb, 0x3a, 0x3b, 0xd7, 0xfc, 0x80, 0x30, 0x22, 0x2f, 0x75, 0x5a, 0xae, 0xf6, - 0x3a, 0xa6, 0x75, 0x77, 0x95, 0xb2, 0x4d, 0x6c, 0xc2, 0xa3, 0x7a, 0xf4, 0x15, 0x03, 0x15, 0xf5, - 0x36, 0x49, 0xcf, 0xb1, 0x18, 0x53, 0x6d, 0x13, 0xea, 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xd2, 0x4f, 0x37, 0xd5, 0xc2, 0xab, 0x9b, 0x6a, 0xe1, 0x8f, 0x9b, 0x6a, - 0xe1, 0xab, 0x8d, 0x51, 0xe6, 0x45, 0x6b, 0x92, 0xcf, 0x99, 0xf7, 0xff, 0x0b, 0x00, 0x00, 0xff, - 0xff, 0xdc, 0x00, 0x52, 0xcc, 0x21, 0x0d, 0x00, 0x00, + // 1154 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x4f, 0xe3, 0xc6, + 0x1b, 0x8e, 0x21, 0x04, 0xf2, 0x2e, 0x04, 0xf0, 0x46, 0xbf, 0x0d, 0x5e, 0x08, 0xf9, 0x19, 0xb6, + 0x42, 0x50, 0xec, 0x42, 0xd5, 0xf6, 0xd2, 0xcb, 0xc2, 0x92, 0x0a, 0x69, 0xd3, 0xa5, 0x5e, 0xe8, + 0xbf, 0x03, 0xd1, 0x24, 0x1e, 0x8c, 0xbb, 0xb1, 0xc7, 0xf5, 0x38, 0x29, 0xa9, 0xd4, 0x63, 0xa5, + 0x1e, 0xfb, 0x25, 0x2a, 0x55, 0x55, 0x8f, 0x7c, 0x80, 0x1e, 0xd1, 0x4a, 0x95, 0xf6, 0xd8, 0x53, + 0xff, 0xc0, 0x17, 0xa9, 0x3c, 0x1e, 0xcf, 0x3a, 0xc1, 0x0e, 0x51, 0xa5, 0xbd, 0x65, 0xfc, 0x3e, + 0xf3, 0xbc, 0xcf, 0xf3, 0xce, 0xcc, 0xfb, 0x06, 0x94, 0x4e, 0xcb, 0xd1, 0xcf, 0x48, 0xd7, 0x35, + 0x51, 0x60, 0x13, 0x57, 0xef, 0xed, 0xe8, 0xc1, 0x85, 0xe6, 0xf9, 0x24, 0x20, 0xf2, 0x62, 0xa7, + 0xe5, 0x68, 0xaf, 0x63, 0x5a, 0x6f, 0x47, 0x29, 0x5b, 0xc4, 0x22, 0x2c, 0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a, 0xea, 0xf9, + 0x0f, 0xd3, 0xf7, 0xb1, 0xa0, 0xb2, 0x36, 0x22, 0x28, 0xa8, 0x9e, 0x42, 0x81, 0x37, 0xdd, 0xe5, + 0x74, 0x78, 0x14, 0x55, 0xd6, 0x47, 0x45, 0x05, 0xdb, 0x33, 0x98, 0x8e, 0xfb, 0xe8, 0x4a, 0x46, + 0xf6, 0x28, 0xac, 0x3c, 0x1a, 0x19, 0x8e, 0x09, 0xf7, 0xea, 0x57, 0xff, 0x54, 0x73, 0x3f, 0x5f, + 0x57, 0x73, 0x57, 0xd7, 0x55, 0xe9, 0xd5, 0x75, 0x55, 0xfa, 0xfb, 0xba, 0x2a, 0xfd, 0x78, 0x53, + 0xcd, 0xbd, 0xba, 0xa9, 0xe6, 0xfe, 0xb8, 0xa9, 0xe6, 0xbe, 0x5c, 0x1f, 0x67, 0x1e, 0xb5, 0x0a, + 0x6c, 0x8e, 0xbd, 0xfb, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x74, 0x92, 0x57, 0x48, 0x06, 0x0e, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1125,6 +1210,9 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // UpdateParams defines an operation for updating the x/foundation module + // parameters. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) // FundTreasury defines a method to fund the treasury. FundTreasury(ctx context.Context, in *MsgFundTreasury, opts ...grpc.CallOption) (*MsgFundTreasuryResponse, error) // WithdrawFromTreasury defines a method to withdraw coins from the treasury. @@ -1145,10 +1233,10 @@ type MsgClient interface { LeaveFoundation(ctx context.Context, in *MsgLeaveFoundation, opts ...grpc.CallOption) (*MsgLeaveFoundationResponse, error) // Grant grants the provided authorization to the grantee with authority of // the foundation. If there is already a grant for the given - // (granter, grantee, Authorization) tuple, then the grant will be overwritten. + // (grantee, Authorization) tuple, then the grant will be overwritten. Grant(ctx context.Context, in *MsgGrant, opts ...grpc.CallOption) (*MsgGrantResponse, error) - // Revoke revokes any authorization corresponding to the provided method name on the - // granter that has been granted to the grantee. + // Revoke revokes any authorization corresponding to the provided method name + // that has been granted to the grantee. Revoke(ctx context.Context, in *MsgRevoke, opts ...grpc.CallOption) (*MsgRevokeResponse, error) // GovMint defines a gov mint coins to the treasury. GovMint(ctx context.Context, in *MsgGovMint, opts ...grpc.CallOption) (*MsgGovMintResponse, error) @@ -1162,6 +1250,15 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/lbm.foundation.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) FundTreasury(ctx context.Context, in *MsgFundTreasury, opts ...grpc.CallOption) (*MsgFundTreasuryResponse, error) { out := new(MsgFundTreasuryResponse) err := c.cc.Invoke(ctx, "/lbm.foundation.v1.Msg/FundTreasury", in, out, opts...) @@ -1272,6 +1369,9 @@ func (c *msgClient) GovMint(ctx context.Context, in *MsgGovMint, opts ...grpc.Ca // MsgServer is the server API for Msg service. type MsgServer interface { + // UpdateParams defines an operation for updating the x/foundation module + // parameters. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) // FundTreasury defines a method to fund the treasury. FundTreasury(context.Context, *MsgFundTreasury) (*MsgFundTreasuryResponse, error) // WithdrawFromTreasury defines a method to withdraw coins from the treasury. @@ -1292,10 +1392,10 @@ type MsgServer interface { LeaveFoundation(context.Context, *MsgLeaveFoundation) (*MsgLeaveFoundationResponse, error) // Grant grants the provided authorization to the grantee with authority of // the foundation. If there is already a grant for the given - // (granter, grantee, Authorization) tuple, then the grant will be overwritten. + // (grantee, Authorization) tuple, then the grant will be overwritten. Grant(context.Context, *MsgGrant) (*MsgGrantResponse, error) - // Revoke revokes any authorization corresponding to the provided method name on the - // granter that has been granted to the grantee. + // Revoke revokes any authorization corresponding to the provided method name + // that has been granted to the grantee. Revoke(context.Context, *MsgRevoke) (*MsgRevokeResponse, error) // GovMint defines a gov mint coins to the treasury. GovMint(context.Context, *MsgGovMint) (*MsgGovMintResponse, error) @@ -1305,6 +1405,9 @@ type MsgServer interface { type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func (*UnimplementedMsgServer) FundTreasury(ctx context.Context, req *MsgFundTreasury) (*MsgFundTreasuryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FundTreasury not implemented") } @@ -1346,6 +1449,24 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.foundation.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_FundTreasury_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgFundTreasury) if err := dec(in); err != nil { @@ -1566,6 +1687,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "lbm.foundation.v1.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, { MethodName: "FundTreasury", Handler: _Msg_FundTreasury_Handler, @@ -1619,6 +1744,69 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "lbm/foundation/v1/tx.proto", } +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgFundTreasury) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2439,6 +2627,30 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgFundTreasury) Size() (n int) { if m == nil { return 0 @@ -2794,6 +3006,171 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +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 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 Params", 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 err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: 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 *MsgFundTreasury) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From d48d8a7094acb0253e0ba9b279f4ee5de3daef4a Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Wed, 19 Oct 2022 06:48:14 +0000 Subject: [PATCH 3/5] docs: update x/foundation specification (#721) * Add README.md into x/foundation It would eventually replace the spec folder. * Fill README.md * Update README.md * Update CHANGELOG.md * Update references to the latest commit of main * Remove old spec * Update references to the latest commit of chain Also, correct the line numbers. * Remove all the legacy spec files * Update references to the latest commit of main * Add update-params tx cli * Update params field name --- CHANGELOG.md | 1 + x/README.md | 2 +- x/foundation/README.md | 1556 ++++++++++++++++++++++++++++++ x/foundation/spec/01_concepts.md | 56 -- x/foundation/spec/02_state.md | 36 - x/foundation/spec/03_events.md | 7 - x/foundation/spec/04_params.md | 13 - x/foundation/spec/README.md | 19 - 8 files changed, 1558 insertions(+), 132 deletions(-) create mode 100644 x/foundation/README.md delete mode 100644 x/foundation/spec/01_concepts.md delete mode 100644 x/foundation/spec/02_state.md delete mode 100644 x/foundation/spec/03_events.md delete mode 100644 x/foundation/spec/04_params.md delete mode 100644 x/foundation/spec/README.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c08a29c1c..4b9ef6f891 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -134,3 +134,4 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (docs) [\#483](https://github.com/line/lbm-sdk/pull/483) update documents on x/stakingplus * (docs) [\#490](https://github.com/line/lbm-sdk/pull/490) update documents on x/consortium * (docs) [\#602](https://github.com/line/lbm-sdk/pull/602) update outdated events in specs +* (docs) [\#721](https://github.com/line/lbm-sdk/pull/721) update x/foundation specification diff --git a/x/README.md b/x/README.md index 85970a67cd..9579cebc3c 100644 --- a/x/README.md +++ b/x/README.md @@ -11,7 +11,7 @@ Here are some production-grade modules that can be used in Cosmos SDK applicatio - [Authz](authz/spec/README.md) - Authorization for accounts to perform actions on behalf of other accounts. - [Bank](bank/spec/README.md) - Token transfer functionalities. - [Capability](capability/spec/README.md) - Object capability implementation. -- [Foundation](foundation/spec/README.md) - foundation related functionalities. +- [Foundation](foundation/README.md) - foundation related functionalities. - [Crisis](crisis/spec/README.md) - Halting the blockchain under certain circumstances (e.g. if an invariant is broken). - [Distribution](distribution/spec/README.md) - Fee distribution, and staking token provision distribution. - [Evidence](evidence/spec/README.md) - Evidence handling for double signing, misbehaviour, etc. diff --git a/x/foundation/README.md b/x/foundation/README.md new file mode 100644 index 0000000000..79a379c278 --- /dev/null +++ b/x/foundation/README.md @@ -0,0 +1,1556 @@ + + +# `x/foundation` + +## Abstract + +This module provides the functionalities related to the foundation. +The foundation can turn off these functionalities irreversibly, through the +corresponding proposal. Therefore, the users can ensure that no one can bring +back these foundation-specific functionalities. + +## Contents + +* [Concepts](#concepts) +* [State](#state) +* [Msg Service](#msg-service) + * [Msg/UpdateParams](#msgupdateparams) + * [Msg/UpdateDecisionPolicy](#msgupdatedecisionpolicy) + * [Msg/UpdateMembers](#msgupdatemembers) + * [Msg/LeaveFoundation](#msgleavefoundation) + * [Msg/SubmitProposal](#msgsubmitproposal) + * [Msg/WithdrawProposal](#msgwithdrawproposal) + * [Msg/Vote](#msgvote) + * [Msg/Exec](#msgexec) + * [Msg/Grant](#msggrant) + * [Msg/Revoke](#msgrevoke) + * [Msg/FundTreasury](#msgfundtreasury) + * [Msg/WithdrawFromTreasury](#msgwithdrawfromtreasury) +* [Events](#events) + * [EventUpdateFoundationParams](#eventupdatefoundationparams) + * [EventUpdateDecisionPolicy](#eventupdatedecisionpolicy) + * [EventUpdateMembers](#eventupdatedmembers) + * [EventLeaveFoundation](#eventleavefoundation) + * [EventSubmitProposal](#eventsubmitproposal) + * [EventWithdrawProposal](#eventwithdrawproposal) + * [EventVote](#eventvote) + * [EventExec](#eventexec) + * [EventGrant](#eventgrant) + * [EventRevoke](#eventrevoke) + * [EventFundTreasury](#eventfundedtreasury) + * [EventWithdrawFromTreasury](#eventwithdrawedfromtreasury) +* [Client](#client) + * [CLI](#cli) + * [gRPC](#grpc) + +# Concepts + +## Foundation Operator + +A foundation operator is a module account associated with the foundation and a +decision policy. It is an "administrator" which has the ability to add, remove +and update members in the foundation. +`x/foundation` has several messages which cannot be triggered but by the +operator. It includes membership management messages, and other messages which +controls the assets of the foundation. + +**Note:** The operator is a module account, which means no one has the private +key of the operator. Hence, foundation members MUST propose, vote and execute +the corresponding proposal. + +## Decision Policy + +A decision policy is the rules that dictate whether a proposal should pass or +not based on its tally outcome. + +All decision policies generally would have a mininum execution period and a +maximum voting window. The minimum execution period is the minimum amount of +time that must pass after submission in order for a proposal to potentially be +executed, and it may be set to 0. The maximum voting window is the maximum time +after submission that a proposal may be voted on before it is tallied. + +The chain developer also defines an app-wide maximum execution period, which is +the maximum amount of time after a proposal's voting period end where the +members are allowed to execute a proposal. + +The current foundation module comes shipped with two decision policies: +threshold and percentage. Any chain developer can extend upon these two, by +creating custom decision policies, as long as they adhere to the +`DecisionPolicy` interface: + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/x/foundation/foundation.go#L90-L103 + +### Threshold decision policy + +A threshold decision policy defines a threshold of yes votes (based on a tally +of voter weights) that must be achieved in order for a proposal to pass. For +this decision policy, abstain and veto are simply treated as no's. + +### Percentage decision policy + +A percentage decision policy is similar to a threshold decision policy, except +that the threshold is not defined as a constant weight, but as a percentage. +It's more suited for a foundation where the membership can be updated, as the +percentage threshold stays the same, and doesn't depend on how the number of +members get updated. + +### Outsourcing decision policy + +A outsourcing decision policy is a policy set after `x/foundation` decides to +outsource its proposal relevant features to other modules (e.g. `x/group`). +It means one can expect that any states relevant to the feature must be removed +in the update to this policy. + +## Proposal + +Any foundation member(s) can submit a proposal for the foundation policy +account to decide upon. A proposal consists of a set of messages that will be +executed if the proposal passes as well as any metadata associated with the +proposal. + +### Voting + +There are four choices to choose while voting - yes, no, abstain and veto. Not +all decision policies will take the four choices into account. Votes can +contain some optional metadata. + +In the current implementation, the voting window begins as soon as a proposal +is submitted, and the end is defined by the decision policy. + +### Withdrawing Proposals + +Proposals can be withdrawn any time before the voting period end, either by the +foundation operator or by one of the proposers. Once withdrawn, it is marked as +`PROPOSAL_STATUS_WITHDRAWN`, and no more voting or execution is allowed on it. + +### Aborted Proposals + +If the decision policy is updated during the voting period of the proposal, +then the proposal is marked as `PROPOSAL_STATUS_ABORTED`, and no more voting or +execution is allowed on it. This is because the decision policy defines the +rules of proposal voting and execution, so if those rules change during the +lifecycle of a proposal, then the proposal should be marked as stale. + +### Tallying + +Tallying is the counting of all votes on a proposal. It can be triggered by the +following two factors: + +* either someone tries to execute the proposal (see next section), which can + happen on a `Msg/Exec` transaction, or a `Msg/{SubmitProposal,Vote}` + transaction with the `Exec` field set. When a proposal execution is + attempted, a tally is done first to make sure the proposal passes. +* or on `EndBlock` when the proposal's voting period end just passed. + +If the tally result passes the decision policy's rules, then the proposal is +marked as `PROPOSAL_STATUS_ACCEPTED`, or else it is marked as +`PROPOSAL_STATUS_REJECTED`. In any case, no more voting is allowed anymore, and +the tally result is persisted to state in the proposal's `FinalTallyResult`. + +### Executing Proposals + +Proposals are executed only when the tallying is done, and the decision policy +allows the proposal to pass based on the tally outcome. They are marked by the +status `PROPOSAL_STATUS_ACCEPTED`. Execution must happen before a duration of +`MaxExecutionPeriod` (set by the chain developer) after each proposal's voting +period end. + +Proposals will not be automatically executed by the chain in this current +design, but rather a member must submit a `Msg/Exec` transaction to attempt to +execute the proposal based on the current votes and decision policy. Any member +can execute proposals that have been accepted, and execution fees are paid by +the proposal executor. + +It's also possible to try to execute a proposal immediately on creation or on +new votes using the `Exec` field of `Msg/SubmitProposal` and `Msg/Vote` +requests. In the former case, proposers signatures are considered as yes votes. +In these cases, if the proposal can't be executed (i.e. it didn't pass the +decision policy's rules), it will still be opened for new votes and +could be tallied and executed later on. + +A successful proposal execution will have its `ExecutorResult` marked as +`PROPOSAL_EXECUTOR_RESULT_SUCCESS`. The proposal will be automatically pruned +after execution. On the other hand, a failed proposal execution will be marked +as `PROPOSAL_EXECUTOR_RESULT_FAILURE`. Such a proposal can be re-executed +multiple times, until it expires after `MaxExecutionPeriod` after voting period +end. + +## Pruning + +Proposals and votes are automatically pruned to avoid state bloat. + +Votes are pruned: + +* either after a successful tally, i.e. a tally whose result passes the + decision policy's rules, which can be trigged by a `Msg/Exec` or a + `Msg/{SubmitProposal,Vote}` with the `Exec` field set, +* or on `EndBlock` right after the proposal's voting period end. This applies + to proposals with status `aborted` or `withdrawn` too. +* or after updating the membership or decision policy. + +whichever happens first. + +Proposals are pruned: + +* on `EndBlock` whose proposal status is `withdrawn` or `aborted` on proposal's + voting period end before tallying, +* and either after a successful proposal execution, +* or on `EndBlock` right after the proposal's `voting_period_end` + + `max_execution_period` (defined as an app-wide configuration) is passed, + +whichever happens first. + +## Authorization + +The foundation module defines interfaces of authorizations on messages to +enforce_censorship_ on its execution. The other modules may deny the execution +of the message based on the information in the foundation. +`Authorization` is an interface that must be implemented by a concrete +authorization logic to validate and execute grants. `Authorization`s are +extensible and can be defined for any Msg service method even outside of the +module where the Msg method is defined. + +**Note:** The foundation module's `Authorization` is different from that of +`x/authz`, while the latter allows an account to perform actions on behalf of +another account. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/x/foundation/authz.go#L10-L27 + +## Built-in Authorizations + +### ReceiveFromTreasuryAuthorization + +`ReceiveFromTreasuryAuthorization` implements the `Authorization` interface for +the [Msg/WithdrawFromTreasury](#msgwithdrawfromtreasury). + +**Note:** The subject which executes +`lbm.foundation.v1.MsgWithdrawFromTreasury` is the foundation. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/authz.proto#L9-L13 + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/x/foundation/authz.pb.go#L27-L30 + +### CreateValidatorAuthorization + +`CreateValidatorAuthorization` implements the `Authorization` interface for the +[Msg/CreateValidator](../stakingplus/spec/03_messages.md#msgcreatevalidator). +An account must have this authorization prior to sending the message. + +**Note:** You MUST provide the `CreateValidatorAuthorization`s into the genesis +if `Msg/CreateValidator` is being censored (`CensoredMsgTypeUrls` contains the +url of `Msg/CreateValidator`), or the chain cannot be started. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/stakingplus/v1/authz.proto#L9-L15 + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/x/stakingplus/authz.pb.go#L27-L31 + +## Foundation Treasury + +`x/foundation` intercepts the rewards prior to its distribution +(by `x/distribution`). The rate would be `FoundationTax`. + +The foundation can withdraw coins from the treasury. The recipient must have +the corresponding authorization (`ReceiveFromTreasuryAuthorization`) prior to +sending the message `Msg/WithdrawFromTreasury`. + +**Note:** After setting the tax rate to zero, you cannot set it to a non-zero +value again (irreversible), which means you must set it to a non-zero value in +the genesis to make it work. + +# State + +## Params + +* Params: `0x00 -> PropocolBuffer(Params)`. + +### FoundationTax + +The value of `FoundationTax` is the foundation tax rate. + +### CensoredMsgTypeUrls + +The `CensoredMsgTypeUrls` contains the urls of the messages under the +censorship. + +## FoundationInfo + +`FoundationInfo` contains the information relevant to the foundation. + +* FoundationInfo: `0x01 -> ProtocolBuffer(FoundationInfo)`. + +### Operator + +The `Operator` is the account address of the foundation operator. + +### Version + +The `Version` is used to track changes to the foundation membership. Whenever +the membership is changed, this value is incremented, which will cause +proposals based on older versions to fail. + +### TotalWeight + +The `TotalWeight` is the number of the foundation members. + +### DecisionPolicy + +The `DecisionPolicy` is the decision policy of the foundation. + +## Member + +The `Member` is the foundation member. + +* Member: `0x10 | []byte(member.Address) -> ProtocolBuffer(Member)`. + +## PreviousProposalID + +The value of the `PreviousProposalID` is the last used proposal ID. The chain +uses this value to issue the ID of the next new proposal. + +* PreviousProposalID: `0x11 -> BigEndian(ProposalId)`. + +## Proposal + +* Proposal: `0x12 | BigEndian(ProposalId) -> ProtocolBuffer(Proposal)`. + +## ProposalByVotingPeriodEnd + +`ProposalByVotingPeriodEnd` allows to retrieve proposals sorted by +chronological `voting_period_end`. This index is used when tallying the +proposal votes at the end of the voting period, and for pruning proposals at +`VotingPeriodEnd + MaxExecutionPeriod`. + +* ProposalByVotingPeriodEnd: + `0x13 | sdk.FormatTimeBytes(proposal.VotingPeriodEnd) | BigEndian(ProposalId) -> []byte()`. + +## Vote + +* Vote: `0x40 | BigEndian(ProposalId) | []byte(voter.Address) -> ProtocolBuffer(Vote)`. + +## Grant + +Grants are identified by combining grantee address and `Authorization` type +(its target message type URL). Hence we only allow one grant for the (grantee, +Authorization) tuple. + +* Grant: `0x20 | len(grant.Grantee) (1 byte) | []byte(grant.Grantee) | []byte(grant.Authorization.MsgTypeURL()) -> ProtocolBuffer(Authorization)` + +# Msg Service + +## Msg/UpdateParams + +The `MsgUpdateParams` can be used to update the parameters of `foundation`. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L62-L71 + +It's expected to fail if: + +* the signer is not the foundation operator. +* the parameters introduces any new foundation-specific features. + +## Msg/UpdateDecisionPolicy + +The `MsgUpdateDecisionPolicy` can be used to update the decision policy. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L110-L117 + +It's expected to fail if: + +* the signer is not the foundation operator. +* the new decision policy's `Validate()` method doesn't pass. + +## Msg/UpdateMembers + +Foundation members can be updated with the `MsgUpdateMembers`. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L97-L105 + +In the list of `MemberUpdates`, an existing member can be removed by setting +its `remove` flag to true. + +It's expected to fail if: + +* the signer is not the foundation operator. +* if the decision policy's `Validate()` method fails against the updated + membership. + +## Msg/LeaveFoundation + +The `MsgLeaveFoundation` allows a foundation member to leave the foundation. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L205-L209 + +It's expected to fail if: + +* the address is not of a foundation member. +* if the decision policy's `Validate()` method fails against the updated + membership. + +## Msg/SubmitProposal + +A new proposal can be created with the `MsgSubmitProposal`, which has a list of +proposers addresses, a list of messages to execute if the proposal is accepted +and some optional metadata. +An optional `Exec` value can be provided to try to execute the proposal +immediately after proposal creation. Proposers signatures are considered as yes +votes in this case. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L135-L151 + +It's expected to fail if: + +* metadata length is greater than `MaxMetadataLen` config. +* if any of the proposers is not a foundation member. + +## Msg/WithdrawProposal + +A proposal can be withdrawn using `MsgWithdrawProposal` which has an `address` +(can be either a proposer or the foundation operator) and a `proposal_id` +(which has to be withdrawn). + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L159-L166 + +It's expected to fail if: + +* the signer is neither the foundation operator nor a proposer of the proposal. +* the proposal is already closed or aborted. + +## Msg/Vote + +A new vote can be created with the `MsgVote`, given a proposal id, a voter +address, a choice (yes, no, veto or abstain) and some optional metadata. +An optional `Exec` value can be provided to try to execute the proposal +immediately after voting. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L171-L188 + +It's expected to fail if: + +* metadata length is greater than `MaxMetadataLen` config. +* the proposal is not in voting period anymore. + +## Msg/Exec + +A proposal can be executed with the `MsgExec`. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L193-L200 + +The messages that are part of this proposal won't be executed if: + +* the proposal has not been accepted by the decision policy. +* the proposal has already been successfully executed. + +## Msg/Grant + +An authorization grant is created using the `MsgGrant` message. +If there is already a grant for the `(grantee, Authorization)` tuple, then the +new grant overwrites the previous one. To update or extend an existing grant, a +new grant with the same `(grantee, Authorization)` tuple should be created. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L214-L222 + +The message handling should fail if: + +* provided `Authorization` is not implemented. +* `Authorization.MsgTypeURL()` is not defined in the router (there is no + defined handler in the app router to handle that Msg types). + +**Note:** Do NOT confuse with that of `x/authz`. + +## Msg/Revoke + +A grant can be removed with the `MsgRevoke` message. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L227-L232 + +The message handling should fail if: + +* provided `MsgTypeUrl` is empty. + +## Msg/FundTreasury + +Anyone can fund treasury with `MsgFundTreasury`. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L76-L81 + +## Msg/WithdrawFromTresury + +The foundation can withdraw coins from the treasury with +`MsgWithdrawFromTreasury`. + ++++ https://github.com/line/lbm-sdk/blob/392277a33519d289154e8da27f05f9a6788ab076/proto/lbm/foundation/v1/tx.proto#L86-L92 + +The message handling should fail if: + +* the signer is not the foundation operator. +* the address which receives the coins has no authorization of + `ReceiveFromTreasuryAuthorization`. + +# Events + +## EventUpdateFoundationParams + +`EventUpdateFoundationParams` is an event emitted when the foundation +parameters have been updated. + +| Attribute Key | Attribute Value | +|---------------|-----------------| +| params | {params} | + +## EventUpdateDecisionPolicy + +`EventUpdateDecisionPolicy` is an event emitted when the decision policy have +been updated. + +| Attribute Key | Attribute Value | +|-----------------|------------------| +| decision_policy | {decisionPolicy} | + +## EventUpdateMembers + +`EventUpdateMembers` is an event emitted when the foundation members have been +updated. + +| Attribute Key | Attribute Value | +|----------------|-----------------| +| member_updates | {members} | + +## EventLeaveFoundation + +`EventLeaveFoundation` is an event emitted when a foundation member leaves the +foundation. + +| Attribute Key | Attribute Value | +|---------------|-----------------| +| address | {memberAddress} | + +## EventSubmitProposal + +`EventSubmitProposal` is an event emitted when a proposal is submitted. + +| Attribute Key | Attribute Value | +|---------------|-----------------| +| proposal | {proposal} | + +## EventWithdrawProposal + +`EventWithdrawProposal` is an event emitted when a proposal is withdrawn. + +| Attribute Key | Attribute Value | +|---------------|-----------------| +| proposal_id | {proposalId} | + +## EventVote + +`EventVote` is an event emitted when a voter votes on a proposal. + +| Attribute Key | Attribute Value | +|---------------|-----------------| +| vote | {vote} | + +## EventExec + +`EventExec` is an event emitted when a proposal is executed. + +| Attribute Key | Attribute Value | +|---------------|-----------------| +| proposal_id | {proposalId} | +| result | {result} | + +## EventGrant + +`EventGrant` is an event emitted when an authorization is granted to a grantee. + +| Attribute Key | Attribute Value | +|---------------|------------------| +| grantee | {granteeAddress} | +| authorization | {authorization} | + +## EventRevoke + +`EventRevoke` is an event emitted when an authorization is revoked from a +grantee. + +| Attribute Key | Attribute Value | +|---------------|------------------| +| grantee | {granteeAddress} | +| msg_type_url | {msgTypeURL} | + +## EventFundTreasury + +`EventFundTreasury` is an event emitted when one funds the treasury. + +| Attribute Key | Attribute Value | +|---------------|-----------------| +| from | {fromAddress} | +| amount | {amount} | + +## EventWithdrawFromTreasury + +`EventWithdrawFromTreasury` is an event emitted when coins are withdrawn from +the treasury. + +| Attribute Key | Attribute Value | +|---------------|-----------------| +| to | {toAddress} | +| amount | {amount} | + +# Client + +## CLI + +A user can query and interact with the `foundation` module using the CLI. + +### Query + +The `query` commands allow users to query `foundation` state. + +```bash +simd query foundation --help +``` + +#### params + +The `params` command allows users to query for the parameters of `foundation`. + +```bash +simd query foundation params [flags] +``` + +Example: + +```bash +simd query foundation params +``` + +Example Output: + +```bash +params: + censored_msg_type_urls: + - /cosmos.staking.v1beta1.MsgCreateValidator + - /lbm.foundation.v1.MsgWithdrawFromTreasury + foundation_tax: "0.200000000000000000" +``` + +#### foundation-info + +The `foundation-info` command allows users to query for the foundation info. + +```bash +simd query foundation foundation-info [flags] +``` + +Example: + +```bash +simd query foundation foundation-info +``` + +Example Output: + +```bash +info: + decision_policy: + '@type': /lbm.foundation.v1.ThresholdDecisionPolicy + threshold: "3.000000000000000000" + windows: + min_execution_period: 0s + voting_period: 86400s + operator: link1... + total_weight: "3.000000000000000000" + version: "1" +``` + +#### member + +The `member` command allows users to query for a foundation member by address. + +```bash +simd query foundation member [address] [flags] +``` + +Example: + +```bash +simd query foundation member link1... +``` + +Example Output: + +```bash +member: + added_at: "0001-01-01T00:00:00Z" + address: link1... + metadata: genesis member +``` + +#### members + +The `members` command allows users to query for the foundation members with +pagination flags. + +```bash +simd query foundation members [flags] +``` + +Example: + +```bash +simd query foundation members +``` + +Example Output: + +```bash +members: +- added_at: "0001-01-01T00:00:00Z" + address: link1... + metadata: genesis member +- added_at: "0001-01-01T00:00:00Z" + address: link1... + metadata: genesis member +- added_at: "0001-01-01T00:00:00Z" + address: link1... + metadata: genesis member +pagination: + next_key: null + total: "3" +``` + +#### proposal + +The `proposal` command allows users to query for proposal by id. + +```bash +simd query foundation proposal [id] [flags] +``` + +Example: + +```bash +simd query foundation proposal 1 +``` + +Example Output: + +```bash +proposal: + executor_result: PROPOSAL_EXECUTOR_RESULT_NOT_RUN + final_tally_result: + abstain_count: "0.000000000000000000" + no_count: "0.000000000000000000" + no_with_veto_count: "0.000000000000000000" + yes_count: "0.000000000000000000" + foundation_version: "1" + id: "1" + messages: + - '@type': /lbm.foundation.v1.MsgWithdrawFromTreasury + amount: + - amount: "1000000000" + denom: stake + operator: link1... + to: link1... + metadata: show-me-the-money + proposers: + - link1... + status: PROPOSAL_STATUS_SUBMITTED + submit_time: "2022-09-19T01:26:38.544943184Z" + voting_period_end: "2022-09-20T01:26:38.544943184Z" +``` + +#### proposals + +The `proposals` command allows users to query for proposals with pagination +flags. + +```bash +simd query foundation proposals [flags] +``` + +Example: + +```bash +simd query foundation proposals +``` + +Example Output: + +```bash +pagination: + next_key: null + total: "1" +proposals: +- executor_result: PROPOSAL_EXECUTOR_RESULT_NOT_RUN + final_tally_result: + abstain_count: "0.000000000000000000" + no_count: "0.000000000000000000" + no_with_veto_count: "0.000000000000000000" + yes_count: "0.000000000000000000" + foundation_version: "1" + id: "1" + messages: + - '@type': /lbm.foundation.v1.MsgWithdrawFromTreasury + amount: + - amount: "1000000000" + denom: stake + operator: link1... + to: link1... + metadata: show-me-the-money + proposers: + - link1... + status: PROPOSAL_STATUS_SUBMITTED + submit_time: "2022-09-19T01:26:38.544943184Z" + voting_period_end: "2022-09-20T01:26:38.544943184Z" +``` + +#### vote + +The `vote` command allows users to query for vote by proposal id and voter +account address. + +```bash +simd query foundation vote [proposal-id] [voter] [flags] +``` + +Example: + +```bash +simd query foundation vote 1 link1... +``` + +Example Output: + +```bash +vote: + metadata: nope + option: VOTE_OPTION_NO + proposal_id: "1" + submit_time: "2022-09-19T01:35:30.920689570Z" + voter: link1... +``` + +#### votes + +The `votes` command allows users to query for votes by proposal id with +pagination flags. + +```bash +simd query foundation votes [proposal-id] [flags] +``` + +Example: + +```bash +simd query foundation votes 1 +``` + +Example Output: + +```bash +pagination: + next_key: null + total: "1" +votes: +- metadata: nope + option: VOTE_OPTION_NO + proposal_id: "1" + submit_time: "2022-09-19T01:35:30.920689570Z" + voter: link1... +``` + +#### tally + +The `tally` command allows users to query for the tally in progress by its +proposal id. + +```bash +simd query foundation tally [proposal-id] [flags] +``` + +Example: + +```bash +simd query foundation tally 1 +``` + +Example Output: + +```bash +tally: + abstain_count: "0.000000000000000000" + no_count: "1.000000000000000000" + no_with_veto_count: "0.000000000000000000" + yes_count: "0.000000000000000000" +``` + +#### grants + +The `grants` command allows users to query grants for a grantee. If the message +type URL is set, it selects grants only for that message type. + +```bash +simd query foundation grants [grantee] [msg-type-url]? [flags] +``` + +Example: + +```bash +simd query foundation grants link1... /lbm.foundation.v1.MsgWithdrawFromTreasury +``` + +Example Output: + +```bash +authorizations: +- '@type': /lbm.foundation.v1.ReceiveFromTreasuryAuthorization +pagination: null +``` + +#### treasury + +The `treasury` command allows users to query for the foundation treasury. + +```bash +simd query foundation treasury [flags] +``` + +Example: + +```bash +simd query foundation treasury +``` + +Example Output: + +```bash +amount: +- amount: "1000000000000.000000000000000000" + denom: stake +``` + +### Transactions + +The `tx` commands allow users to interact with the `foundation` module. + +```bash +simd tx foundation --help +``` + +**Note:** Some commands must be signed by the foundation operator, which means +you cannot broadcast the message directly. The use of those commands is to make +it easier to generate the messages by end users. + +#### update-params + +The `update-params` command allows users to update the foundation's parameters. + +```bash +simd tx foundation update-params [authority] [params-json] [flags] +``` + +Example: + +```bash +simd tx foundation update-params link1... \ + '{ + "foundation_tax": "0.1", + "censored_msg_type_urls": [ + "/cosmos.staking.v1beta1.MsgCreateValidator", + "/lbm.foundation.v1.MsgWithdrawFromTreasury" + ] + }' +``` + +**Note:** The signer is the foundation operator. + +#### update-members + +The `update-members` command allows users to update the foundation's members. + +```bash +simd tx foundation update-members [operator] [members-json] [flags] +``` + +Example: + +```bash +simd tx foundation update-members link1... \ + '[ + { + "address": "link1...", + "metadata": "some new metadata" + }, + { + "address": "link1...", + "remove": true, + } + ]' +``` + +**Note:** The signer is the foundation operator. + +#### update-decision-policy + +The `update-decision-policy` command allows users to update the foundation's +decision policy. + +```bash +simd tx foundation update-decision-policy [operator] [decision-policy-json] [flags] +``` + +Example: + +```bash +simd tx foundation update-decision-policy link1... \ + '{ + "@type": "/lbm.foundation.v1.ThresholdDecisionPolicy", + "threshold": "4", + "windows": { + "voting_period": "1h", + "min_execution_period": "0s" + } + }' +``` + +**Note:** The signer is the foundation operator. + +#### submit-proposal + +The `submit-proposal` command allows users to submit a new proposal. + +```bash +simd tx foundation submit-proposal [metadata] [proposers-json] [proposers-json] [messages-json] [flags] +``` + +Example: + +```bash +simd tx foundation submit-proposal show-me-the-money \ + '[ + "link1...", + "link1..." + ]' \ + '[ + { + "@type": "/lbm.foundation.v1.MsgWithdrawFromTreasury", + "operator": "link1...", + "to": "link1...", + "amount": [ + { + "denom": "stake", + "amount": "10000000000" + } + ] + } + ]' +``` + +#### withdraw-proposal + +The `withdraw-proposal` command allows users to withdraw a proposal. + +```bash +simd tx foundation withdraw-proposal [proposal-id] [operator-or-proposer] [flags] +``` + +Example: + +```bash +simd tx foundation withdraw-proposal 1 link1... +``` + +#### vote + +The `vote` command allows users to vote on a proposal. + +```bash +simd tx foundation vote [proposal-id] [voter] [option] [metadata] [flags] +``` + +Example: + +```bash +simd tx foundation vote 1 link1... VOTE_OPTION_NO nope +``` + +#### exec + +The `exec` command allows users to execute a proposal. + +```bash +simd tx foundation exec [proposal-id] [flags] +``` + +Example: + +```bash +simd tx foundation exec 1 +``` + +#### leave-foundation + +The `leave-foundation` command allows foundation member to leave the +foundation. + +```bash +simd tx foundation leave-foundation [address] [flags] +``` + +Example: + +```bash +simd tx foundation leave-foundation link1... +``` + +#### grant + +The `grant` command allows users to grant an authorization to a grantee. + +```bash +simd tx foundation grant [operator] [grantee] [authorization-json] [flags] +``` + +Example: + +```bash +simd tx foundation grant link1.. link1... \ + '{ + "@type": "/lbm.foundation.v1.ReceiveFromTreasuryAuthorization", + }' +``` + +**Note:** The signer is the foundation operator. + +#### revoke + +The `revoke` command allows users to revoke an authorization from a grantee. + +```bash +simd tx foundation revoke [operator] [grantee] [msg-type-url] [flags] +``` + +Example: + +```bash +simd tx foundation revoke link1.. link1... /lbm.foundation.v1.MsgWithdrawFromTreasury +``` + +**Note:** The signer is the foundation operator. + +#### fund-treasury + +The `fund-treasury` command allows users to fund the foundation treasury. + +```bash +simd tx foundation fund-treasury [from] [amount] [flags] +``` + +Example: + +```bash +simd tx foundation fund-treasury link1.. 1000stake +``` + +#### withdraw-from-treasury + +The `withdraw-from-treasury` command allows users to withdraw coins from the +foundation treasury. + +```bash +simd tx foundation withdraw-from-treasury [operator] [to] [amount] [flags] +``` + +Example: + +```bash +simd tx foundation withdraw-from-treasury link1.. link1... 1000stake +``` + +**Note:** The signer is the foundation operator. + +## gRPC + +A user can query the `foundation` module using gRPC endpoints. + +```bash +grpcurl -plaintext \ + localhost:9090 list lbm.foundation.v1.Query +``` + +### Params + +The `Params` endpoint allows users to query for the parameters of `foundation`. + +```bash +lbm.foundation.v1.Query/Params +``` + +Example: + +```bash +grpcurl -plaintext \ + localhost:9090 lbm.foundation.v1.Query/Params +``` + +Example Output: + +```bash +{ + "params": { + "foundationTax": "200000000000000000" + "censoredMsgTypeUrls": [ + "/cosmos.staking.v1beta1.MsgCreateValidator", + "/lbm.foundation.v1.MsgWithdrawFromTreasury" + ] + } +} +``` + +### FoundationInfo + +The `FoundationInfo` endpoint allows users to query for the foundation info. + +```bash +lbm.foundation.v1.Query/FoundationInfo +``` + +Example: + +```bash +grpcurl -plaintext \ + localhost:9090 lbm.foundation.v1.Query/FoundationInfo +``` + +Example Output: + +```bash +{ + "info": { + "operator": "link1...", + "version": "1", + "totalWeight": "3000000000000000000", + "decisionPolicy": {"@type":"/lbm.foundation.v1.ThresholdDecisionPolicy","threshold":"3000000000000000000","windows":{"votingPeriod":"86400s","minExecutionPeriod":"0s"}} + } +} +``` + +### Member + +The `Member` endpoint allows users to query for a foundation member by address. + +```bash +lbm.foundation.v1.Query/Member +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"address": "link1..."}' + localhost:9090 lbm.foundation.v1.Query/Member +``` + +Example Output: + +```bash +{ + "member": { + "address": "link1...", + "metadata": "genesis member", + "addedAt": "0001-01-01T00:00:00Z" + } +} +``` + +### Members + +The `Members` endpoint allows users to query for the foundation members with +pagination flags. + +```bash +lbm.foundation.v1.Query/Members +``` + +Example: + +```bash +grpcurl -plaintext \ + localhost:9090 lbm.foundation.v1.Query/Members +``` + +Example Output: + +```bash +{ + "members": [ + { + "address": "link1...", + "metadata": "genesis member", + "addedAt": "0001-01-01T00:00:00Z" + }, + { + "address": "link1...", + "metadata": "genesis member", + "addedAt": "0001-01-01T00:00:00Z" + }, + { + "address": "link1...", + "metadata": "genesis member", + "addedAt": "0001-01-01T00:00:00Z" + } + ], + "pagination": { + "total": "3" + } +} +``` + +### Proposal + +The `Proposal` endpoint allows users to query for proposal by id. + +```bash +lbm.foundation.v1.Query/Proposal +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"proposal_id": "1"}' \ + localhost:9090 lbm.foundation.v1.Query/Proposal +``` + +Example Output: + +```bash +{ + "proposal": { + "id": "1", + "metadata": "show-me-the-money", + "proposers": [ + "link1..." + ], + "submitTime": "2022-09-19T01:26:38.544943184Z", + "foundationVersion": "1", + "status": "PROPOSAL_STATUS_SUBMITTED", + "finalTallyResult": { + "yesCount": "0", + "abstainCount": "0", + "noCount": "0", + "noWithVetoCount": "0" + }, + "votingPeriodEnd": "2022-09-20T01:26:38.544943184Z", + "executorResult": "PROPOSAL_EXECUTOR_RESULT_NOT_RUN", + "messages": [ + {"@type":"/lbm.foundation.v1.MsgWithdrawFromTreasury","amount":[{"denom":"stake","amount":"1000000000"}],"operator":"link1...","to":"link1..."} + ] + } +} +``` + +### Proposals + +The `Proposals` endpoint allows users to query for proposals with pagination +flags. + +```bash +lbm.foundation.v1.Query/Proposals +``` + +Example: + +```bash +grpcurl -plaintext \ + localhost:9090 lbm.foundation.v1.Query/Proposals +``` + +Example Output: + +```bash +{ + "proposals": [ + { + "id": "1", + "metadata": "show-me-the-money", + "proposers": [ + "link1..." + ], + "submitTime": "2022-09-19T01:26:38.544943184Z", + "foundationVersion": "1", + "status": "PROPOSAL_STATUS_SUBMITTED", + "finalTallyResult": { + "yesCount": "0", + "abstainCount": "0", + "noCount": "0", + "noWithVetoCount": "0" + }, + "votingPeriodEnd": "2022-09-20T01:26:38.544943184Z", + "executorResult": "PROPOSAL_EXECUTOR_RESULT_NOT_RUN", + "messages": [ + {"@type":"/lbm.foundation.v1.MsgWithdrawFromTreasury","amount":[{"denom":"stake","amount":"1000000000"}],"operator":"link1...","to":"link1..."} + ] + } + ], + "pagination": { + "total": "1" + } +} +``` + +### Vote + +The `Vote` endpoint allows users to query for vote by proposal id and voter account address. + +```bash +lbm.foundation.v1.Query/Vote +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"proposal_id": "1", "voter": "link1..."}' \ + localhost:9090 lbm.foundation.v1.Query/Vote +``` + +Example Output: + +```bash +{ + "vote": { + "proposalId": "1", + "voter": "link1...", + "option": "VOTE_OPTION_NO", + "metadata": "nope", + "submitTime": "2022-09-19T01:35:30.920689570Z" + } +} +``` + +### Votes + +The `Votes` endpoint allows users to query for votes by proposal id with +pagination flags. + +```bash +lbm.foundation.v1.Query/Votes +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"proposal_id": "1"}' \ + localhost:9090 lbm.foundation.v1.Query/Votes +``` + +Example Output: + +```bash +{ + "votes": [ + { + "proposalId": "1", + "voter": "link1...", + "option": "VOTE_OPTION_NO", + "metadata": "nope", + "submitTime": "2022-09-19T01:35:30.920689570Z" + } + ], + "pagination": { + "total": "1" + } +} +``` + +### TallyResult + +The `TallyResult` endpoint allows users to query for the tally in progress by +its proposal id. + +```bash +lbm.foundation.v1.Query/Vote +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"proposal_id": "1"}' \ + localhost:9090 lbm.foundation.v1.Query/TallyResult +``` + +Example Output: + +```bash +{ + "tally": { + "yesCount": "0", + "abstainCount": "0", + "noCount": "1000000000000000000", + "noWithVetoCount": "0" + } +} +``` + +### Grants + +The `Grants` endpoint allows users to query grants for a grantee. If the +message type URL is set, it selects grants only for that message type. + +```bash +lbm.foundation.v1.Query/Grants +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"grantee": "link1...", "msg_type_url": "/lbm.foundation.v1.MsgWithdrawFromTreasury"}' \ + localhost:9090 lbm.foundation.v1.Query/Grants +``` + +Example Output: + +```bash +{ + "authorizations": [ + {"@type":"/lbm.foundation.v1.ReceiveFromTreasuryAuthorization"} + ] +} +``` + +### Treasury + +The `Treasury` endpoint allows users to query for the foundation treasury. + +```bash +lbm.foundation.v1.Query/Treasury +``` + +Example: + +```bash +grpcurl -plaintext \ + localhost:9090 lbm.foundation.v1.Query/Treasury +``` + +Example Output: + +```bash +{ + "amount": [ + { + "denom": "stake", + "amount": "1000000000000000000000000000000" + } + ] +} +``` diff --git a/x/foundation/spec/01_concepts.md b/x/foundation/spec/01_concepts.md deleted file mode 100644 index 1e693d5de9..0000000000 --- a/x/foundation/spec/01_concepts.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Concepts - -## Authorization - -The foundation module is designed to contain the authorization information. The other modules may deny its message based on the information of the foundation. As of now, the following modules are using the information: - -- **[Staking Plus](../../stakingplus/spec/README.md)** - - [Msg/CreateValidator](../../stakingplus/spec/03_messages.md#msgcreatevalidator) - -One can update the authorization, via proposals: - -- `UpdateValidatorAuthsProposal` to authorize `Msg/CreateValidator` - - +++ https://github.com/line/lbm-sdk/blob/v0.44.0-rc0/proto/lbm/foundation/v1/foundation.proto#L31-L40 - ```go - // UpdateValidatorAuthsProposal details a proposal to update validator auths on foundation. - message UpdateValidatorAuthsProposal { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - string title = 1; - string description = 2; - repeated ValidatorAuth auths = 3 [(gogoproto.moretags) = "yaml:\"auths\""]; - } - ``` - -## Disable the module - -One can disable the foundation module via `UpdateFoundationParamsProposal`, setting its `params.enabled` to `false`. This process is irreversible, so one cannot re-enable the module. - -+++ https://github.com/line/lbm-sdk/blob/v0.44.0-rc0/proto/lbm/foundation/v1/foundation.proto#L20-L29 -```go -// UpdateFoundationParamsProposal details a proposal to update params of foundation module. -message UpdateFoundationParamsProposal { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - string title = 1; - string description = 2; - Params params = 3; -} -``` - -+++ https://github.com/line/lbm-sdk/blob/v0.44.0-rc0/proto/lbm/foundation/v1/foundation.proto#L9-L12 -```go -// Params defines the parameters for the foundation module. -message Params { - bool enabled = 1 [(gogoproto.moretags) = "yaml:\"enabled\""]; -} -``` diff --git a/x/foundation/spec/02_state.md b/x/foundation/spec/02_state.md deleted file mode 100644 index a290c78eb2..0000000000 --- a/x/foundation/spec/02_state.md +++ /dev/null @@ -1,36 +0,0 @@ - - -# State - -## Params - -As of now, the only parameter is on/off of the module. After turning off the module, the changes (might be breaking changes) applied on the other modules would not work, and the module cleans up its state. - -- Params: `0x00 -> PropocolBuffer(Params)` - -+++ https://github.com/line/lbm-sdk/blob/v0.44.0-rc0/proto/lbm/foundation/v1/foundation.proto#L9-L12 -```go -// Params defines the parameters for the foundation module. -message Params { - bool enabled = 1 [(gogoproto.moretags) = "yaml:\"enabled\""]; -} -``` - -## ValidatorAuth - -An operator must have been authorized before creating its validator node. `ValidatorAuth`s contain the authorization on the operators. One can authorize itself or other operator by the corresponding proposal, `lbm/foundation/v1/UpdateValidatorAuthsProposal`. - -Note that if the chain starts with an empty list of it in the genesis, the module authorizes all the operators included in the list of validators, read from the staking module. - -- ValidatorAuth: `0x01 -> ProtocolBuffer(ValidatorAuth)` - -+++ https://github.com/line/lbm-sdk/blob/v0.44.0-rc0/proto/lbm/foundation/v1/foundation.proto#L14-L18 -```go -// ValidatorAuth defines authorization info of a validator. -message ValidatorAuth { - string operator_address = 1 [(gogoproto.moretags) = "yaml:\"operator_address\""]; - bool creation_allowed = 2 [(gogoproto.moretags) = "yaml:\"creation_allowed\""]; -} -``` diff --git a/x/foundation/spec/03_events.md b/x/foundation/spec/03_events.md deleted file mode 100644 index 3578b3fe79..0000000000 --- a/x/foundation/spec/03_events.md +++ /dev/null @@ -1,7 +0,0 @@ - - -# Events - -The foundation module emits proto events defined in [the Protobuf reference](../../../docs/core/proto-docs.md#lbm/foundation/v1/event.proto). diff --git a/x/foundation/spec/04_params.md b/x/foundation/spec/04_params.md deleted file mode 100644 index 11e8c4679a..0000000000 --- a/x/foundation/spec/04_params.md +++ /dev/null @@ -1,13 +0,0 @@ - - -# Parameters - -The foundation module contains the following parameters: - -| Key | Type | Example | -| ------- | ---- | --------- | -| enabled | bool | false [0] | - -* [0] The value of `enabled` cannot be switched from false to true. diff --git a/x/foundation/spec/README.md b/x/foundation/spec/README.md deleted file mode 100644 index 960c4efb00..0000000000 --- a/x/foundation/spec/README.md +++ /dev/null @@ -1,19 +0,0 @@ - - -# `foundation` - -## Overview - -This module provides the functionalities related to the foundation. Also, one can turn off these functionalities irreversibly, through the corresponding proposal. Therefore, the users can ensure that no one can bring back these foundation-specific functionalities. - -## Contents - -1. **[Concepts](01_concepts.md)** -2. **[State](02_state.md)** -3. **[Events](03_events.md)** -4. **[Parameters](04_params.md)** From b13ab12b96750ad567f822c3dfd6dfe8a44305bf Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Wed, 19 Oct 2022 07:45:21 +0000 Subject: [PATCH 4/5] fix: prune stale x/foundation proposals at voting period end (#730) * Update pruning logic * Update CHANGELOG.md --- CHANGELOG.md | 1 + x/foundation/keeper/abci_test.go | 25 +++++++++++++++---------- x/foundation/keeper/proposal.go | 18 ++++++++++++++---- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b9ef6f891..486d51c1fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -110,6 +110,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/staking) [\#728](https://github.com/line/lbm-sdk/pull/728) fix typo in unbondingToUnbonded() panic * (crypto) [\#731](https://github.com/line/lbm-sdk/pull/731) remove VRFProve function * (x/foundation) [\#732](https://github.com/line/lbm-sdk/pull/732) add verification on accounts into x/foundation Grants cli +* (x/foundation) [\#730](https://github.com/line/lbm-sdk/pull/730) prune stale x/foundation proposals at voting period end ### Breaking Changes * (proto) [\#564](https://github.com/line/lbm-sdk/pull/564) change gRPC path to original cosmos path diff --git a/x/foundation/keeper/abci_test.go b/x/foundation/keeper/abci_test.go index 46e3de8a9f..80a7572024 100644 --- a/x/foundation/keeper/abci_test.go +++ b/x/foundation/keeper/abci_test.go @@ -66,27 +66,32 @@ func (s *KeeperTestSuite) TestEndBlocker() { keeper.EndBlocker(ctx, s.keeper) for name, tc := range map[string]struct { - id uint64 - status foundation.ProposalStatus + id uint64 + removed bool + status foundation.ProposalStatus }{ "active proposal": { - s.activeProposal, - foundation.PROPOSAL_STATUS_ACCEPTED, + id: s.activeProposal, + status: foundation.PROPOSAL_STATUS_ACCEPTED, }, "voted proposal": { - s.votedProposal, - foundation.PROPOSAL_STATUS_REJECTED, + id: s.votedProposal, + status: foundation.PROPOSAL_STATUS_REJECTED, }, "withdrawn proposal": { - s.withdrawnProposal, - foundation.PROPOSAL_STATUS_WITHDRAWN, + id: s.withdrawnProposal, + removed: true, }, "invalid proposal": { - s.invalidProposal, - foundation.PROPOSAL_STATUS_ACCEPTED, + id: s.invalidProposal, + status: foundation.PROPOSAL_STATUS_ACCEPTED, }, } { proposal, err := s.keeper.GetProposal(ctx, tc.id) + if tc.removed { + s.Require().Error(err, name) + continue + } s.Require().NoError(err, name) s.Require().NotNil(proposal, name) s.Require().Equal(tc.status, proposal.Status, name) diff --git a/x/foundation/keeper/proposal.go b/x/foundation/keeper/proposal.go index 608937e9ce..49fab0b207 100644 --- a/x/foundation/keeper/proposal.go +++ b/x/foundation/keeper/proposal.go @@ -173,15 +173,25 @@ func (k Keeper) iterateProposalsByVPEnd(ctx sdk.Context, endTime time.Time, fn f } func (k Keeper) UpdateTallyOfVPEndProposals(ctx sdk.Context) { + var proposals []foundation.Proposal k.iterateProposalsByVPEnd(ctx, ctx.BlockTime(), func(proposal foundation.Proposal) (stop bool) { + proposals = append(proposals, proposal) + return false + }) + + for _, proposal := range proposals { + proposal := proposal + + if proposal.Status == foundation.PROPOSAL_STATUS_ABORTED || proposal.Status == foundation.PROPOSAL_STATUS_WITHDRAWN { + k.pruneProposal(ctx, proposal) + continue + } + if err := k.doTallyAndUpdate(ctx, &proposal); err != nil { panic(err) } - k.setProposal(ctx, proposal) - - return false - }) + } } func (k Keeper) GetProposal(ctx sdk.Context, id uint64) (*foundation.Proposal, error) { From 0ade7e454315db2e5fda6336ae9014bbcc6504a6 Mon Sep 17 00:00:00 2001 From: Shogo Hyodo Date: Wed, 19 Oct 2022 16:58:19 +0900 Subject: [PATCH 5/5] fix: remove potential runtime panic in x/feegrant (#720) * Remove potential runtime panic * Update `CHANGELOG.md` * Fix for codecov * Add test * Fix for reviews * Add test case * Fix names --- CHANGELOG.md | 1 + x/feegrant/filtered_fee.go | 9 +++-- x/feegrant/filtered_fee_test.go | 71 +++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 486d51c1fd..3555c10113 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -105,6 +105,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (global) [\#694](https://github.com/line/lbm-sdk/pull/694) replace deprecated functions since go 1.16 or 1.17 * (x/bankplus) [\#705](https://github.com/line/lbm-sdk/pull/705) add missing blockedAddr checking in bankplus * (x/foundation) [\#712](https://github.com/line/lbm-sdk/pull/712) fix x/foundation EndBlocker +* (x/feegrant) [\#720](https://github.com/line/lbm-sdk/pull/720) remove potential runtime panic in x/feegrant * (baseapp) [\#724](https://github.com/line/lbm-sdk/pull/724) add checking pubkey type from validator params * (x/staking) [\#726](https://github.com/line/lbm-sdk/pull/726) check allowedList size in StakeAuthorization.Accept() * (x/staking) [\#728](https://github.com/line/lbm-sdk/pull/728) fix typo in unbondingToUnbonded() panic diff --git a/x/feegrant/filtered_fee.go b/x/feegrant/filtered_fee.go index 290e111914..378c8f7bd7 100644 --- a/x/feegrant/filtered_fee.go +++ b/x/feegrant/filtered_fee.go @@ -53,11 +53,14 @@ func (a *AllowedMsgAllowance) GetAllowance() (FeeAllowanceI, error) { // SetAllowance sets allowed fee allowance. func (a *AllowedMsgAllowance) SetAllowance(allowance FeeAllowanceI) error { var err error - a.Allowance, err = types.NewAnyWithValue(allowance.(proto.Message)) - if err != nil { + protoAllowance, ok := allowance.(proto.Message) + if !ok { return sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", allowance) } - + a.Allowance, err = types.NewAnyWithValue(protoAllowance) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", protoAllowance) + } return nil } diff --git a/x/feegrant/filtered_fee_test.go b/x/feegrant/filtered_fee_test.go index 6aee743a44..bffce51a1c 100644 --- a/x/feegrant/filtered_fee_test.go +++ b/x/feegrant/filtered_fee_test.go @@ -4,6 +4,7 @@ import ( "testing" "time" + proto "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -188,3 +189,73 @@ func TestFilteredFeeValidAllow(t *testing.T) { }) } } + +// invalidInterfaceAllowance does not implement proto.Message +type invalidInterfaceAllowance struct { +} + +// compilation time interface implementation check +var _ feegrant.FeeAllowanceI = (*invalidInterfaceAllowance)(nil) + +func (i invalidInterfaceAllowance) Accept(ctx sdk.Context, fee sdk.Coins, msgs []sdk.Msg) (remove bool, err error) { + return false, nil +} + +func (i invalidInterfaceAllowance) ValidateBasic() error { + return nil +} + +// invalidProtoAllowance can not run proto.Marshal +type invalidProtoAllowance struct { + invalidInterfaceAllowance +} + +// compilation time interface implementation check +var _ feegrant.FeeAllowanceI = (*invalidProtoAllowance)(nil) +var _ proto.Message = (*invalidProtoAllowance)(nil) + +func (i invalidProtoAllowance) Reset() { +} + +func (i invalidProtoAllowance) String() string { + return "" +} + +func (i invalidProtoAllowance) ProtoMessage() { +} + +func TestSetAllowance(t *testing.T) { + cases := map[string]struct { + allowance feegrant.FeeAllowanceI + valid bool + }{ + "valid allowance": { + allowance: &feegrant.BasicAllowance{}, + valid: true, + }, + "invalid interface allowance": { + allowance: &invalidInterfaceAllowance{}, + valid: false, + }, + "empty allowance": { + allowance: (*invalidProtoAllowance)(nil), + valid: false, + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + allowance := &feegrant.BasicAllowance{} + msgs := []string{sdk.MsgTypeURL(&banktypes.MsgSend{})} + allowed, err := feegrant.NewAllowedMsgAllowance(allowance, msgs) + require.NoError(t, err) + require.NotNil(t, allowed) + err = allowed.SetAllowance(tc.allowance) + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +}