Add UpdateInstantiateConfig command (#1121)

* Add UpdateInstantiateConfig msg

* Add implementation

* Add cli command

* Fix field description

* Fix review comments and add unit tests
This commit is contained in:
pinosu
2022-12-20 12:03:52 +01:00
committed by GitHub
parent db566a2093
commit 14c2daa667
9 changed files with 686 additions and 57 deletions

View File

@@ -95,6 +95,8 @@
- [MsgStoreCodeResponse](#cosmwasm.wasm.v1.MsgStoreCodeResponse)
- [MsgUpdateAdmin](#cosmwasm.wasm.v1.MsgUpdateAdmin)
- [MsgUpdateAdminResponse](#cosmwasm.wasm.v1.MsgUpdateAdminResponse)
- [MsgUpdateInstantiateConfig](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfig)
- [MsgUpdateInstantiateConfigResponse](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse)
- [Msg](#cosmwasm.wasm.v1.Msg)
@@ -1287,7 +1289,7 @@ MsgClearAdmin removes any admin stored for a smart contract
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sender` | [string](#string) | | Sender is the that actor that signed the messages |
| `sender` | [string](#string) | | Sender is the actor that signed the messages |
| `contract` | [string](#string) | | Contract is the address of the smart contract |
@@ -1506,6 +1508,33 @@ MsgUpdateAdminResponse returns empty data
<a name="cosmwasm.wasm.v1.MsgUpdateInstantiateConfig"></a>
### MsgUpdateInstantiateConfig
MsgUpdateInstantiateConfig updates instantiate config for a smart contract
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sender` | [string](#string) | | Sender is the that actor that signed the messages |
| `code_id` | [uint64](#uint64) | | CodeID references the stored WASM code |
| `new_instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | NewInstantiatePermission is the new access control |
<a name="cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse"></a>
### MsgUpdateInstantiateConfigResponse
MsgUpdateInstantiateConfigResponse returns empty data
<!-- end messages -->
<!-- end enums -->
@@ -1527,6 +1556,7 @@ Msg defines the wasm Msg service.
| `MigrateContract` | [MsgMigrateContract](#cosmwasm.wasm.v1.MsgMigrateContract) | [MsgMigrateContractResponse](#cosmwasm.wasm.v1.MsgMigrateContractResponse) | Migrate runs a code upgrade/ downgrade for a smart contract | |
| `UpdateAdmin` | [MsgUpdateAdmin](#cosmwasm.wasm.v1.MsgUpdateAdmin) | [MsgUpdateAdminResponse](#cosmwasm.wasm.v1.MsgUpdateAdminResponse) | UpdateAdmin sets a new admin for a smart contract | |
| `ClearAdmin` | [MsgClearAdmin](#cosmwasm.wasm.v1.MsgClearAdmin) | [MsgClearAdminResponse](#cosmwasm.wasm.v1.MsgClearAdminResponse) | ClearAdmin removes any admin stored for a smart contract | |
| `UpdateInstantiateConfig` | [MsgUpdateInstantiateConfig](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfig) | [MsgUpdateInstantiateConfigResponse](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse) | UpdateInstantiateConfig updates instantiate config for a smart contract | |
<!-- end services -->

View File

@@ -28,6 +28,9 @@ service Msg {
rpc UpdateAdmin(MsgUpdateAdmin) returns (MsgUpdateAdminResponse);
// ClearAdmin removes any admin stored for a smart contract
rpc ClearAdmin(MsgClearAdmin) returns (MsgClearAdminResponse);
// UpdateInstantiateConfig updates instantiate config for a smart contract
rpc UpdateInstantiateConfig(MsgUpdateInstantiateConfig)
returns (MsgUpdateInstantiateConfigResponse);
}
// MsgStoreCode submit Wasm code to the system
@@ -166,7 +169,7 @@ message MsgUpdateAdminResponse {}
// MsgClearAdmin removes any admin stored for a smart contract
message MsgClearAdmin {
// Sender is the that actor that signed the messages
// Sender is the actor that signed the messages
string sender = 1;
// Contract is the address of the smart contract
string contract = 3;
@@ -174,3 +177,16 @@ message MsgClearAdmin {
// MsgClearAdminResponse returns empty data
message MsgClearAdminResponse {}
// MsgUpdateInstantiateConfig updates instantiate config for a smart contract
message MsgUpdateInstantiateConfig {
// Sender is the that actor that signed the messages
string sender = 1;
// CodeID references the stored WASM code
uint64 code_id = 2 [ (gogoproto.customname) = "CodeID" ];
// NewInstantiatePermission is the new access control
AccessConfig new_instantiate_permission = 3;
}
// MsgUpdateInstantiateConfigResponse returns empty data
message MsgUpdateInstantiateConfigResponse {}

View File

@@ -122,3 +122,45 @@ func ClearContractAdminCmd() *cobra.Command {
flags.AddTxFlagsToCmd(cmd)
return cmd
}
// UpdateInstantiateConfigCmd updates instantiate config for a smart contract.
func UpdateInstantiateConfigCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update-instantiate-config [code_id_int64]",
Short: "Update instantiate config for a codeID",
Aliases: []string{"update-instantiate-config"},
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
codeID, err := strconv.ParseUint(args[0], 10, 64)
if err != nil {
return err
}
perm, err := parseAccessConfigFlags(cmd.Flags())
if err != nil {
return err
}
msg := types.MsgUpdateInstantiateConfig{
Sender: string(clientCtx.GetFromAddress()),
CodeID: codeID,
NewInstantiatePermission: perm,
}
if err = msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
},
SilenceUsage: true,
}
cmd.Flags().String(flagInstantiateByEverybody, "", "Everybody can instantiate a contract from the code, optional")
cmd.Flags().String(flagInstantiateNobody, "", "Nobody except the governance process can instantiate a contract from the code, optional")
cmd.Flags().String(flagInstantiateByAddress, "", "Deprecated: Only this address can instantiate a contract from the code, optional")
cmd.Flags().StringSlice(flagInstantiateByAnyOfAddress, []string{}, "Any of the addresses can instantiate a contract from the code, optional")
flags.AddTxFlagsToCmd(cmd)
return cmd
}

View File

@@ -39,6 +39,8 @@ func NewHandler(k types.ContractOpsKeeper) sdk.Handler {
res, err = msgServer.UpdateAdmin(sdk.WrapSDKContext(ctx), msg)
case *MsgClearAdmin:
res, err = msgServer.ClearAdmin(sdk.WrapSDKContext(ctx), msg)
case *types.MsgUpdateInstantiateConfig:
res, err = msgServer.UpdateInstantiateConfig(sdk.WrapSDKContext(ctx), msg)
default:
errMsg := fmt.Sprintf("unrecognized wasm message type: %T", msg)
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)

View File

@@ -236,3 +236,16 @@ func (m msgServer) ClearAdmin(goCtx context.Context, msg *types.MsgClearAdmin) (
return &types.MsgClearAdminResponse{}, nil
}
func (m msgServer) UpdateInstantiateConfig(goCtx context.Context, msg *types.MsgUpdateInstantiateConfig) (*types.MsgUpdateInstantiateConfigResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
}
ctx := sdk.UnwrapSDKContext(goCtx)
if err := m.keeper.SetAccessConfig(ctx, msg.CodeID, sdk.AccAddress(msg.Sender), *msg.NewInstantiatePermission); err != nil {
return nil, err
}
return &types.MsgUpdateInstantiateConfigResponse{}, nil
}

View File

@@ -19,6 +19,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { //nolint:staticcheck
cdc.RegisterConcrete(&MsgMigrateContract{}, "wasm/MsgMigrateContract", nil)
cdc.RegisterConcrete(&MsgUpdateAdmin{}, "wasm/MsgUpdateAdmin", nil)
cdc.RegisterConcrete(&MsgClearAdmin{}, "wasm/MsgClearAdmin", nil)
cdc.RegisterConcrete(&MsgUpdateInstantiateConfig{}, "wasm/MsgUpdateInstantiateConfig", nil)
cdc.RegisterConcrete(&PinCodesProposal{}, "wasm/PinCodesProposal", nil)
cdc.RegisterConcrete(&UnpinCodesProposal{}, "wasm/UnpinCodesProposal", nil)
@@ -61,6 +62,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&MsgClearAdmin{},
&MsgIBCCloseChannel{},
&MsgIBCSend{},
&MsgUpdateInstantiateConfig{},
)
registry.RegisterImplementations(
(*govtypes.Content)(nil),

View File

@@ -395,3 +395,43 @@ func (msg MsgInstantiateContract2) GetSigners() []sdk.AccAddress {
}
return []sdk.AccAddress{senderAddr}
}
func (msg MsgUpdateInstantiateConfig) Route() string {
return RouterKey
}
func (msg MsgUpdateInstantiateConfig) Type() string {
return "update-instantiate-config"
}
func (msg MsgUpdateInstantiateConfig) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
return sdkerrors.Wrap(err, "sender")
}
if msg.CodeID == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
}
if msg.NewInstantiatePermission == nil {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "instantiate permission is required")
}
if err := msg.NewInstantiatePermission.ValidateBasic(); err != nil {
return sdkerrors.Wrap(err, "instantiate permission")
}
return nil
}
func (msg MsgUpdateInstantiateConfig) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
func (msg MsgUpdateInstantiateConfig) GetSigners() []sdk.AccAddress {
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil { // should never happen as valid basic rejects invalid addresses
panic(err.Error())
}
return []sdk.AccAddress{senderAddr}
}

View File

@@ -615,7 +615,7 @@ var xxx_messageInfo_MsgUpdateAdminResponse proto.InternalMessageInfo
// MsgClearAdmin removes any admin stored for a smart contract
type MsgClearAdmin struct {
// Sender is the that actor that signed the messages
// Sender is the actor that signed the messages
Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
// Contract is the address of the smart contract
Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"`
@@ -700,6 +700,95 @@ func (m *MsgClearAdminResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgClearAdminResponse proto.InternalMessageInfo
// MsgUpdateInstantiateConfig updates instantiate config for a smart contract
type MsgUpdateInstantiateConfig struct {
// Sender is the that actor that signed the messages
Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
// CodeID references the stored WASM code
CodeID uint64 `protobuf:"varint,2,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
// NewInstantiatePermission is the new access control
NewInstantiatePermission *AccessConfig `protobuf:"bytes,3,opt,name=new_instantiate_permission,json=newInstantiatePermission,proto3" json:"new_instantiate_permission,omitempty"`
}
func (m *MsgUpdateInstantiateConfig) Reset() { *m = MsgUpdateInstantiateConfig{} }
func (m *MsgUpdateInstantiateConfig) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateInstantiateConfig) ProtoMessage() {}
func (*MsgUpdateInstantiateConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_4f74d82755520264, []int{14}
}
func (m *MsgUpdateInstantiateConfig) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateInstantiateConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateInstantiateConfig.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 *MsgUpdateInstantiateConfig) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateInstantiateConfig.Merge(m, src)
}
func (m *MsgUpdateInstantiateConfig) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateInstantiateConfig) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateInstantiateConfig.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateInstantiateConfig proto.InternalMessageInfo
// MsgUpdateInstantiateConfigResponse returns empty data
type MsgUpdateInstantiateConfigResponse struct{}
func (m *MsgUpdateInstantiateConfigResponse) Reset() { *m = MsgUpdateInstantiateConfigResponse{} }
func (m *MsgUpdateInstantiateConfigResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateInstantiateConfigResponse) ProtoMessage() {}
func (*MsgUpdateInstantiateConfigResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_4f74d82755520264, []int{15}
}
func (m *MsgUpdateInstantiateConfigResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateInstantiateConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateInstantiateConfigResponse.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 *MsgUpdateInstantiateConfigResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateInstantiateConfigResponse.Merge(m, src)
}
func (m *MsgUpdateInstantiateConfigResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateInstantiateConfigResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateInstantiateConfigResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateInstantiateConfigResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgStoreCode)(nil), "cosmwasm.wasm.v1.MsgStoreCode")
proto.RegisterType((*MsgStoreCodeResponse)(nil), "cosmwasm.wasm.v1.MsgStoreCodeResponse")
@@ -715,65 +804,71 @@ func init() {
proto.RegisterType((*MsgUpdateAdminResponse)(nil), "cosmwasm.wasm.v1.MsgUpdateAdminResponse")
proto.RegisterType((*MsgClearAdmin)(nil), "cosmwasm.wasm.v1.MsgClearAdmin")
proto.RegisterType((*MsgClearAdminResponse)(nil), "cosmwasm.wasm.v1.MsgClearAdminResponse")
proto.RegisterType((*MsgUpdateInstantiateConfig)(nil), "cosmwasm.wasm.v1.MsgUpdateInstantiateConfig")
proto.RegisterType((*MsgUpdateInstantiateConfigResponse)(nil), "cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse")
}
func init() { proto.RegisterFile("cosmwasm/wasm/v1/tx.proto", fileDescriptor_4f74d82755520264) }
var fileDescriptor_4f74d82755520264 = []byte{
// 840 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x4d, 0x6f, 0xe3, 0x44,
0x18, 0x8e, 0x1b, 0xe7, 0xeb, 0x6d, 0x58, 0x22, 0x93, 0x4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 0x96, 0x3f, 0x7a, 0x15, 0x74, 0x4a, 0x3f, 0x78, 0x72, 0xf1, 0x97, 0x52, 0xb9,
0x58, 0x28, 0xc2, 0xcb, 0x85, 0x22, 0xfc, 0xb9, 0x50, 0x84, 0xef, 0xaf, 0x94, 0xca, 0xcb, 0x2b,
0xa5, 0xf2, 0xfb, 0x95, 0x52, 0xf9, 0xea, 0x51, 0x6e, 0x9a, 0x0c, 0x09, 0xf5, 0x8f, 0xd3, 0x6f,
0x65, 0xc7, 0x98, 0xc7, 0xdf, 0xcc, 0x7c, 0xa2, 0x8c, 0x1b, 0xfc, 0x8b, 0xf9, 0xc3, 0x7f, 0x02,
0x00, 0x00, 0xff, 0xff, 0x2a, 0x98, 0x99, 0x8e, 0xb4, 0x0b, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -806,6 +901,8 @@ type MsgClient interface {
UpdateAdmin(ctx context.Context, in *MsgUpdateAdmin, opts ...grpc.CallOption) (*MsgUpdateAdminResponse, error)
// ClearAdmin removes any admin stored for a smart contract
ClearAdmin(ctx context.Context, in *MsgClearAdmin, opts ...grpc.CallOption) (*MsgClearAdminResponse, error)
// UpdateInstantiateConfig updates instantiate config for a smart contract
UpdateInstantiateConfig(ctx context.Context, in *MsgUpdateInstantiateConfig, opts ...grpc.CallOption) (*MsgUpdateInstantiateConfigResponse, error)
}
type msgClient struct {
@@ -879,6 +976,15 @@ func (c *msgClient) ClearAdmin(ctx context.Context, in *MsgClearAdmin, opts ...g
return out, nil
}
func (c *msgClient) UpdateInstantiateConfig(ctx context.Context, in *MsgUpdateInstantiateConfig, opts ...grpc.CallOption) (*MsgUpdateInstantiateConfigResponse, error) {
out := new(MsgUpdateInstantiateConfigResponse)
err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Msg/UpdateInstantiateConfig", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
// StoreCode to submit Wasm code to the system
@@ -897,6 +1003,8 @@ type MsgServer interface {
UpdateAdmin(context.Context, *MsgUpdateAdmin) (*MsgUpdateAdminResponse, error)
// ClearAdmin removes any admin stored for a smart contract
ClearAdmin(context.Context, *MsgClearAdmin) (*MsgClearAdminResponse, error)
// UpdateInstantiateConfig updates instantiate config for a smart contract
UpdateInstantiateConfig(context.Context, *MsgUpdateInstantiateConfig) (*MsgUpdateInstantiateConfigResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@@ -930,6 +1038,10 @@ func (*UnimplementedMsgServer) ClearAdmin(ctx context.Context, req *MsgClearAdmi
return nil, status.Errorf(codes.Unimplemented, "method ClearAdmin not implemented")
}
func (*UnimplementedMsgServer) UpdateInstantiateConfig(ctx context.Context, req *MsgUpdateInstantiateConfig) (*MsgUpdateInstantiateConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateInstantiateConfig not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
}
@@ -1060,6 +1172,24 @@ func _Msg_ClearAdmin_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateInstantiateConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateInstantiateConfig)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateInstantiateConfig(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmwasm.wasm.v1.Msg/UpdateInstantiateConfig",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateInstantiateConfig(ctx, req.(*MsgUpdateInstantiateConfig))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cosmwasm.wasm.v1.Msg",
HandlerType: (*MsgServer)(nil),
@@ -1092,6 +1222,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "ClearAdmin",
Handler: _Msg_ClearAdmin_Handler,
},
{
MethodName: "UpdateInstantiateConfig",
Handler: _Msg_UpdateInstantiateConfig_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmwasm/wasm/v1/tx.proto",
@@ -1706,6 +1840,76 @@ func (m *MsgClearAdminResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *MsgUpdateInstantiateConfig) 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 *MsgUpdateInstantiateConfig) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateInstantiateConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.NewInstantiatePermission != nil {
{
size, err := m.NewInstantiatePermission.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
if m.CodeID != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.CodeID))
i--
dAtA[i] = 0x10
}
if len(m.Sender) > 0 {
i -= len(m.Sender)
copy(dAtA[i:], m.Sender)
i = encodeVarintTx(dAtA, i, uint64(len(m.Sender)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateInstantiateConfigResponse) 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 *MsgUpdateInstantiateConfigResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateInstantiateConfigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@@ -1997,6 +2201,35 @@ func (m *MsgClearAdminResponse) Size() (n int) {
return n
}
func (m *MsgUpdateInstantiateConfig) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Sender)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.CodeID != 0 {
n += 1 + sovTx(uint64(m.CodeID))
}
if m.NewInstantiatePermission != nil {
l = m.NewInstantiatePermission.Size()
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgUpdateInstantiateConfigResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -3903,6 +4136,195 @@ func (m *MsgClearAdminResponse) Unmarshal(dAtA []byte) error {
return nil
}
func (m *MsgUpdateInstantiateConfig) 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: MsgUpdateInstantiateConfig: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateInstantiateConfig: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
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 ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CodeID |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewInstantiatePermission", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.NewInstantiatePermission == nil {
m.NewInstantiatePermission = &AccessConfig{}
}
if err := m.NewInstantiatePermission.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 *MsgUpdateInstantiateConfigResponse) 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: MsgUpdateInstantiateConfigResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateInstantiateConfigResponse: 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 skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0

View File

@@ -679,3 +679,65 @@ func TestMsgJsonSignBytes(t *testing.T) {
})
}
}
func TestMsgUpdateInstantiateConfig(t *testing.T) {
bad, err := sdk.AccAddressFromHex("012345")
require.NoError(t, err)
badAddress := bad.String()
// proper address size
goodAddress := sdk.AccAddress(make([]byte, 20)).String()
anotherGoodAddress := sdk.AccAddress(bytes.Repeat([]byte{0x2}, 20)).String()
specs := map[string]struct {
src MsgUpdateInstantiateConfig
expErr bool
}{
"all good": {
src: MsgUpdateInstantiateConfig{
Sender: goodAddress,
CodeID: 1,
NewInstantiatePermission: &AccessConfig{Permission: AccessTypeOnlyAddress, Address: anotherGoodAddress},
},
},
"bad sender": {
src: MsgUpdateInstantiateConfig{
Sender: badAddress,
CodeID: 1,
NewInstantiatePermission: &AccessConfig{Permission: AccessTypeOnlyAddress, Address: anotherGoodAddress},
},
expErr: true,
},
"invalid NewInstantiatePermission": {
src: MsgUpdateInstantiateConfig{
Sender: goodAddress,
CodeID: 1,
NewInstantiatePermission: &AccessConfig{Permission: AccessTypeOnlyAddress, Address: badAddress},
},
expErr: true,
},
"missing code id": {
src: MsgUpdateInstantiateConfig{
Sender: goodAddress,
NewInstantiatePermission: &AccessConfig{Permission: AccessTypeOnlyAddress, Address: anotherGoodAddress},
},
expErr: true,
},
"missing NewInstantiatePermission": {
src: MsgUpdateInstantiateConfig{
Sender: goodAddress,
CodeID: 1,
},
expErr: true,
},
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
err := spec.src.ValidateBasic()
if spec.expErr {
require.Error(t, err)
return
}
require.NoError(t, err)
})
}
}