diff --git a/CHANGELOG.md b/CHANGELOG.md
index b56d67ca37..c4f5735150 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ Yes
- Fix SudoContractProposal and ExecuteContractProposal [\#808](https://github.com/CosmWasm/wasmd/pull/808) ([the-frey](https://github.com/the-frey))
**Implemented Enhancements**
+- Add UpdateInstantiateConfig governance proposal [\#820](https://github.com/CosmWasm/wasmd/pull/796) ([jhernandezb](https://github.com/jhernandezb))
- Upgrade wasmvm to v1.0.0-rc.0 [\#844](https://github.com/CosmWasm/wasmd/pull/844)
- Support state sync [\#478](https://github.com/CosmWasm/wasmd/issues/478)
- Upgrade to ibc-go v3 [\#806](https://github.com/CosmWasm/wasmd/issues/806)
diff --git a/Makefile b/Makefile
index fa00a49f6a..1b63ca4883 100644
--- a/Makefile
+++ b/Makefile
@@ -183,7 +183,7 @@ proto-lint:
@$(DOCKER_BUF) lint --error-format=json
proto-check-breaking:
- @$(DOCKER_BUF) breaking --against-input $(HTTPS_GIT)#branch=master
+ @$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main
.PHONY: all install install-debug \
go-mod-cache draw-deps clean build format \
diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md
index d293dce932..f6c0182b6d 100644
--- a/docs/proto/proto-docs.md
+++ b/docs/proto/proto-docs.md
@@ -45,6 +45,7 @@
- [MsgIBCSend](#cosmwasm.wasm.v1.MsgIBCSend)
- [cosmwasm/wasm/v1/proposal.proto](#cosmwasm/wasm/v1/proposal.proto)
+ - [AccessConfigUpdate](#cosmwasm.wasm.v1.AccessConfigUpdate)
- [ClearAdminProposal](#cosmwasm.wasm.v1.ClearAdminProposal)
- [ExecuteContractProposal](#cosmwasm.wasm.v1.ExecuteContractProposal)
- [InstantiateContractProposal](#cosmwasm.wasm.v1.InstantiateContractProposal)
@@ -54,6 +55,7 @@
- [SudoContractProposal](#cosmwasm.wasm.v1.SudoContractProposal)
- [UnpinCodesProposal](#cosmwasm.wasm.v1.UnpinCodesProposal)
- [UpdateAdminProposal](#cosmwasm.wasm.v1.UpdateAdminProposal)
+ - [UpdateInstantiateConfigProposal](#cosmwasm.wasm.v1.UpdateInstantiateConfigProposal)
- [cosmwasm/wasm/v1/query.proto](#cosmwasm/wasm/v1/query.proto)
- [CodeInfoResponse](#cosmwasm.wasm.v1.CodeInfoResponse)
@@ -641,6 +643,23 @@ MsgIBCSend
+
+
+### AccessConfigUpdate
+AccessConfigUpdate contains the code id and the access config to be
+applied.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code to be updated |
+| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply to the set of code ids |
+
+
+
+
+
+
### ClearAdminProposal
@@ -814,6 +833,24 @@ UpdateAdminProposal gov proposal content type to set an admin for a contract.
+
+
+
+### UpdateInstantiateConfigProposal
+UpdateInstantiateConfigProposal gov proposal content type to update
+instantiate config to a set of code ids.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `title` | [string](#string) | | Title is a short summary |
+| `description` | [string](#string) | | Description is a human readable text |
+| `access_config_updates` | [AccessConfigUpdate](#cosmwasm.wasm.v1.AccessConfigUpdate) | repeated | AccessConfigUpdate contains the list of code ids and the access config to be applied. |
+
+
+
+
+
diff --git a/proto/cosmwasm/wasm/v1/proposal.proto b/proto/cosmwasm/wasm/v1/proposal.proto
index 98318128c3..68eae73a12 100644
--- a/proto/cosmwasm/wasm/v1/proposal.proto
+++ b/proto/cosmwasm/wasm/v1/proposal.proto
@@ -148,3 +148,25 @@ message UnpinCodesProposal {
(gogoproto.moretags) = "yaml:\"code_ids\""
];
}
+
+// AccessConfigUpdate contains the code id and the access config to be
+// applied.
+message AccessConfigUpdate {
+ // CodeID is the reference to the stored WASM code to be updated
+ uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ];
+ // InstantiatePermission to apply to the set of code ids
+ AccessConfig instantiate_permission = 2 [ (gogoproto.nullable) = false ];
+}
+
+// UpdateInstantiateConfigProposal gov proposal content type to update
+// instantiate config to a set of code ids.
+message UpdateInstantiateConfigProposal {
+ // Title is a short summary
+ string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ];
+ // Description is a human readable text
+ string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ];
+ // AccessConfigUpdate contains the list of code ids and the access config
+ // to be applied.
+ repeated AccessConfigUpdate access_config_updates = 3
+ [ (gogoproto.nullable) = false ];
+}
diff --git a/x/wasm/Governance.md b/x/wasm/Governance.md
index 7d7a32abee..cd7d0ae2cb 100644
--- a/x/wasm/Governance.md
+++ b/x/wasm/Governance.md
@@ -17,6 +17,7 @@ We have added 9 new wasm specific proposal types that cover the contract's live
* `ClearAdminProposal` - clear admin for a contract to prevent further migrations
* `PinCodes` - pin the given code ids in cache. This trades memory for reduced startup time and lowers gas cost
* `UnpinCodes` - unpin the given code ids from the cache. This frees up memory and returns to standard speed and gas cost
+* `UpdateInstantiateConfigProposal` - update instantiate permissions to a list of given code ids.
For details see the proposal type [implementation](https://github.com/CosmWasm/wasmd/blob/master/x/wasm/types/proposal.go)
diff --git a/x/wasm/client/cli/gov_tx.go b/x/wasm/client/cli/gov_tx.go
index 94150de28e..2a044c2d42 100644
--- a/x/wasm/client/cli/gov_tx.go
+++ b/x/wasm/client/cli/gov_tx.go
@@ -3,10 +3,12 @@ package cli
import (
"fmt"
"strconv"
+ "strings"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/gov/client/cli"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/pkg/errors"
@@ -614,3 +616,109 @@ func ProposalUnpinCodesCmd() *cobra.Command {
cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade")
return cmd
}
+
+func parseAccessConfig(config string) (types.AccessConfig, error) {
+ switch config {
+ case "nobody":
+ return types.AllowNobody, nil
+ case "everybody":
+ return types.AllowEverybody, nil
+ default:
+ address, err := sdk.AccAddressFromBech32(config)
+ if err != nil {
+ return types.AccessConfig{}, fmt.Errorf("unable to parse address %s", config)
+ }
+ return types.AccessTypeOnlyAddress.With(address), nil
+ }
+}
+
+func parseAccessConfigUpdates(args []string) ([]types.AccessConfigUpdate, error) {
+ updates := make([]types.AccessConfigUpdate, len(args))
+ for i, c := range args {
+ // format: code_id,access_config
+ // access_config: nobody|everybody|address
+ parts := strings.Split(c, ",")
+ if len(parts) != 2 {
+ return nil, fmt.Errorf("invalid format")
+ }
+
+ codeID, err := strconv.ParseUint(parts[0], 10, 64)
+ if err != nil {
+ return nil, fmt.Errorf("invalid code ID: %s", err)
+ }
+
+ accessConfig, err := parseAccessConfig(parts[1])
+ if err != nil {
+ return nil, err
+ }
+ updates[i] = types.AccessConfigUpdate{
+ CodeID: codeID,
+ InstantiatePermission: accessConfig,
+ }
+ }
+ return updates, nil
+}
+func ProposalUpdateInstantiateConfigCmd() *cobra.Command {
+ bech32Prefix := sdk.GetConfig().GetBech32AccountAddrPrefix()
+ cmd := &cobra.Command{
+ Use: "update-instantiate-config [code-id,permission]...",
+ Short: "Submit an update instantiate config proposal.",
+ Args: cobra.MinimumNArgs(1),
+ Long: strings.TrimSpace(
+ fmt.Sprintf(`Submit an update instantiate config proposal for multiple code ids.
+
+Example:
+$ %s tx gov submit-proposal update-instantiate-config 1,nobody 2,everybody 3,%s1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm
+`, version.AppName, bech32Prefix)),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientTxContext(cmd)
+ if err != nil {
+ return err
+ }
+
+ proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle)
+ if err != nil {
+ return fmt.Errorf("proposal title: %s", err)
+ }
+ proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription)
+ if err != nil {
+ return fmt.Errorf("proposal description: %s", err)
+ }
+ depositArg, err := cmd.Flags().GetString(cli.FlagDeposit)
+ if err != nil {
+ return fmt.Errorf("deposit: %s", err)
+ }
+ deposit, err := sdk.ParseCoinsNormalized(depositArg)
+ if err != nil {
+ return err
+ }
+ updates, err := parseAccessConfigUpdates(args)
+ if err != nil {
+ return err
+ }
+
+ content := types.UpdateInstantiateConfigProposal{
+ Title: proposalTitle,
+ Description: proposalDescr,
+ AccessConfigUpdates: updates,
+ }
+ msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ if err != nil {
+ return err
+ }
+ if err = msg.ValidateBasic(); err != nil {
+ return err
+ }
+
+ return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
+ },
+ }
+ // proposal flags
+ cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
+ cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
+ cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)")
+ // type values must match the "ProposalHandler" "routes" in cli
+ cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade")
+ return cmd
+}
diff --git a/x/wasm/client/cli/query.go b/x/wasm/client/cli/query.go
index c8e1c7a2d7..9d9cbcbdac 100644
--- a/x/wasm/client/cli/query.go
+++ b/x/wasm/client/cli/query.go
@@ -33,6 +33,7 @@ func GetQueryCmd() *cobra.Command {
GetCmdListCode(),
GetCmdListContractByCode(),
GetCmdQueryCode(),
+ GetCmdQueryCodeInfo(),
GetCmdGetContractInfo(),
GetCmdGetContractHistory(),
GetCmdGetContractState(),
@@ -181,6 +182,45 @@ func GetCmdQueryCode() *cobra.Command {
return cmd
}
+// GetCmdQueryCodeInfo returns the code info for a given code id
+func GetCmdQueryCodeInfo() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "code-info [code_id]",
+ Short: "Prints out metadata of a code id",
+ Long: "Prints out metadata of a code id",
+ Args: cobra.ExactArgs(1),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientQueryContext(cmd)
+ if err != nil {
+ return err
+ }
+
+ codeID, err := strconv.ParseUint(args[0], 10, 64)
+ if err != nil {
+ return err
+ }
+
+ queryClient := types.NewQueryClient(clientCtx)
+ res, err := queryClient.Code(
+ context.Background(),
+ &types.QueryCodeRequest{
+ CodeId: codeID,
+ },
+ )
+ if err != nil {
+ return err
+ }
+ if res.CodeInfoResponse == nil {
+ return fmt.Errorf("contract not found")
+ }
+
+ return clientCtx.PrintProto(res.CodeInfoResponse)
+ },
+ }
+ flags.AddQueryFlagsToCmd(cmd)
+ return cmd
+}
+
// GetCmdGetContractInfo gets details about a given contract
func GetCmdGetContractInfo() *cobra.Command {
cmd := &cobra.Command{
diff --git a/x/wasm/client/proposal_handler.go b/x/wasm/client/proposal_handler.go
index ad3363ac7a..6d4735180e 100644
--- a/x/wasm/client/proposal_handler.go
+++ b/x/wasm/client/proposal_handler.go
@@ -18,4 +18,5 @@ var ProposalHandlers = []govclient.ProposalHandler{
govclient.NewProposalHandler(cli.ProposalClearContractAdminCmd, rest.ClearContractAdminProposalHandler),
govclient.NewProposalHandler(cli.ProposalPinCodesCmd, rest.PinCodeProposalHandler),
govclient.NewProposalHandler(cli.ProposalUnpinCodesCmd, rest.UnpinCodeProposalHandler),
+ govclient.NewProposalHandler(cli.ProposalUpdateInstantiateConfigCmd, rest.UpdateInstantiateConfigProposalHandler),
}
diff --git a/x/wasm/client/rest/gov.go b/x/wasm/client/rest/gov.go
index 5178b29852..d62381039f 100644
--- a/x/wasm/client/rest/gov.go
+++ b/x/wasm/client/rest/gov.go
@@ -407,7 +407,7 @@ func (s UnpinCodeJSONReq) GetBaseReq() rest.BaseReq {
func UnpinCodeProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
return govrest.ProposalRESTHandler{
- SubRoute: "pin_code",
+ SubRoute: "unpin_code",
Handler: func(w http.ResponseWriter, r *http.Request) {
var req UnpinCodeJSONReq
if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
@@ -418,6 +418,46 @@ func UnpinCodeProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler
}
}
+type UpdateInstantiateConfigProposalJSONReq struct {
+ BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
+
+ Title string `json:"title" yaml:"title"`
+ Description string `json:"description" yaml:"description"`
+ Proposer string `json:"proposer" yaml:"proposer"`
+ Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
+ AccessConfigUpdates []types.AccessConfigUpdate `json:"access_config_updates" yaml:"access_config_updates"`
+}
+
+func (s UpdateInstantiateConfigProposalJSONReq) Content() govtypes.Content {
+ return &types.UpdateInstantiateConfigProposal{
+ Title: s.Title,
+ Description: s.Description,
+ AccessConfigUpdates: s.AccessConfigUpdates,
+ }
+}
+func (s UpdateInstantiateConfigProposalJSONReq) GetProposer() string {
+ return s.Proposer
+}
+func (s UpdateInstantiateConfigProposalJSONReq) GetDeposit() sdk.Coins {
+ return s.Deposit
+}
+func (s UpdateInstantiateConfigProposalJSONReq) GetBaseReq() rest.BaseReq {
+ return s.BaseReq
+}
+
+func UpdateInstantiateConfigProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
+ return govrest.ProposalRESTHandler{
+ SubRoute: "update_instantiate_config",
+ Handler: func(w http.ResponseWriter, r *http.Request) {
+ var req UpdateInstantiateConfigProposalJSONReq
+ if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
+ return
+ }
+ toStdTxResponse(cliCtx, w, req)
+ },
+ }
+}
+
type wasmProposalData interface {
Content() govtypes.Content
GetProposer() string
diff --git a/x/wasm/keeper/contract_keeper.go b/x/wasm/keeper/contract_keeper.go
index ffdcc91895..9dc0a4be9d 100644
--- a/x/wasm/keeper/contract_keeper.go
+++ b/x/wasm/keeper/contract_keeper.go
@@ -19,6 +19,7 @@ type decoratedKeeper interface {
execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error)
Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)
setContractInfoExtension(ctx sdk.Context, contract sdk.AccAddress, extra types.ContractInfoExtension) error
+ setAccessConfig(ctx sdk.Context, codeID uint64, config types.AccessConfig) error
}
type PermissionedKeeper struct {
@@ -78,3 +79,8 @@ func (p PermissionedKeeper) UnpinCode(ctx sdk.Context, codeID uint64) error {
func (p PermissionedKeeper) SetContractInfoExtension(ctx sdk.Context, contract sdk.AccAddress, extra types.ContractInfoExtension) error {
return p.nested.setContractInfoExtension(ctx, contract, extra)
}
+
+// SetAccessConfig updates the access config of a code id.
+func (p PermissionedKeeper) SetAccessConfig(ctx sdk.Context, codeID uint64, config types.AccessConfig) error {
+ return p.nested.setAccessConfig(ctx, codeID, config)
+}
diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go
index a42d16aa2d..5dbd5483f7 100644
--- a/x/wasm/keeper/keeper.go
+++ b/x/wasm/keeper/keeper.go
@@ -833,6 +833,17 @@ func (k Keeper) setContractInfoExtension(ctx sdk.Context, contractAddr sdk.AccAd
return nil
}
+// setAccessConfig updates the access config of a code id.
+func (k Keeper) setAccessConfig(ctx sdk.Context, codeID uint64, config types.AccessConfig) error {
+ info := k.GetCodeInfo(ctx, codeID)
+ if info == nil {
+ return sdkerrors.Wrap(types.ErrNotFound, "code info")
+ }
+ info.InstantiateConfig = config
+ k.storeCodeInfo(ctx, codeID, *info)
+ return nil
+}
+
// handleContractResponse processes the contract response data by emitting events and sending sub-/messages.
func (k *Keeper) handleContractResponse(
ctx sdk.Context,
diff --git a/x/wasm/keeper/proposal_handler.go b/x/wasm/keeper/proposal_handler.go
index ddc94a23bb..9da330ce0f 100644
--- a/x/wasm/keeper/proposal_handler.go
+++ b/x/wasm/keeper/proposal_handler.go
@@ -47,6 +47,8 @@ func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []t
return handlePinCodesProposal(ctx, k, *c)
case *types.UnpinCodesProposal:
return handleUnpinCodesProposal(ctx, k, *c)
+ case *types.UpdateInstantiateConfigProposal:
+ return handleUpdateInstantiateConfigProposal(ctx, k, *c)
default:
return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized wasm proposal content type: %T", c)
}
@@ -221,3 +223,16 @@ func handleUnpinCodesProposal(ctx sdk.Context, k types.ContractOpsKeeper, p type
}
return nil
}
+
+func handleUpdateInstantiateConfigProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.UpdateInstantiateConfigProposal) error {
+ if err := p.ValidateBasic(); err != nil {
+ return err
+ }
+
+ for _, accessConfigUpdate := range p.AccessConfigUpdates {
+ if err := k.SetAccessConfig(ctx, accessConfigUpdate.CodeID, accessConfigUpdate.InstantiatePermission); err != nil {
+ return sdkerrors.Wrapf(err, "code id: %d", accessConfigUpdate.CodeID)
+ }
+ }
+ return nil
+}
diff --git a/x/wasm/keeper/proposal_integration_test.go b/x/wasm/keeper/proposal_integration_test.go
index ea88f398d9..441e75fd75 100644
--- a/x/wasm/keeper/proposal_integration_test.go
+++ b/x/wasm/keeper/proposal_integration_test.go
@@ -749,3 +749,98 @@ func TestUnpinCodesProposal(t *testing.T) {
})
}
}
+
+func TestUpdateInstantiateConfigProposal(t *testing.T) {
+ ctx, keepers := CreateTestInput(t, false, "staking")
+ govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
+
+ mock := wasmtesting.MockWasmer{
+ CreateFn: wasmtesting.NoOpCreateFn,
+ AnalyzeCodeFn: wasmtesting.WithoutIBCAnalyzeFn,
+ }
+ anyAddress, err := sdk.AccAddressFromBech32("cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz")
+ require.NoError(t, err)
+
+ withAddressAccessConfig := types.AccessTypeOnlyAddress.With(anyAddress)
+ var (
+ nobody = StoreRandomContractWithAccessConfig(t, ctx, keepers, &mock, &types.AllowNobody)
+ everybody = StoreRandomContractWithAccessConfig(t, ctx, keepers, &mock, &types.AllowEverybody)
+ withAddress = StoreRandomContractWithAccessConfig(t, ctx, keepers, &mock, &withAddressAccessConfig)
+ )
+
+ specs := map[string]struct {
+ accessConfigUpdates []types.AccessConfigUpdate
+ expErr bool
+ }{
+ "update one": {
+ accessConfigUpdates: []types.AccessConfigUpdate{
+ {CodeID: nobody.CodeID, InstantiatePermission: types.AllowEverybody},
+ },
+ },
+ "update multiple": {
+ accessConfigUpdates: []types.AccessConfigUpdate{
+ {CodeID: everybody.CodeID, InstantiatePermission: types.AllowNobody},
+ {CodeID: nobody.CodeID, InstantiatePermission: withAddressAccessConfig},
+ {CodeID: withAddress.CodeID, InstantiatePermission: types.AllowEverybody},
+ },
+ },
+ "update same code id": {
+ accessConfigUpdates: []types.AccessConfigUpdate{
+ {CodeID: everybody.CodeID, InstantiatePermission: types.AllowNobody},
+ {CodeID: everybody.CodeID, InstantiatePermission: types.AllowEverybody},
+ },
+ expErr: true,
+ },
+ "update non existing code id": {
+ accessConfigUpdates: []types.AccessConfigUpdate{
+ {CodeID: 100, InstantiatePermission: types.AllowNobody},
+ {CodeID: everybody.CodeID, InstantiatePermission: types.AllowEverybody},
+ },
+ expErr: true,
+ },
+ "update empty list": {
+ accessConfigUpdates: make([]types.AccessConfigUpdate, 0),
+ expErr: true,
+ },
+ }
+ parentCtx := ctx
+ for msg, spec := range specs {
+ t.Run(msg, func(t *testing.T) {
+
+ ctx, _ := parentCtx.CacheContext()
+
+ updates := make([]types.AccessConfigUpdate, 0)
+ for _, cu := range spec.accessConfigUpdates {
+ updates = append(updates, types.AccessConfigUpdate{
+ CodeID: cu.CodeID,
+ InstantiatePermission: cu.InstantiatePermission,
+ })
+ }
+
+ proposal := types.UpdateInstantiateConfigProposal{
+ Title: "Foo",
+ Description: "Bar",
+ AccessConfigUpdates: updates,
+ }
+
+ // when stored
+ storedProposal, gotErr := govKeeper.SubmitProposal(ctx, &proposal)
+ if spec.expErr {
+ require.Error(t, gotErr)
+ return
+ }
+ require.NoError(t, gotErr)
+
+ // and proposal execute
+ handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
+ gotErr = handler(ctx, storedProposal.GetContent())
+ require.NoError(t, gotErr)
+
+ // then
+ for i := range spec.accessConfigUpdates {
+ c := wasmKeeper.GetCodeInfo(ctx, spec.accessConfigUpdates[i].CodeID)
+ require.Equal(t, spec.accessConfigUpdates[i].InstantiatePermission, c.InstantiateConfig)
+ }
+ })
+ }
+}
diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go
index ed5bec8ebd..8235fb33ad 100644
--- a/x/wasm/keeper/test_common.go
+++ b/x/wasm/keeper/test_common.go
@@ -586,16 +586,25 @@ func SeedNewContractInstance(t testing.TB, ctx sdk.Context, keepers TestKeepers,
// StoreRandomContract sets the mock wasmerEngine in keeper and calls store
func StoreRandomContract(t testing.TB, ctx sdk.Context, keepers TestKeepers, mock types.WasmerEngine) ExampleContract {
+ return StoreRandomContractWithAccessConfig(t, ctx, keepers, mock, nil)
+}
+
+func StoreRandomContractWithAccessConfig(
+ t testing.TB, ctx sdk.Context,
+ keepers TestKeepers,
+ mock types.WasmerEngine,
+ cfg *types.AccessConfig) ExampleContract {
t.Helper()
anyAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000))
creator, _, creatorAddr := keyPubAddr()
fundAccounts(t, ctx, keepers.AccountKeeper, keepers.BankKeeper, creatorAddr, anyAmount)
keepers.WasmKeeper.wasmVM = mock
wasmCode := append(wasmIdent, rand.Bytes(10)...) //nolint:gocritic
- codeID, err := keepers.ContractKeeper.Create(ctx, creatorAddr, wasmCode, nil)
+ codeID, err := keepers.ContractKeeper.Create(ctx, creatorAddr, wasmCode, cfg)
require.NoError(t, err)
exampleContract := ExampleContract{InitialAmount: anyAmount, Creator: creator, CreatorAddr: creatorAddr, CodeID: codeID}
return exampleContract
+
}
type HackatomExampleInstance struct {
diff --git a/x/wasm/types/codec.go b/x/wasm/types/codec.go
index 1d2114a576..e7e578b7f8 100644
--- a/x/wasm/types/codec.go
+++ b/x/wasm/types/codec.go
@@ -27,6 +27,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { //nolint:staticcheck
cdc.RegisterConcrete(&ExecuteContractProposal{}, "wasm/ExecuteContractProposal", nil)
cdc.RegisterConcrete(&UpdateAdminProposal{}, "wasm/UpdateAdminProposal", nil)
cdc.RegisterConcrete(&ClearAdminProposal{}, "wasm/ClearAdminProposal", nil)
+ cdc.RegisterConcrete(&UpdateInstantiateConfigProposal{}, "wasm/UpdateInstantiateConfigProposal", nil)
}
func RegisterInterfaces(registry types.InterfaceRegistry) {
@@ -52,6 +53,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&ClearAdminProposal{},
&PinCodesProposal{},
&UnpinCodesProposal{},
+ &UpdateInstantiateConfigProposal{},
)
registry.RegisterInterface("ContractInfoExtension", (*ContractInfoExtension)(nil))
diff --git a/x/wasm/types/exported_keepers.go b/x/wasm/types/exported_keepers.go
index 515b946fa8..c48a3615c5 100644
--- a/x/wasm/types/exported_keepers.go
+++ b/x/wasm/types/exported_keepers.go
@@ -53,6 +53,9 @@ type ContractOpsKeeper interface {
// SetContractInfoExtension updates the extension point data that is stored with the contract info
SetContractInfoExtension(ctx sdk.Context, contract sdk.AccAddress, extra ContractInfoExtension) error
+
+ // SetAccessConfig updates the access config of a code id.
+ SetAccessConfig(ctx sdk.Context, codeID uint64, config AccessConfig) error
}
// IBCContractKeeper IBC lifecycle event handler
diff --git a/x/wasm/types/proposal.go b/x/wasm/types/proposal.go
index 77bf7d0636..748a03895b 100644
--- a/x/wasm/types/proposal.go
+++ b/x/wasm/types/proposal.go
@@ -13,15 +13,16 @@ import (
type ProposalType string
const (
- ProposalTypeStoreCode ProposalType = "StoreCode"
- ProposalTypeInstantiateContract ProposalType = "InstantiateContract"
- ProposalTypeMigrateContract ProposalType = "MigrateContract"
- ProposalTypeSudoContract ProposalType = "SudoContract"
- ProposalTypeExecuteContract ProposalType = "ExecuteContract"
- ProposalTypeUpdateAdmin ProposalType = "UpdateAdmin"
- ProposalTypeClearAdmin ProposalType = "ClearAdmin"
- ProposalTypePinCodes ProposalType = "PinCodes"
- ProposalTypeUnpinCodes ProposalType = "UnpinCodes"
+ ProposalTypeStoreCode ProposalType = "StoreCode"
+ ProposalTypeInstantiateContract ProposalType = "InstantiateContract"
+ ProposalTypeMigrateContract ProposalType = "MigrateContract"
+ ProposalTypeSudoContract ProposalType = "SudoContract"
+ ProposalTypeExecuteContract ProposalType = "ExecuteContract"
+ ProposalTypeUpdateAdmin ProposalType = "UpdateAdmin"
+ ProposalTypeClearAdmin ProposalType = "ClearAdmin"
+ ProposalTypePinCodes ProposalType = "PinCodes"
+ ProposalTypeUnpinCodes ProposalType = "UnpinCodes"
+ ProposalTypeUpdateInstantiateConfig ProposalType = "UpdateInstantiateConfig"
)
// DisableAllProposals contains no wasm gov types.
@@ -38,6 +39,7 @@ var EnableAllProposals = []ProposalType{
ProposalTypeClearAdmin,
ProposalTypePinCodes,
ProposalTypeUnpinCodes,
+ ProposalTypeUpdateInstantiateConfig,
}
// ConvertToProposals maps each key to a ProposalType and returns a typed list.
@@ -68,6 +70,7 @@ func init() { // register new content types with the sdk
govtypes.RegisterProposalType(string(ProposalTypeClearAdmin))
govtypes.RegisterProposalType(string(ProposalTypePinCodes))
govtypes.RegisterProposalType(string(ProposalTypeUnpinCodes))
+ govtypes.RegisterProposalType(string(ProposalTypeUpdateInstantiateConfig))
govtypes.RegisterProposalTypeCodec(&StoreCodeProposal{}, "wasm/StoreCodeProposal")
govtypes.RegisterProposalTypeCodec(&InstantiateContractProposal{}, "wasm/InstantiateContractProposal")
govtypes.RegisterProposalTypeCodec(&MigrateContractProposal{}, "wasm/MigrateContractProposal")
@@ -77,6 +80,7 @@ func init() { // register new content types with the sdk
govtypes.RegisterProposalTypeCodec(&ClearAdminProposal{}, "wasm/ClearAdminProposal")
govtypes.RegisterProposalTypeCodec(&PinCodesProposal{}, "wasm/PinCodesProposal")
govtypes.RegisterProposalTypeCodec(&UnpinCodesProposal{}, "wasm/UnpinCodesProposal")
+ govtypes.RegisterProposalTypeCodec(&UpdateInstantiateConfigProposal{}, "wasm/UpdateInstantiateConfigProposal")
}
// ProposalRoute returns the routing key of a parameter change proposal.
@@ -546,3 +550,56 @@ func validateProposalCommons(title, description string) error {
}
return nil
}
+
+// ProposalRoute returns the routing key of a parameter change proposal.
+func (p UpdateInstantiateConfigProposal) ProposalRoute() string { return RouterKey }
+
+// GetTitle returns the title of the proposal
+func (p *UpdateInstantiateConfigProposal) GetTitle() string { return p.Title }
+
+// GetDescription returns the human readable description of the proposal
+func (p UpdateInstantiateConfigProposal) GetDescription() string { return p.Description }
+
+// ProposalType returns the type
+func (p UpdateInstantiateConfigProposal) ProposalType() string {
+ return string(ProposalTypeUpdateInstantiateConfig)
+}
+
+// ValidateBasic validates the proposal
+func (p UpdateInstantiateConfigProposal) ValidateBasic() error {
+ if err := validateProposalCommons(p.Title, p.Description); err != nil {
+ return err
+ }
+ if len(p.AccessConfigUpdates) == 0 {
+ return sdkerrors.Wrap(ErrEmpty, "code updates")
+ }
+ dedup := make(map[uint64]bool)
+ for _, codeUpdate := range p.AccessConfigUpdates {
+ _, found := dedup[codeUpdate.CodeID]
+ if found {
+ return sdkerrors.Wrapf(ErrDuplicate, "duplicate code: %d", codeUpdate.CodeID)
+ }
+ if err := codeUpdate.InstantiatePermission.ValidateBasic(); err != nil {
+ return sdkerrors.Wrap(err, "instantiate permission")
+ }
+ dedup[codeUpdate.CodeID] = true
+ }
+ return nil
+}
+
+// String implements the Stringer interface.
+func (p UpdateInstantiateConfigProposal) String() string {
+ return fmt.Sprintf(`Update Instantiate Config Proposal:
+ Title: %s
+ Description: %s
+ AccessConfigUpdates: %v
+`, p.Title, p.Description, p.AccessConfigUpdates)
+}
+
+// String implements the Stringer interface.
+func (c AccessConfigUpdate) String() string {
+ return fmt.Sprintf(`AccessConfigUpdate:
+ CodeID: %d
+ AccessConfig: %v
+`, c.CodeID, c.InstantiatePermission)
+}
diff --git a/x/wasm/types/proposal.pb.go b/x/wasm/types/proposal.pb.go
index 8d9c2a2402..787bed1351 100644
--- a/x/wasm/types/proposal.pb.go
+++ b/x/wasm/types/proposal.pb.go
@@ -438,6 +438,91 @@ func (m *UnpinCodesProposal) XXX_DiscardUnknown() {
var xxx_messageInfo_UnpinCodesProposal proto.InternalMessageInfo
+// AccessConfigUpdate contains the code id and the access config to be
+// applied.
+type AccessConfigUpdate struct {
+ // CodeID is the reference to the stored WASM code to be updated
+ CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
+ // InstantiatePermission to apply to the set of code ids
+ InstantiatePermission AccessConfig `protobuf:"bytes,2,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission"`
+}
+
+func (m *AccessConfigUpdate) Reset() { *m = AccessConfigUpdate{} }
+func (*AccessConfigUpdate) ProtoMessage() {}
+func (*AccessConfigUpdate) Descriptor() ([]byte, []int) {
+ return fileDescriptor_be6422d717c730cb, []int{9}
+}
+func (m *AccessConfigUpdate) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *AccessConfigUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_AccessConfigUpdate.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 *AccessConfigUpdate) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_AccessConfigUpdate.Merge(m, src)
+}
+func (m *AccessConfigUpdate) XXX_Size() int {
+ return m.Size()
+}
+func (m *AccessConfigUpdate) XXX_DiscardUnknown() {
+ xxx_messageInfo_AccessConfigUpdate.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_AccessConfigUpdate proto.InternalMessageInfo
+
+// UpdateInstantiateConfigProposal gov proposal content type to update
+// instantiate config to a set of code ids.
+type UpdateInstantiateConfigProposal struct {
+ // Title is a short summary
+ Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty" yaml:"title"`
+ // Description is a human readable text
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" yaml:"description"`
+ // AccessConfigUpdate contains the list of code ids and the access config
+ // to be applied.
+ AccessConfigUpdates []AccessConfigUpdate `protobuf:"bytes,3,rep,name=access_config_updates,json=accessConfigUpdates,proto3" json:"access_config_updates"`
+}
+
+func (m *UpdateInstantiateConfigProposal) Reset() { *m = UpdateInstantiateConfigProposal{} }
+func (*UpdateInstantiateConfigProposal) ProtoMessage() {}
+func (*UpdateInstantiateConfigProposal) Descriptor() ([]byte, []int) {
+ return fileDescriptor_be6422d717c730cb, []int{10}
+}
+func (m *UpdateInstantiateConfigProposal) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *UpdateInstantiateConfigProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_UpdateInstantiateConfigProposal.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 *UpdateInstantiateConfigProposal) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_UpdateInstantiateConfigProposal.Merge(m, src)
+}
+func (m *UpdateInstantiateConfigProposal) XXX_Size() int {
+ return m.Size()
+}
+func (m *UpdateInstantiateConfigProposal) XXX_DiscardUnknown() {
+ xxx_messageInfo_UpdateInstantiateConfigProposal.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_UpdateInstantiateConfigProposal proto.InternalMessageInfo
+
func init() {
proto.RegisterType((*StoreCodeProposal)(nil), "cosmwasm.wasm.v1.StoreCodeProposal")
proto.RegisterType((*InstantiateContractProposal)(nil), "cosmwasm.wasm.v1.InstantiateContractProposal")
@@ -448,58 +533,65 @@ func init() {
proto.RegisterType((*ClearAdminProposal)(nil), "cosmwasm.wasm.v1.ClearAdminProposal")
proto.RegisterType((*PinCodesProposal)(nil), "cosmwasm.wasm.v1.PinCodesProposal")
proto.RegisterType((*UnpinCodesProposal)(nil), "cosmwasm.wasm.v1.UnpinCodesProposal")
+ proto.RegisterType((*AccessConfigUpdate)(nil), "cosmwasm.wasm.v1.AccessConfigUpdate")
+ proto.RegisterType((*UpdateInstantiateConfigProposal)(nil), "cosmwasm.wasm.v1.UpdateInstantiateConfigProposal")
}
func init() { proto.RegisterFile("cosmwasm/wasm/v1/proposal.proto", fileDescriptor_be6422d717c730cb) }
var fileDescriptor_be6422d717c730cb = []byte{
- // 737 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xc1, 0x6e, 0xd3, 0x4a,
- 0x14, 0x8d, 0x9b, 0xc4, 0x49, 0xa7, 0xd1, 0x7b, 0x79, 0x7e, 0x69, 0x1b, 0x0a, 0xb2, 0x23, 0x23,
- 0x55, 0xde, 0x60, 0x93, 0x22, 0x21, 0x60, 0x17, 0x07, 0x16, 0xad, 0xa8, 0x54, 0xb9, 0xaa, 0x2a,
- 0xb1, 0x89, 0x26, 0xf6, 0x34, 0xb5, 0x88, 0x67, 0x2c, 0xcf, 0xa4, 0x69, 0xfe, 0x02, 0x24, 0x96,
- 0x7c, 0x00, 0x62, 0x83, 0xd8, 0xf3, 0x01, 0x15, 0xab, 0x2e, 0xbb, 0x32, 0x34, 0xfd, 0x83, 0x2c,
- 0x91, 0x90, 0xd0, 0x78, 0x9c, 0x90, 0x16, 0xd4, 0x82, 0x68, 0x16, 0x6c, 0x9c, 0x5c, 0xdf,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, 0x18,
- 0x6b, 0x05, 0xb1, 0x7a, 0x74, 0x14, 0x6b, 0xff, 0x8a, 0x13, 0xc6, 0x20, 0xdd, 0x29, 0x88, 0x75,
- 0xa4, 0xfa, 0x7b, 0x09, 0x28, 0x3b, 0x38, 0xfc, 0x9b, 0x34, 0xdb, 0x4f, 0x8f, 0x4e, 0xd5, 0xcc,
- 0xc9, 0xa9, 0x9a, 0x79, 0x33, 0x54, 0xa5, 0xa3, 0xa1, 0x2a, 0x1d, 0x0f, 0x55, 0xe9, 0xf3, 0x50,
- 0x95, 0x5e, 0x9c, 0xa9, 0x99, 0xe3, 0x33, 0x35, 0x73, 0x72, 0xa6, 0x66, 0x9e, 0xad, 0x4e, 0xa5,
- 0xb8, 0x49, 0x68, 0xb0, 0x3b, 0xbe, 0x74, 0x3d, 0xeb, 0x50, 0x5c, 0xbe, 0x49, 0x92, 0xdb, 0x72,
- 0x72, 0xf5, 0xde, 0xfb, 0x16, 0x00, 0x00, 0xff, 0xff, 0x51, 0xe8, 0xe8, 0x8c, 0x03, 0x08, 0x00,
+ // 817 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x6f, 0xe3, 0x44,
+ 0x14, 0xcf, 0xe4, 0x8f, 0x93, 0x4e, 0x22, 0x08, 0xde, 0xb4, 0x1b, 0x0a, 0xb2, 0x23, 0x83, 0x56,
+ 0xbe, 0x60, 0x93, 0x22, 0x21, 0xe0, 0x16, 0x07, 0x0e, 0x5d, 0x51, 0xa9, 0x72, 0x55, 0xad, 0x04,
+ 0x12, 0xd6, 0xc4, 0x9e, 0x7a, 0x2d, 0x62, 0x8f, 0xe5, 0x99, 0x34, 0x9b, 0x6f, 0x01, 0x12, 0xe2,
+ 0xc4, 0x07, 0x40, 0x5c, 0x10, 0x77, 0x3e, 0x40, 0xc5, 0x69, 0x8f, 0x7b, 0x32, 0x6c, 0xf2, 0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0x48, 0x46, 0x8a, 0x78,
+ 0xf9, 0xbc, 0xf7, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x70, 0x3f, 0xe6, 0xf2, 0x82, 0x09, 0x00,
0x00,
}
@@ -835,6 +927,68 @@ func (this *UnpinCodesProposal) Equal(that interface{}) bool {
}
return true
}
+func (this *AccessConfigUpdate) Equal(that interface{}) bool {
+ if that == nil {
+ return this == nil
+ }
+
+ that1, ok := that.(*AccessConfigUpdate)
+ if !ok {
+ that2, ok := that.(AccessConfigUpdate)
+ if ok {
+ that1 = &that2
+ } else {
+ return false
+ }
+ }
+ if that1 == nil {
+ return this == nil
+ } else if this == nil {
+ return false
+ }
+ if this.CodeID != that1.CodeID {
+ return false
+ }
+ if !this.InstantiatePermission.Equal(&that1.InstantiatePermission) {
+ return false
+ }
+ return true
+}
+func (this *UpdateInstantiateConfigProposal) Equal(that interface{}) bool {
+ if that == nil {
+ return this == nil
+ }
+
+ that1, ok := that.(*UpdateInstantiateConfigProposal)
+ if !ok {
+ that2, ok := that.(UpdateInstantiateConfigProposal)
+ if ok {
+ that1 = &that2
+ } else {
+ return false
+ }
+ }
+ if that1 == nil {
+ return this == nil
+ } else if this == nil {
+ return false
+ }
+ if this.Title != that1.Title {
+ return false
+ }
+ if this.Description != that1.Description {
+ return false
+ }
+ if len(this.AccessConfigUpdates) != len(that1.AccessConfigUpdates) {
+ return false
+ }
+ for i := range this.AccessConfigUpdates {
+ if !this.AccessConfigUpdates[i].Equal(&that1.AccessConfigUpdates[i]) {
+ return false
+ }
+ }
+ return true
+}
func (m *StoreCodeProposal) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -1366,6 +1520,95 @@ func (m *UnpinCodesProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *AccessConfigUpdate) 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 *AccessConfigUpdate) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *AccessConfigUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ {
+ size, err := m.InstantiatePermission.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintProposal(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x12
+ if m.CodeID != 0 {
+ i = encodeVarintProposal(dAtA, i, uint64(m.CodeID))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *UpdateInstantiateConfigProposal) 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 *UpdateInstantiateConfigProposal) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *UpdateInstantiateConfigProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.AccessConfigUpdates) > 0 {
+ for iNdEx := len(m.AccessConfigUpdates) - 1; iNdEx >= 0; iNdEx-- {
+ {
+ size, err := m.AccessConfigUpdates[iNdEx].MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintProposal(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x1a
+ }
+ }
+ if len(m.Description) > 0 {
+ i -= len(m.Description)
+ copy(dAtA[i:], m.Description)
+ i = encodeVarintProposal(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 = encodeVarintProposal(dAtA, i, uint64(len(m.Title)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
func encodeVarintProposal(dAtA []byte, offset int, v uint64) int {
offset -= sovProposal(v)
base := offset
@@ -1630,6 +1873,43 @@ func (m *UnpinCodesProposal) Size() (n int) {
return n
}
+func (m *AccessConfigUpdate) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.CodeID != 0 {
+ n += 1 + sovProposal(uint64(m.CodeID))
+ }
+ l = m.InstantiatePermission.Size()
+ n += 1 + l + sovProposal(uint64(l))
+ return n
+}
+
+func (m *UpdateInstantiateConfigProposal) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Title)
+ if l > 0 {
+ n += 1 + l + sovProposal(uint64(l))
+ }
+ l = len(m.Description)
+ if l > 0 {
+ n += 1 + l + sovProposal(uint64(l))
+ }
+ if len(m.AccessConfigUpdates) > 0 {
+ for _, e := range m.AccessConfigUpdates {
+ l = e.Size()
+ n += 1 + l + sovProposal(uint64(l))
+ }
+ }
+ return n
+}
+
func sovProposal(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -3478,6 +3758,256 @@ func (m *UnpinCodesProposal) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *AccessConfigUpdate) 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 ErrIntOverflowProposal
+ }
+ 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: AccessConfigUpdate: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: AccessConfigUpdate: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType)
+ }
+ m.CodeID = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.CodeID |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field InstantiatePermission", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.InstantiatePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipProposal(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *UpdateInstantiateConfigProposal) 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 ErrIntOverflowProposal
+ }
+ 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: UpdateInstantiateConfigProposal: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: UpdateInstantiateConfigProposal: 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 ErrIntOverflowProposal
+ }
+ 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 ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ 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 ErrIntOverflowProposal
+ }
+ 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 ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ 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 AccessConfigUpdates", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowProposal
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthProposal
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.AccessConfigUpdates = append(m.AccessConfigUpdates, AccessConfigUpdate{})
+ if err := m.AccessConfigUpdates[len(m.AccessConfigUpdates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipProposal(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthProposal
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func skipProposal(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0