diff --git a/Makefile b/Makefile index b9433d972b..fe48b7905a 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ SIMAPP = ./app # for dockerized protobuf tools DOCKER := $(shell which docker) -BUF_IMAGE=bufbuild/buf@sha256:9dc5d6645f8f8a2d5aaafc8957fbbb5ea64eada98a84cb09654e8f49d6f73b3e +BUF_IMAGE=bufbuild/buf:1.0.0-rc8 DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(BUF_IMAGE) HTTPS_GIT := https://github.com/CosmWasm/wasmd.git diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index 20b66d9ea1..f83712d0f0 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -54,6 +54,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) @@ -815,6 +816,25 @@ 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 | +| `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the WASM codes | +| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply to the set of code ids | + + + + + diff --git a/proto/cosmwasm/wasm/v1/proposal.proto b/proto/cosmwasm/wasm/v1/proposal.proto index 2f36f87f94..58b74c8291 100644 --- a/proto/cosmwasm/wasm/v1/proposal.proto +++ b/proto/cosmwasm/wasm/v1/proposal.proto @@ -148,3 +148,19 @@ message UnpinCodesProposal { (gogoproto.moretags) = "yaml:\"code_ids\"" ]; } + +// 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\"" ]; + // CodeIDs references the WASM codes + repeated uint64 code_ids = 3 [ + (gogoproto.customname) = "CodeIDs", + (gogoproto.moretags) = "yaml:\"code_ids\"" + ]; + // InstantiatePermission to apply to the set of code ids + AccessConfig instantiate_permission = 4 [ (gogoproto.nullable) = false ]; +} 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 ba47392396..de06c358a2 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -838,6 +838,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 79f6a9fc30..703dea1f12 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) } @@ -219,3 +221,15 @@ 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 _, v := range p.CodeIDs { + if err := k.SetAccessConfig(ctx, v, p.InstantiatePermission); err != nil { + return sdkerrors.Wrapf(err, "code id: %d", v) + } + } + return nil +} diff --git a/x/wasm/types/codec.go b/x/wasm/types/codec.go index 007f42ed4b..f9b4661611 100644 --- a/x/wasm/types/codec.go +++ b/x/wasm/types/codec.go @@ -25,6 +25,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { //nolint:staticcheck cdc.RegisterConcrete(&MigrateContractProposal{}, "wasm/MigrateContractProposal", nil) cdc.RegisterConcrete(&UpdateAdminProposal{}, "wasm/UpdateAdminProposal", nil) cdc.RegisterConcrete(&ClearAdminProposal{}, "wasm/ClearAdminProposal", nil) + cdc.RegisterConcrete(&UpdateInstantiateConfigProposal{}, "wasm/UpdateInstantiateConfigProposal", nil) } func RegisterInterfaces(registry types.InterfaceRegistry) { @@ -48,6 +49,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..d85c7235a0 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. @@ -77,6 +78,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 +548,41 @@ 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.CodeIDs) == 0 { + return sdkerrors.Wrap(ErrEmpty, "code ids") + } + if err := p.InstantiatePermission.ValidateBasic(); err != nil { + return sdkerrors.Wrap(err, "instantiate permission") + } + return nil +} + +// String implements the Stringer interface. +func (p UpdateInstantiateConfigProposal) String() string { + return fmt.Sprintf(`Update Instantiate Config Proposal: + Title: %s + Description: %s + Codes: %v + InstantiatePermission: %v +`, p.Title, p.Description, p.CodeIDs, p.InstantiatePermission) +} diff --git a/x/wasm/types/proposal.pb.go b/x/wasm/types/proposal.pb.go index 1b19593c90..51cb8b32ab 100644 --- a/x/wasm/types/proposal.pb.go +++ b/x/wasm/types/proposal.pb.go @@ -438,6 +438,51 @@ func (m *UnpinCodesProposal) XXX_DiscardUnknown() { var xxx_messageInfo_UnpinCodesProposal 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"` + // CodeIDs references the WASM codes + CodeIDs []uint64 `protobuf:"varint,3,rep,packed,name=code_ids,json=codeIds,proto3" json:"code_ids,omitempty" yaml:"code_ids"` + // InstantiatePermission to apply to the set of code ids + InstantiatePermission AccessConfig `protobuf:"bytes,4,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission"` +} + +func (m *UpdateInstantiateConfigProposal) Reset() { *m = UpdateInstantiateConfigProposal{} } +func (*UpdateInstantiateConfigProposal) ProtoMessage() {} +func (*UpdateInstantiateConfigProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_be6422d717c730cb, []int{9} +} +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,59 +493,62 @@ 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((*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, 0x73, - 0xe7, 0x1c, 0x1f, 0x9d, 0xab, 0x01, 0x9a, 0x4b, 0x68, 0xd0, 0x87, 0x34, 0xb0, 0x92, 0xc7, 0x41, - 0xdd, 0x0a, 0x23, 0x12, 0x12, 0x0a, 0xbb, 0x66, 0x18, 0x11, 0x46, 0x94, 0xf2, 0x18, 0x60, 0x26, - 0x8f, 0x83, 0xfa, 0x4a, 0xa5, 0x43, 0x3a, 0x24, 0x69, 0x5a, 0xfc, 0x9f, 0xc0, 0xad, 0xa8, 0x1c, - 0x47, 0xa8, 0xd5, 0x86, 0x14, 0x59, 0x07, 0xf5, 0x36, 0x62, 0xb0, 0x6e, 0xb9, 0xc4, 0xc7, 0x69, - 0xff, 0xd6, 0x0f, 0x44, 0x6c, 0x10, 0x22, 0x2a, 0xba, 0xfa, 0x57, 0x09, 0xfc, 0xb7, 0xcd, 0x48, - 0x84, 0x9a, 0xc4, 0x43, 0x5b, 0xa9, 0x02, 0xa5, 0x02, 0xf2, 0xcc, 0x67, 0x5d, 0x54, 0x95, 0x6a, - 0x92, 0x31, 0xef, 0x88, 0x42, 0xa9, 0x81, 0x05, 0x0f, 0x51, 0x37, 0xf2, 0x43, 0xe6, 0x13, 0x5c, - 0x9d, 0x4b, 0x7a, 0xd3, 0xaf, 0x94, 0x45, 0x20, 0x47, 0x3d, 0xdc, 0x82, 0xb4, 0x9a, 0x15, 0x83, - 0x51, 0x0f, 0x37, 0xa8, 0x72, 0x1f, 0xfc, 0xc3, 0xb9, 0x5b, 0xed, 0x01, 0x43, 0x2d, 0x97, 0x78, - 0xa8, 0x9a, 0xab, 0x49, 0x46, 0xc9, 0x2e, 0x0f, 0x63, 0xad, 0xb4, 0xdb, 0xd8, 0xde, 0xb4, 0x07, - 0x2c, 0x11, 0xe0, 0x94, 0x38, 0x6e, 0x5c, 0x29, 0x3b, 0x60, 0xc9, 0xc7, 0x94, 0x41, 0xcc, 0x7c, - 0xc8, 0x50, 0x2b, 0x44, 0x51, 0xe0, 0x53, 0xca, 0xb9, 0x0b, 0x35, 0xc9, 0x58, 0x58, 0x53, 0xcd, - 0x8b, 0x1e, 0x99, 0x0d, 0xd7, 0x45, 0x94, 0x36, 0x09, 0xde, 0xf3, 0x3b, 0xce, 0xe2, 0xd4, 0xf4, - 0xd6, 0x64, 0x78, 0x23, 0x57, 0xcc, 0x97, 0xe5, 0x8d, 0x5c, 0x51, 0x2e, 0x17, 0xf4, 0x8f, 0x73, - 0xe0, 0xe6, 0xfa, 0x77, 0x54, 0x93, 0x60, 0x16, 0x41, 0x97, 0xcd, 0xca, 0x89, 0x0a, 0xc8, 0x43, - 0x2f, 0xf0, 0x71, 0x62, 0xc0, 0xbc, 0x23, 0x0a, 0xe5, 0x36, 0x28, 0x70, 0x57, 0x5a, 0xbe, 0x57, - 0xcd, 0xd7, 0x24, 0x23, 0x67, 0x83, 0x61, 0xac, 0xc9, 0xdc, 0x82, 0xf5, 0xc7, 0x8e, 0xcc, 0x5b, - 0xeb, 0x1e, 0x1f, 0xed, 0xc2, 0x36, 0xea, 0x56, 0x65, 0x31, 0x9a, 0x14, 0x8a, 0x01, 0xb2, 0x01, - 0xed, 0x24, 0x7e, 0x94, 0xec, 0xa5, 0x2f, 0xb1, 0xa6, 0x38, 0xb0, 0x3f, 0xfe, 0x8a, 0x4d, 0x44, - 0x29, 0xec, 0x20, 0x87, 0x43, 0x14, 0x08, 0xf2, 0x7b, 0x3d, 0xec, 0xd1, 0x6a, 0xb1, 0x96, 0x35, - 0x16, 0xd6, 0x6e, 0x98, 0x22, 0x37, 0x26, 0xcf, 0x8d, 0x99, 0xe6, 0xc6, 0x6c, 0x12, 0x1f, 0xd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, 0x9f, 0x50, 0xdb, 0x4b, 0xa3, 0x58, 0x53, 0x04, 0x7a, 0xaa, - 0xa9, 0x9f, 0x97, 0xf4, 0x90, 0x4b, 0x4a, 0x36, 0x8f, 0x27, 0x28, 0x6b, 0xe4, 0x6c, 0x75, 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, - 0x00, + // 774 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcd, 0x6e, 0xdb, 0x46, + 0x10, 0x16, 0x25, 0x8a, 0x92, 0xd7, 0x42, 0xab, 0xb2, 0xb2, 0xad, 0xba, 0x05, 0x29, 0xb0, 0x80, + 0xc1, 0x4b, 0xc9, 0xca, 0x05, 0x8a, 0xb6, 0x37, 0x51, 0xed, 0xc1, 0x46, 0x0d, 0x18, 0x34, 0x0c, + 0x03, 0xed, 0x41, 0x58, 0x91, 0x6b, 0x9a, 0x88, 0xc8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4e, + 0x77, 0x48, 0x51, 0xc7, 0xc1, 0x2e, 0xaa, 0x8b, 0x0d, 0x41, 0xaf, 0x58, 0xd5, 0x51, 0xa2, 0x56, + 0xf6, 0x5a, 0x3b, 0x5b, 0xd6, 0x90, 0xa6, 0x00, 0xec, 0x0a, 0xab, 0x9b, 0x44, 0xf2, 0x2e, 0x58, + 0xf6, 0x43, 0x42, 0x61, 0x48, 0x7d, 0x48, 0x51, 0x27, 0x42, 0x71, 0xe0, 0x13, 0xc2, 0x66, 0x97, + 0x1a, 0x82, 0xbe, 0xb8, 0xae, 0x18, 0x97, 0x39, 0x32, 0x5a, 0x8e, 0x83, 0x08, 0x69, 0xe3, 0x70, + 0xdf, 0xf7, 0xec, 0xa5, 0x99, 0xee, 0xed, 0x69, 0xf3, 0xa6, 0x58, 0x2e, 0x56, 0xa5, 0x4d, 0xb1, + 0x2c, 0x55, 0x4b, 0xda, 0xeb, 0x3c, 0xf8, 0x71, 0xe3, 0x63, 0x55, 0x1b, 0x87, 0x34, 0x86, 0x0e, + 0x9d, 0x17, 0x13, 0x35, 0x50, 0x84, 0x6e, 0xe0, 0x87, 0x29, 0x01, 0x0b, 0x36, 0x0f, 0xe4, 0x9f, + 0x41, 0x89, 0xb1, 0xd2, 0xf1, 0xdd, 0x7a, 0xb1, 0x21, 0xe8, 0xa2, 0x05, 0x46, 0x89, 0x2a, 0x31, + 0x0a, 0x36, 0xfe, 0xb6, 0x25, 0x96, 0xda, 0x70, 0x59, 0x6b, 0x0f, 0x76, 0x51, 0xaf, 0x2e, 0xf1, + 0xd6, 0x34, 0x90, 0x75, 0x50, 0x08, 0x88, 0x97, 0xf2, 0x51, 0xb1, 0x96, 0xdf, 0x25, 0xaa, 0x6c, + 0xc3, 0xc1, 0xe4, 0x14, 0x5b, 0x88, 0x10, 0xe8, 0x21, 0x9b, 0x95, 0xc8, 0x10, 0x14, 0xf7, 0xfb, + 0xa1, 0x4b, 0xea, 0xe5, 0x46, 0x41, 0x5f, 0x5c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0x83, + 0xac, 0xea, 0x38, 0x51, 0x2b, 0xfc, 0x24, 0xe9, 0xb2, 0x36, 0x19, 0xfd, 0xc7, 0x67, 0x46, 0x5b, + 0xcb, 0xe3, 0x44, 0x95, 0x79, 0xf5, 0x4c, 0x52, 0xbb, 0x08, 0xe9, 0x4f, 0x06, 0x29, 0x75, 0x1e, + 0x53, 0x50, 0x41, 0x17, 0x2d, 0x65, 0x94, 0xa8, 0x25, 0x6e, 0x3d, 0x32, 0x4e, 0xd4, 0x6f, 0xf9, + 0x0e, 0x93, 0x22, 0xcd, 0x2e, 0x71, 0x3b, 0x12, 0xed, 0xa5, 0x00, 0xe4, 0xdd, 0x30, 0xba, 0x57, + 0x98, 0x9f, 0xe4, 0x81, 0xca, 0xe5, 0x76, 0xf1, 0xae, 0xd8, 0xf7, 0xbd, 0x7b, 0x71, 0x00, 0xf9, + 0xff, 0x2b, 0x6f, 0x52, 0xf1, 0x36, 0x37, 0xa9, 0x25, 0x32, 0xa3, 0x5e, 0x71, 0x9f, 0x5a, 0xff, + 0x1e, 0x9f, 0x29, 0xb9, 0xd3, 0x33, 0x25, 0xf7, 0x6c, 0xa4, 0x08, 0xc7, 0x23, 0x45, 0x38, 0x19, + 0x29, 0xc2, 0xdb, 0x91, 0x22, 0x3c, 0x3c, 0x57, 0x72, 0x27, 0xe7, 0x4a, 0xee, 0xf4, 0x5c, 0xc9, + 0xfd, 0xb7, 0x36, 0xe3, 0xf1, 0x36, 0x26, 0xc1, 0xde, 0xe4, 0x49, 0xe2, 0x9a, 0x47, 0xfc, 0x69, + 0x92, 0xfa, 0xbc, 0x2b, 0xa5, 0x0f, 0x93, 0xdf, 0x3e, 0x04, 0x00, 0x00, 0xff, 0xff, 0x4d, 0xb8, + 0x86, 0x60, 0x21, 0x09, 0x00, 0x00, } func (this *StoreCodeProposal) Equal(that interface{}) bool { @@ -835,6 +883,44 @@ func (this *UnpinCodesProposal) Equal(that interface{}) bool { } 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.CodeIDs) != len(that1.CodeIDs) { + return false + } + for i := range this.CodeIDs { + if this.CodeIDs[i] != that1.CodeIDs[i] { + return false + } + } + if !this.InstantiatePermission.Equal(&that1.InstantiatePermission) { + return false + } + return true +} func (m *StoreCodeProposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1366,6 +1452,71 @@ func (m *UnpinCodesProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { 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 + { + size, err := m.InstantiatePermission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProposal(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.CodeIDs) > 0 { + dAtA8 := make([]byte, len(m.CodeIDs)*10) + var j7 int + for _, num := range m.CodeIDs { + for num >= 1<<7 { + dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j7++ + } + dAtA8[j7] = uint8(num) + j7++ + } + i -= j7 + copy(dAtA[i:], dAtA8[:j7]) + i = encodeVarintProposal(dAtA, i, uint64(j7)) + 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 +1781,32 @@ func (m *UnpinCodesProposal) Size() (n int) { 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.CodeIDs) > 0 { + l = 0 + for _, e := range m.CodeIDs { + l += sovProposal(uint64(e)) + } + n += 1 + sovProposal(uint64(l)) + l + } + l = m.InstantiatePermission.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 +3655,229 @@ func (m *UnpinCodesProposal) Unmarshal(dAtA []byte) error { } 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 == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.CodeIDs = append(m.CodeIDs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.CodeIDs) == 0 { + m.CodeIDs = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.CodeIDs = append(m.CodeIDs, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field CodeIDs", wireType) + } + case 4: + 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 skipProposal(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0