From c9ab3dce99ef7eba4222ef2f7c62ecdb00504a21 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Fri, 13 Sep 2024 17:58:14 +0200 Subject: [PATCH 01/11] Add WasmLimitsConfig query --- docs/proto/proto-docs.md | 31 ++ proto/cosmwasm/wasm/v1/query.proto | 16 + x/wasm/keeper/querier.go | 6 + x/wasm/types/query.pb.go | 551 +++++++++++++++++++++++------ x/wasm/types/query.pb.gw.go | 83 +++-- 5 files changed, 562 insertions(+), 125 deletions(-) diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index c72708524..d5c5cc62a 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -85,6 +85,8 @@ - [QueryRawContractStateResponse](#cosmwasm.wasm.v1.QueryRawContractStateResponse) - [QuerySmartContractStateRequest](#cosmwasm.wasm.v1.QuerySmartContractStateRequest) - [QuerySmartContractStateResponse](#cosmwasm.wasm.v1.QuerySmartContractStateResponse) + - [QueryWasmLimitsConfigRequest](#cosmwasm.wasm.v1.QueryWasmLimitsConfigRequest) + - [QueryWasmLimitsConfigResponse](#cosmwasm.wasm.v1.QueryWasmLimitsConfigResponse) - [Query](#cosmwasm.wasm.v1.Query) @@ -1421,6 +1423,34 @@ Query/SmartContractState RPC method + + + +### QueryWasmLimitsConfigRequest +QueryWasmLimitsConfigRequest is the request type for the +Query/WasmLimitsConfig RPC method. + + + + + + + + +### QueryWasmLimitsConfigResponse +QueryWasmLimitsConfigResponse is the response type for the +Query/WasmLimitsConfig RPC method. It contains the MsgPack encoded limits for +static validation of Wasm files. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `config` | [bytes](#bytes) | | | + + + + + @@ -1447,6 +1477,7 @@ Query provides defines the gRPC querier service | `PinnedCodes` | [QueryPinnedCodesRequest](#cosmwasm.wasm.v1.QueryPinnedCodesRequest) | [QueryPinnedCodesResponse](#cosmwasm.wasm.v1.QueryPinnedCodesResponse) | PinnedCodes gets the pinned code ids | GET|/cosmwasm/wasm/v1/codes/pinned| | `Params` | [QueryParamsRequest](#cosmwasm.wasm.v1.QueryParamsRequest) | [QueryParamsResponse](#cosmwasm.wasm.v1.QueryParamsResponse) | Params gets the module params | GET|/cosmwasm/wasm/v1/codes/params| | `ContractsByCreator` | [QueryContractsByCreatorRequest](#cosmwasm.wasm.v1.QueryContractsByCreatorRequest) | [QueryContractsByCreatorResponse](#cosmwasm.wasm.v1.QueryContractsByCreatorResponse) | ContractsByCreator gets the contracts by creator | GET|/cosmwasm/wasm/v1/contracts/creator/{creator_address}| +| `WasmLimitsConfig` | [QueryWasmLimitsConfigRequest](#cosmwasm.wasm.v1.QueryWasmLimitsConfigRequest) | [QueryWasmLimitsConfigResponse](#cosmwasm.wasm.v1.QueryWasmLimitsConfigResponse) | WasmLimitsConfig gets the configured limits for static validation of Wasm files, encoded in MsgPack. | GET|/cosmwasm/wasm/v1/wasm-limits-config| | `BuildAddress` | [QueryBuildAddressRequest](#cosmwasm.wasm.v1.QueryBuildAddressRequest) | [QueryBuildAddressResponse](#cosmwasm.wasm.v1.QueryBuildAddressResponse) | BuildAddress builds a contract address | GET|/cosmwasm/wasm/v1/contract/build_address| diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index acf1ccd8b..a6e54347a 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -90,6 +90,13 @@ service Query { "/cosmwasm/wasm/v1/contracts/creator/{creator_address}"; } + // WasmLimitsConfig gets the configured limits for static validation of Wasm + // files, encoded in MsgPack. + rpc WasmLimitsConfig(QueryWasmLimitsConfigRequest) + returns (QueryWasmLimitsConfigResponse) { + option (google.api.http).get = "/cosmwasm/wasm/v1/wasm-limits-config"; + } + // BuildAddress builds a contract address rpc BuildAddress(QueryBuildAddressRequest) returns (QueryBuildAddressResponse) { @@ -317,6 +324,15 @@ message QueryContractsByCreatorResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } +// QueryWasmLimitsConfigRequest is the request type for the +// Query/WasmLimitsConfig RPC method. +message QueryWasmLimitsConfigRequest {} + +// QueryWasmLimitsConfigResponse is the response type for the +// Query/WasmLimitsConfig RPC method. It contains the MsgPack encoded limits for +// static validation of Wasm files. +message QueryWasmLimitsConfigResponse { bytes config = 1; } + // QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC // method. message QueryBuildAddressRequest { diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go index 8da91c252..ef0e488d4 100644 --- a/x/wasm/keeper/querier.go +++ b/x/wasm/keeper/querier.go @@ -439,6 +439,12 @@ func ensurePaginationParams(req *query.PageRequest) (*query.PageRequest, error) return req, nil } +func (q GrpcQuerier) WasmLimitsConfig(c context.Context, req *types.QueryWasmLimitsConfigRequest) (*types.QueryWasmLimitsConfigResponse, error) { + return &types.QueryWasmLimitsConfigResponse{ + Config: []byte{}, // TODO: implement + }, nil +} + func (q GrpcQuerier) BuildAddress(c context.Context, req *types.QueryBuildAddressRequest) (*types.QueryBuildAddressResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index 45d4f796f..37e08faf1 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -1171,6 +1171,93 @@ func (m *QueryContractsByCreatorResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryContractsByCreatorResponse proto.InternalMessageInfo +// QueryWasmLimitsConfigRequest is the request type for the +// Query/WasmLimitsConfig RPC method. +type QueryWasmLimitsConfigRequest struct{} + +func (m *QueryWasmLimitsConfigRequest) Reset() { *m = QueryWasmLimitsConfigRequest{} } +func (m *QueryWasmLimitsConfigRequest) String() string { return proto.CompactTextString(m) } +func (*QueryWasmLimitsConfigRequest) ProtoMessage() {} +func (*QueryWasmLimitsConfigRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9677c207036b9f2b, []int{25} +} + +func (m *QueryWasmLimitsConfigRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *QueryWasmLimitsConfigRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryWasmLimitsConfigRequest.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 *QueryWasmLimitsConfigRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryWasmLimitsConfigRequest.Merge(m, src) +} + +func (m *QueryWasmLimitsConfigRequest) XXX_Size() int { + return m.Size() +} + +func (m *QueryWasmLimitsConfigRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryWasmLimitsConfigRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryWasmLimitsConfigRequest proto.InternalMessageInfo + +// QueryWasmLimitsConfigResponse is the response type for the +// Query/WasmLimitsConfig RPC method. It contains the MsgPack encoded limits for +// static validation of Wasm files. +type QueryWasmLimitsConfigResponse struct { + Config []byte `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` +} + +func (m *QueryWasmLimitsConfigResponse) Reset() { *m = QueryWasmLimitsConfigResponse{} } +func (m *QueryWasmLimitsConfigResponse) String() string { return proto.CompactTextString(m) } +func (*QueryWasmLimitsConfigResponse) ProtoMessage() {} +func (*QueryWasmLimitsConfigResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9677c207036b9f2b, []int{26} +} + +func (m *QueryWasmLimitsConfigResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *QueryWasmLimitsConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryWasmLimitsConfigResponse.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 *QueryWasmLimitsConfigResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryWasmLimitsConfigResponse.Merge(m, src) +} + +func (m *QueryWasmLimitsConfigResponse) XXX_Size() int { + return m.Size() +} + +func (m *QueryWasmLimitsConfigResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryWasmLimitsConfigResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryWasmLimitsConfigResponse proto.InternalMessageInfo + // QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC // method. type QueryBuildAddressRequest struct { @@ -1189,7 +1276,7 @@ func (m *QueryBuildAddressRequest) Reset() { *m = QueryBuildAddressReque func (m *QueryBuildAddressRequest) String() string { return proto.CompactTextString(m) } func (*QueryBuildAddressRequest) ProtoMessage() {} func (*QueryBuildAddressRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9677c207036b9f2b, []int{25} + return fileDescriptor_9677c207036b9f2b, []int{27} } func (m *QueryBuildAddressRequest) XXX_Unmarshal(b []byte) error { @@ -1234,7 +1321,7 @@ func (m *QueryBuildAddressResponse) Reset() { *m = QueryBuildAddressResp func (m *QueryBuildAddressResponse) String() string { return proto.CompactTextString(m) } func (*QueryBuildAddressResponse) ProtoMessage() {} func (*QueryBuildAddressResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9677c207036b9f2b, []int{26} + return fileDescriptor_9677c207036b9f2b, []int{28} } func (m *QueryBuildAddressResponse) XXX_Unmarshal(b []byte) error { @@ -1294,6 +1381,8 @@ func init() { proto.RegisterType((*QueryParamsResponse)(nil), "cosmwasm.wasm.v1.QueryParamsResponse") proto.RegisterType((*QueryContractsByCreatorRequest)(nil), "cosmwasm.wasm.v1.QueryContractsByCreatorRequest") proto.RegisterType((*QueryContractsByCreatorResponse)(nil), "cosmwasm.wasm.v1.QueryContractsByCreatorResponse") + proto.RegisterType((*QueryWasmLimitsConfigRequest)(nil), "cosmwasm.wasm.v1.QueryWasmLimitsConfigRequest") + proto.RegisterType((*QueryWasmLimitsConfigResponse)(nil), "cosmwasm.wasm.v1.QueryWasmLimitsConfigResponse") proto.RegisterType((*QueryBuildAddressRequest)(nil), "cosmwasm.wasm.v1.QueryBuildAddressRequest") proto.RegisterType((*QueryBuildAddressResponse)(nil), "cosmwasm.wasm.v1.QueryBuildAddressResponse") } @@ -1301,107 +1390,111 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/query.proto", fileDescriptor_9677c207036b9f2b) } var fileDescriptor_9677c207036b9f2b = []byte{ - // 1585 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x98, 0xcd, 0x6f, 0x13, 0xc7, - 0x1b, 0xc7, 0x3d, 0xc1, 0x71, 0xec, 0x27, 0xf9, 0xfd, 0x70, 0xa6, 0x01, 0x8c, 0x01, 0x3b, 0x5a, - 0x20, 0x04, 0x43, 0xbc, 0x24, 0x94, 0x22, 0xe8, 0xa1, 0xb2, 0x03, 0x25, 0xa0, 0x52, 0x82, 0x91, - 0x5a, 0xa9, 0x55, 0xe5, 0x8e, 0xed, 0x89, 0xb3, 0xad, 0xbd, 0x6b, 0x76, 0x26, 0x84, 0x28, 0x0a, - 0x07, 0x4e, 0x95, 0x7a, 0x68, 0xab, 0x9e, 0x4a, 0xa5, 0xb6, 0x87, 0x1e, 0xa0, 0xb4, 0x12, 0x52, - 0x2b, 0x15, 0x55, 0xea, 0x3d, 0x47, 0xd4, 0x5e, 0x7a, 0xb2, 0xda, 0x50, 0x89, 0x8a, 0x3f, 0x81, - 0x53, 0xb5, 0xb3, 0xb3, 0xde, 0xf5, 0xcb, 0xda, 0x26, 0xf8, 0xd0, 0x8b, 0xb5, 0xbb, 0xf3, 0x3c, - 0xcf, 0x7c, 0xe6, 0x3b, 0x6f, 0xcf, 0x63, 0xd8, 0x5f, 0x34, 0x58, 0x75, 0x95, 0xb0, 0xaa, 0x2a, - 0x7e, 0x6e, 0xcc, 0xaa, 0xd7, 0x57, 0xa8, 0xb9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xed, 0xf9, 0x58, 0x3c, 0xd5, 0x8f, 0xa9, 0x44, 0x3b, 0xe6, 0xa2, - 0x4d, 0xe2, 0x44, 0x67, 0x34, 0xa6, 0xd6, 0x84, 0x27, 0xbe, 0x8d, 0x20, 0x64, 0xa7, 0x31, 0xd8, - 0x4f, 0xfb, 0xa6, 0x6c, 0x29, 0x7e, 0xb8, 0x87, 0xd5, 0xf3, 0x41, 0xd8, 0x3d, 0xff, 0x8a, 0x00, - 0xb7, 0xa7, 0x1e, 0xbe, 0x1b, 0xcc, 0x37, 0xa7, 0xf2, 0xdd, 0x60, 0xfe, 0x79, 0x4d, 0xdf, 0x07, - 0x04, 0x53, 0x65, 0x06, 0xa0, 0xae, 0xb7, 0xe4, 0x0e, 0x1b, 0xf8, 0x2b, 0x04, 0x63, 0xde, 0x7b, - 0xdd, 0xf7, 0x02, 0xee, 0x90, 0xa9, 0xf8, 0x5e, 0xc0, 0x9d, 0x12, 0x05, 0xe5, 0x94, 0x4b, 0x9b, - 0xc2, 0xd3, 0x5d, 0xce, 0x84, 0x82, 0xe5, 0xed, 0x10, 0x66, 0x17, 0x36, 0xff, 0x4a, 0x04, 0xee, - 0x6e, 0x25, 0x02, 0x9b, 0x5b, 0x09, 0xf4, 0x68, 0x2b, 0x81, 0xfe, 0xdc, 0x4a, 0xa0, 0x4f, 0x1f, - 0x27, 0x02, 0x8f, 0x1e, 0x27, 0x02, 0x7f, 0x3c, 0x4e, 0x04, 0xde, 0x99, 0xf2, 0xd4, 0x92, 0xf3, - 0x06, 0xab, 0xbe, 0xed, 0x44, 0x2d, 0xa9, 0x37, 0xed, 0xe8, 0xe2, 0x6f, 0xf8, 0x42, 0x48, 0xfc, - 0xe5, 0x7d, 0xf2, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x93, 0x29, 0xae, 0x95, 0xed, 0x17, 0x00, - 0x00, + // 1653 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00,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00, } func (this *QueryContractInfoResponse) Equal(that interface{}) bool { @@ -1566,6 +1659,9 @@ type QueryClient interface { Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // ContractsByCreator gets the contracts by creator ContractsByCreator(ctx context.Context, in *QueryContractsByCreatorRequest, opts ...grpc.CallOption) (*QueryContractsByCreatorResponse, error) + // WasmLimitsConfig gets the configured limits for static validation of Wasm + // files, encoded in MsgPack. + WasmLimitsConfig(ctx context.Context, in *QueryWasmLimitsConfigRequest, opts ...grpc.CallOption) (*QueryWasmLimitsConfigResponse, error) // BuildAddress builds a contract address BuildAddress(ctx context.Context, in *QueryBuildAddressRequest, opts ...grpc.CallOption) (*QueryBuildAddressResponse, error) } @@ -1686,6 +1782,15 @@ func (c *queryClient) ContractsByCreator(ctx context.Context, in *QueryContracts return out, nil } +func (c *queryClient) WasmLimitsConfig(ctx context.Context, in *QueryWasmLimitsConfigRequest, opts ...grpc.CallOption) (*QueryWasmLimitsConfigResponse, error) { + out := new(QueryWasmLimitsConfigResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Query/WasmLimitsConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) BuildAddress(ctx context.Context, in *QueryBuildAddressRequest, opts ...grpc.CallOption) (*QueryBuildAddressResponse, error) { out := new(QueryBuildAddressResponse) err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Query/BuildAddress", in, out, opts...) @@ -1721,6 +1826,9 @@ type QueryServer interface { Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // ContractsByCreator gets the contracts by creator ContractsByCreator(context.Context, *QueryContractsByCreatorRequest) (*QueryContractsByCreatorResponse, error) + // WasmLimitsConfig gets the configured limits for static validation of Wasm + // files, encoded in MsgPack. + WasmLimitsConfig(context.Context, *QueryWasmLimitsConfigRequest) (*QueryWasmLimitsConfigResponse, error) // BuildAddress builds a contract address BuildAddress(context.Context, *QueryBuildAddressRequest) (*QueryBuildAddressResponse, error) } @@ -1776,6 +1884,10 @@ func (*UnimplementedQueryServer) ContractsByCreator(ctx context.Context, req *Qu return nil, status.Errorf(codes.Unimplemented, "method ContractsByCreator not implemented") } +func (*UnimplementedQueryServer) WasmLimitsConfig(ctx context.Context, req *QueryWasmLimitsConfigRequest) (*QueryWasmLimitsConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WasmLimitsConfig not implemented") +} + func (*UnimplementedQueryServer) BuildAddress(ctx context.Context, req *QueryBuildAddressRequest) (*QueryBuildAddressResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BuildAddress not implemented") } @@ -2000,6 +2112,24 @@ func _Query_ContractsByCreator_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_WasmLimitsConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryWasmLimitsConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).WasmLimitsConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Query/WasmLimitsConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).WasmLimitsConfig(ctx, req.(*QueryWasmLimitsConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_BuildAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryBuildAddressRequest) if err := dec(in); err != nil { @@ -2070,6 +2200,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ContractsByCreator", Handler: _Query_ContractsByCreator_Handler, }, + { + MethodName: "WasmLimitsConfig", + Handler: _Query_WasmLimitsConfig_Handler, + }, { MethodName: "BuildAddress", Handler: _Query_BuildAddress_Handler, @@ -3065,6 +3199,59 @@ func (m *QueryContractsByCreatorResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } +func (m *QueryWasmLimitsConfigRequest) 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 *QueryWasmLimitsConfigRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryWasmLimitsConfigRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryWasmLimitsConfigResponse) 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 *QueryWasmLimitsConfigResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryWasmLimitsConfigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Config) > 0 { + i -= len(m.Config) + copy(dAtA[i:], m.Config) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Config))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *QueryBuildAddressRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -3559,6 +3746,28 @@ func (m *QueryContractsByCreatorResponse) Size() (n int) { return n } +func (m *QueryWasmLimitsConfigRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryWasmLimitsConfigResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Config) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *QueryBuildAddressRequest) Size() (n int) { if m == nil { return 0 @@ -6343,6 +6552,142 @@ func (m *QueryContractsByCreatorResponse) Unmarshal(dAtA []byte) error { return nil } +func (m *QueryWasmLimitsConfigRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryWasmLimitsConfigRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryWasmLimitsConfigRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *QueryWasmLimitsConfigResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryWasmLimitsConfigResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryWasmLimitsConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Config = append(m.Config[:0], dAtA[iNdEx:postIndex]...) + if m.Config == nil { + m.Config = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + func (m *QueryBuildAddressRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/query.pb.gw.go b/x/wasm/types/query.pb.gw.go index 9a40fc2a8..19af85847 100644 --- a/x/wasm/types/query.pb.gw.go +++ b/x/wasm/types/query.pb.gw.go @@ -52,7 +52,6 @@ func request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshal } protoReq.Address, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } @@ -78,7 +77,6 @@ func local_request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.M } protoReq.Address, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } @@ -106,7 +104,6 @@ func request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Mars } protoReq.Address, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } @@ -139,7 +136,6 @@ func local_request_Query_ContractHistory_0(ctx context.Context, marshaler runtim } protoReq.Address, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } @@ -174,7 +170,6 @@ func request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Mars } protoReq.CodeId, err = runtime.Uint64(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) } @@ -207,7 +202,6 @@ func local_request_Query_ContractsByCode_0(ctx context.Context, marshaler runtim } protoReq.CodeId, err = runtime.Uint64(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) } @@ -242,7 +236,6 @@ func request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Mar } protoReq.Address, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } @@ -275,7 +268,6 @@ func local_request_Query_AllContractState_0(ctx context.Context, marshaler runti } protoReq.Address, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } @@ -308,7 +300,6 @@ func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Mar } protoReq.Address, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } @@ -319,7 +310,6 @@ func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Mar } protoReq.QueryData, err = runtime.Bytes(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_data", err) } @@ -345,7 +335,6 @@ func local_request_Query_RawContractState_0(ctx context.Context, marshaler runti } protoReq.Address, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } @@ -356,7 +345,6 @@ func local_request_Query_RawContractState_0(ctx context.Context, marshaler runti } protoReq.QueryData, err = runtime.Bytes(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_data", err) } @@ -382,7 +370,6 @@ func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.M } protoReq.Address, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } @@ -393,7 +380,6 @@ func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.M } protoReq.QueryData, err = runtime.Bytes(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_data", err) } @@ -419,7 +405,6 @@ func local_request_Query_SmartContractState_0(ctx context.Context, marshaler run } protoReq.Address, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } @@ -430,7 +415,6 @@ func local_request_Query_SmartContractState_0(ctx context.Context, marshaler run } protoReq.QueryData, err = runtime.Bytes(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_data", err) } @@ -456,7 +440,6 @@ func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, clie } protoReq.CodeId, err = runtime.Uint64(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) } @@ -482,7 +465,6 @@ func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler } protoReq.CodeId, err = runtime.Uint64(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) } @@ -540,7 +522,6 @@ func request_Query_CodeInfo_0(ctx context.Context, marshaler runtime.Marshaler, } protoReq.CodeId, err = runtime.Uint64(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) } @@ -566,7 +547,6 @@ func local_request_Query_CodeInfo_0(ctx context.Context, marshaler runtime.Marsh } protoReq.CodeId, err = runtime.Uint64(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) } @@ -642,7 +622,6 @@ func request_Query_ContractsByCreator_0(ctx context.Context, marshaler runtime.M } protoReq.CreatorAddress, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator_address", err) } @@ -675,7 +654,6 @@ func local_request_Query_ContractsByCreator_0(ctx context.Context, marshaler run } protoReq.CreatorAddress, err = runtime.String(val) - if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator_address", err) } @@ -691,6 +669,22 @@ func local_request_Query_ContractsByCreator_0(ctx context.Context, marshaler run return msg, metadata, err } +func request_Query_WasmLimitsConfig_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryWasmLimitsConfigRequest + var metadata runtime.ServerMetadata + + msg, err := client.WasmLimitsConfig(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_Query_WasmLimitsConfig_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryWasmLimitsConfigRequest + var metadata runtime.ServerMetadata + + msg, err := server.WasmLimitsConfig(ctx, &protoReq) + return msg, metadata, err +} + var filter_Query_BuildAddress_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_BuildAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -992,6 +986,28 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv forward_Query_ContractsByCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle("GET", pattern_Query_WasmLimitsConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_WasmLimitsConfig_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_WasmLimitsConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle("GET", pattern_Query_BuildAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1282,6 +1298,25 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie forward_Query_ContractsByCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle("GET", pattern_Query_WasmLimitsConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_WasmLimitsConfig_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_WasmLimitsConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle("GET", pattern_Query_BuildAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1329,6 +1364,8 @@ var ( pattern_Query_ContractsByCreator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmwasm", "wasm", "v1", "contracts", "creator", "creator_address"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_WasmLimitsConfig_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmwasm", "wasm", "v1", "wasm-limits-config"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_BuildAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmwasm", "wasm", "v1", "contract", "build_address"}, "", runtime.AssumeColonVerbOpt(false))) ) @@ -1357,5 +1394,7 @@ var ( forward_Query_ContractsByCreator_0 = runtime.ForwardResponseMessage + forward_Query_WasmLimitsConfig_0 = runtime.ForwardResponseMessage + forward_Query_BuildAddress_0 = runtime.ForwardResponseMessage ) From 6b0e3fef525ea8ffb5c3f41ddeb95813e00057fa Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 16 Sep 2024 00:10:12 +0200 Subject: [PATCH 02/11] Update protobuf --- docs/proto/proto-docs.md | 6 +- proto/cosmwasm/wasm/v1/query.proto | 6 +- x/wasm/keeper/querier.go | 2 +- x/wasm/types/query.pb.go | 96 +++++++++++++++--------------- 4 files changed, 54 insertions(+), 56 deletions(-) diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index d5c5cc62a..f20eb1317 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -1439,13 +1439,13 @@ Query/WasmLimitsConfig RPC method. ### QueryWasmLimitsConfigResponse QueryWasmLimitsConfigResponse is the response type for the -Query/WasmLimitsConfig RPC method. It contains the MsgPack encoded limits for +Query/WasmLimitsConfig RPC method. It contains the JSON encoded limits for static validation of Wasm files. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `config` | [bytes](#bytes) | | | +| `config` | [string](#string) | | | @@ -1477,7 +1477,7 @@ Query provides defines the gRPC querier service | `PinnedCodes` | [QueryPinnedCodesRequest](#cosmwasm.wasm.v1.QueryPinnedCodesRequest) | [QueryPinnedCodesResponse](#cosmwasm.wasm.v1.QueryPinnedCodesResponse) | PinnedCodes gets the pinned code ids | GET|/cosmwasm/wasm/v1/codes/pinned| | `Params` | [QueryParamsRequest](#cosmwasm.wasm.v1.QueryParamsRequest) | [QueryParamsResponse](#cosmwasm.wasm.v1.QueryParamsResponse) | Params gets the module params | GET|/cosmwasm/wasm/v1/codes/params| | `ContractsByCreator` | [QueryContractsByCreatorRequest](#cosmwasm.wasm.v1.QueryContractsByCreatorRequest) | [QueryContractsByCreatorResponse](#cosmwasm.wasm.v1.QueryContractsByCreatorResponse) | ContractsByCreator gets the contracts by creator | GET|/cosmwasm/wasm/v1/contracts/creator/{creator_address}| -| `WasmLimitsConfig` | [QueryWasmLimitsConfigRequest](#cosmwasm.wasm.v1.QueryWasmLimitsConfigRequest) | [QueryWasmLimitsConfigResponse](#cosmwasm.wasm.v1.QueryWasmLimitsConfigResponse) | WasmLimitsConfig gets the configured limits for static validation of Wasm files, encoded in MsgPack. | GET|/cosmwasm/wasm/v1/wasm-limits-config| +| `WasmLimitsConfig` | [QueryWasmLimitsConfigRequest](#cosmwasm.wasm.v1.QueryWasmLimitsConfigRequest) | [QueryWasmLimitsConfigResponse](#cosmwasm.wasm.v1.QueryWasmLimitsConfigResponse) | WasmLimitsConfig gets the configured limits for static validation of Wasm files, encoded in JSON. | GET|/cosmwasm/wasm/v1/wasm-limits-config| | `BuildAddress` | [QueryBuildAddressRequest](#cosmwasm.wasm.v1.QueryBuildAddressRequest) | [QueryBuildAddressResponse](#cosmwasm.wasm.v1.QueryBuildAddressResponse) | BuildAddress builds a contract address | GET|/cosmwasm/wasm/v1/contract/build_address| diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index a6e54347a..e52b6b04a 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -91,7 +91,7 @@ service Query { } // WasmLimitsConfig gets the configured limits for static validation of Wasm - // files, encoded in MsgPack. + // files, encoded in JSON. rpc WasmLimitsConfig(QueryWasmLimitsConfigRequest) returns (QueryWasmLimitsConfigResponse) { option (google.api.http).get = "/cosmwasm/wasm/v1/wasm-limits-config"; @@ -329,9 +329,9 @@ message QueryContractsByCreatorResponse { message QueryWasmLimitsConfigRequest {} // QueryWasmLimitsConfigResponse is the response type for the -// Query/WasmLimitsConfig RPC method. It contains the MsgPack encoded limits for +// Query/WasmLimitsConfig RPC method. It contains the JSON encoded limits for // static validation of Wasm files. -message QueryWasmLimitsConfigResponse { bytes config = 1; } +message QueryWasmLimitsConfigResponse { string config = 1; } // QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC // method. diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go index ef0e488d4..da71ad1a4 100644 --- a/x/wasm/keeper/querier.go +++ b/x/wasm/keeper/querier.go @@ -441,7 +441,7 @@ func ensurePaginationParams(req *query.PageRequest) (*query.PageRequest, error) func (q GrpcQuerier) WasmLimitsConfig(c context.Context, req *types.QueryWasmLimitsConfigRequest) (*types.QueryWasmLimitsConfigResponse, error) { return &types.QueryWasmLimitsConfigResponse{ - Config: []byte{}, // TODO: implement + Config: "{\"todo\": \"put serialized limits here\"}", // TODO: implement }, nil } diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index 37e08faf1..23ca1511a 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -1214,10 +1214,10 @@ func (m *QueryWasmLimitsConfigRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryWasmLimitsConfigRequest proto.InternalMessageInfo // QueryWasmLimitsConfigResponse is the response type for the -// Query/WasmLimitsConfig RPC method. It contains the MsgPack encoded limits for +// Query/WasmLimitsConfig RPC method. It contains the JSON encoded limits for // static validation of Wasm files. type QueryWasmLimitsConfigResponse struct { - Config []byte `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + Config string `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` } func (m *QueryWasmLimitsConfigResponse) Reset() { *m = QueryWasmLimitsConfigResponse{} } @@ -1458,43 +1458,43 @@ var fileDescriptor_9677c207036b9f2b = []byte{ 0x4e, 0x6f, 0xad, 0xff, 0x82, 0xc2, 0x5c, 0x97, 0x5b, 0x95, 0xef, 0x11, 0x5c, 0x5f, 0xcd, 0xd0, 0x02, 0x1d, 0xe7, 0x31, 0xa9, 0x8e, 0x10, 0x80, 0x97, 0xb5, 0xef, 0xfa, 0x86, 0x3d, 0x9d, 0x39, 0x4f, 0xa5, 0x7b, 0xde, 0x8c, 0x43, 0xe7, 0x72, 0x9d, 0xf2, 0xd2, 0x25, 0xa3, 0x64, 0x08, 0xa8, - 0x4d, 0x9e, 0x5f, 0x67, 0xa1, 0xcd, 0x68, 0x5c, 0x87, 0x23, 0xed, 0xc6, 0xe1, 0x9c, 0xfc, 0x02, - 0x8d, 0x06, 0xbc, 0x39, 0xce, 0x73, 0x83, 0x36, 0xb5, 0x62, 0x14, 0xf3, 0x80, 0xdc, 0x73, 0xdb, - 0x3e, 0x28, 0x57, 0xb2, 0x16, 0x4b, 0x87, 0xb9, 0x05, 0x48, 0x56, 0xd5, 0x26,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, 0x7f, + 0x10, 0xd9, 0xb0, 0xfc, 0x7b, 0xff, 0xc9, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3b, 0xe2, 0xae, + 0x71, 0xea, 0x18, 0x00, 0x00, } func (this *QueryContractInfoResponse) Equal(that interface{}) bool { @@ -1660,7 +1660,7 @@ type QueryClient interface { // ContractsByCreator gets the contracts by creator ContractsByCreator(ctx context.Context, in *QueryContractsByCreatorRequest, opts ...grpc.CallOption) (*QueryContractsByCreatorResponse, error) // WasmLimitsConfig gets the configured limits for static validation of Wasm - // files, encoded in MsgPack. + // files, encoded in JSON. WasmLimitsConfig(ctx context.Context, in *QueryWasmLimitsConfigRequest, opts ...grpc.CallOption) (*QueryWasmLimitsConfigResponse, error) // BuildAddress builds a contract address BuildAddress(ctx context.Context, in *QueryBuildAddressRequest, opts ...grpc.CallOption) (*QueryBuildAddressResponse, error) @@ -1827,7 +1827,7 @@ type QueryServer interface { // ContractsByCreator gets the contracts by creator ContractsByCreator(context.Context, *QueryContractsByCreatorRequest) (*QueryContractsByCreatorResponse, error) // WasmLimitsConfig gets the configured limits for static validation of Wasm - // files, encoded in MsgPack. + // files, encoded in JSON. WasmLimitsConfig(context.Context, *QueryWasmLimitsConfigRequest) (*QueryWasmLimitsConfigResponse, error) // BuildAddress builds a contract address BuildAddress(context.Context, *QueryBuildAddressRequest) (*QueryBuildAddressResponse, error) @@ -6636,7 +6636,7 @@ func (m *QueryWasmLimitsConfigResponse) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -6646,25 +6646,23 @@ func (m *QueryWasmLimitsConfigResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Config = append(m.Config[:0], dAtA[iNdEx:postIndex]...) - if m.Config == nil { - m.Config = []byte{} - } + m.Config = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex From a1b5a160c08f32aa364e962e5257f737f37444e8 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Thu, 26 Sep 2024 23:15:02 +0700 Subject: [PATCH 03/11] Add WasmLimits to WasmConfig --- x/wasm/keeper/keeper.go | 7 +++++++ x/wasm/keeper/keeper_cgo.go | 14 ++++++++++++-- x/wasm/keeper/querier.go | 8 +++++++- x/wasm/types/exported_keepers.go | 1 + x/wasm/types/types.go | 2 ++ 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 27dc6074f..13b756757 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -109,6 +109,9 @@ type Keeper struct { // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. authority string + + // wasmLimits contains the limits sent to wasmvm on init + wasmLimits wasmvmtypes.WasmLimits } func (k Keeper) getUploadAccessConfig(ctx context.Context) types.AccessConfig { @@ -119,6 +122,10 @@ func (k Keeper) getInstantiateAccessConfig(ctx context.Context) types.AccessType return k.GetParams(ctx).InstantiateDefaultPermission } +func (k Keeper) GetWasmLimits() wasmvmtypes.WasmLimits { + return k.wasmLimits +} + // GetParams returns the total set of wasm parameters. func (k Keeper) GetParams(ctx context.Context) types.Params { p, err := k.params.Get(ctx) diff --git a/x/wasm/keeper/keeper_cgo.go b/x/wasm/keeper/keeper_cgo.go index 06f95cfaa..88b283b49 100644 --- a/x/wasm/keeper/keeper_cgo.go +++ b/x/wasm/keeper/keeper_cgo.go @@ -6,6 +6,7 @@ import ( "path/filepath" wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "cosmossdk.io/collections" corestoretypes "cosmossdk.io/core/store" @@ -56,7 +57,8 @@ func NewKeeper( propagateGovAuthorization: map[types.AuthorizationPolicyAction]struct{}{ types.AuthZActionInstantiate: {}, }, - authority: authority, + authority: authority, + wasmLimits: wasmConfig.WasmLimits, } keeper.messenger = NewDefaultMessageHandler(keeper, router, ics4Wrapper, channelKeeper, capabilityKeeper, bankKeeper, cdc, portSource) keeper.wasmVMQueryHandler = DefaultQueryPlugins(bankKeeper, stakingKeeper, distrKeeper, channelKeeper, keeper) @@ -70,7 +72,15 @@ func NewKeeper( // NewVM does a lot, so better not to create it and silently drop it. if keeper.wasmVM == nil { var err error - keeper.wasmVM, err = wasmvm.NewVM(filepath.Join(homeDir, "wasm"), availableCapabilities, contractMemoryLimit, wasmConfig.ContractDebugMode, wasmConfig.MemoryCacheSize) + keeper.wasmVM, err = wasmvm.NewVMWithConfig(wasmvmtypes.VMConfig{ + Cache: wasmvmtypes.CacheOptions{ + BaseDir: filepath.Join(homeDir, "wasm"), + AvailableCapabilities: availableCapabilities, + MemoryCacheSize: wasmvmtypes.NewSizeMebi(contractMemoryLimit), + InstanceMemoryLimit: wasmvmtypes.NewSizeMebi(wasmConfig.MemoryCacheSize), + }, + WasmLimits: wasmConfig.WasmLimits, + }, wasmConfig.ContractDebugMode) if err != nil { panic(err) } diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go index da71ad1a4..54429d04b 100644 --- a/x/wasm/keeper/querier.go +++ b/x/wasm/keeper/querier.go @@ -4,6 +4,7 @@ import ( "context" "encoding/binary" "encoding/hex" + "encoding/json" "fmt" "runtime/debug" @@ -440,8 +441,13 @@ func ensurePaginationParams(req *query.PageRequest) (*query.PageRequest, error) } func (q GrpcQuerier) WasmLimitsConfig(c context.Context, req *types.QueryWasmLimitsConfigRequest) (*types.QueryWasmLimitsConfigResponse, error) { + json, err := json.Marshal(q.keeper.GetWasmLimits()) + if err != nil { + return nil, err + } + return &types.QueryWasmLimitsConfigResponse{ - Config: "{\"todo\": \"put serialized limits here\"}", // TODO: implement + Config: string(json), }, nil } diff --git a/x/wasm/types/exported_keepers.go b/x/wasm/types/exported_keepers.go index 0ece2c020..b9d953baa 100644 --- a/x/wasm/types/exported_keepers.go +++ b/x/wasm/types/exported_keepers.go @@ -27,6 +27,7 @@ type ViewKeeper interface { GetByteCode(ctx context.Context, codeID uint64) ([]byte, error) IsPinnedCode(ctx context.Context, codeID uint64) bool GetParams(ctx context.Context) Params + GetWasmLimits() wasmvmtypes.WasmLimits } // ContractOpsKeeper contains mutable operations on a contract. diff --git a/x/wasm/types/types.go b/x/wasm/types/types.go index 1aea6ef14..e10433706 100644 --- a/x/wasm/types/types.go +++ b/x/wasm/types/types.go @@ -326,6 +326,8 @@ type WasmConfig struct { MemoryCacheSize uint32 `mapstructure:"memory_cache_size"` // ContractDebugMode log what contract print ContractDebugMode bool + // WasmLimits are the limits that are used for static validation of Wasm binaries. + WasmLimits wasmvmtypes.WasmLimits } // DefaultWasmConfig returns the default settings for WasmConfig From 1b4ebad326c5cfc7f58f6474310c13f5e57c86b4 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Fri, 27 Sep 2024 09:50:28 +0700 Subject: [PATCH 04/11] Add wasm limits query test --- x/wasm/keeper/querier_test.go | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index 90436db41..5f325038a 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -20,6 +20,7 @@ import ( "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" + dbm "github.com/cosmos/cosmos-db" sdk "github.com/cosmos/cosmos-sdk/types" sdkErrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" @@ -686,6 +687,54 @@ func TestQueryContractInfo(t *testing.T) { } } +func ptr[T any](v T) *T { + return &v +} + +func TestQueryWasmLimitsConfig(t *testing.T) { + cfg := types.DefaultWasmConfig() + + specs := map[string]struct { + limits wasmvmtypes.WasmLimits + expJSON []byte + }{ + "all 15": { + limits: wasmvmtypes.WasmLimits{ + InitialMemoryLimit: ptr(uint32(15)), + TableSizeLimit: ptr(uint32(15)), + MaxImports: ptr(uint32(15)), + MaxFunctions: ptr(uint32(15)), + MaxFunctionParams: ptr(uint32(15)), + MaxTotalFunctionParams: ptr(uint32(15)), + MaxFunctionResults: ptr(uint32(15)), + }, + expJSON: []byte(`{"initial_memory_limit":15,"table_size_limit":15,"max_imports":15,"max_functions":15,"max_function_params":15,"max_total_function_params":15,"max_function_results":15}`), + }, + "empty": { + limits: wasmvmtypes.WasmLimits{}, + expJSON: []byte("{}"), + }, + } + + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + cfg.WasmLimits = spec.limits + + ctx, keepers := createTestInput(t, false, AvailableCapabilities, cfg, dbm.NewMemDB()) + keeper := keepers.WasmKeeper + + q := Querier(keeper) + + response, err := q.WasmLimitsConfig(ctx, &types.QueryWasmLimitsConfigRequest{}) + require.NoError(t, err) + require.NotNil(t, response) + + assert.Equal(t, string(spec.expJSON), response.Config) + // assert.Equal(t, spec.expJSON, []byte(response.Config)) + }) + } +} + func TestQueryPinnedCodes(t *testing.T) { ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper From fce405c7a95344b008849306a0f4a4e62d162318 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Fri, 27 Sep 2024 10:51:35 +0700 Subject: [PATCH 05/11] Add test for wasm limits --- x/wasm/keeper/keeper_test.go | 16 ++++++++++++++++ x/wasm/keeper/querier_test.go | 4 ---- x/wasm/keeper/test_common.go | 5 +++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index dc0afc507..104d8202e 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -86,6 +86,22 @@ func TestCreateNilCreatorAddress(t *testing.T) { require.Error(t, err, "nil creator is not allowed") } +func TestWasmLimits(t *testing.T) { + cfg := types.DefaultWasmConfig() + cfg.WasmLimits = wasmvmtypes.WasmLimits{ + MaxImports: ptr(uint32(1)), // very low limit that every contract will fail + } + ctx, keepers := createTestInput(t, false, AvailableCapabilities, cfg, dbm.NewMemDB()) + keeper := keepers.ContractKeeper + + deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 1)) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) + + _, _, err := keeper.Create(ctx, creator, hackatomWasm, nil) + assert.Error(t, err) + assert.ErrorContains(t, err, "Import") +} + func TestCreateNilWasmCode(t *testing.T) { ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index 5f325038a..b4e7112d3 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -687,10 +687,6 @@ func TestQueryContractInfo(t *testing.T) { } } -func ptr[T any](v T) *T { - return &v -} - func TestQueryWasmLimitsConfig(t *testing.T) { cfg := types.DefaultWasmConfig() diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index 031498261..e6f20abd8 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -811,3 +811,8 @@ func keyPubAddr() (crypto.PrivKey, sdk.AccAddress) { addr := sdk.AccAddress(pub.Address()) return key, addr } + +// ptr returns a pointer to the value passed in +func ptr[T any](v T) *T { + return &v +} From 3f7e7d0d8f716910608a415960eb3120c913359d Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Fri, 27 Sep 2024 10:57:15 +0700 Subject: [PATCH 06/11] Fix formatting --- x/wasm/keeper/querier_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index b4e7112d3..6712e3465 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -11,6 +11,7 @@ import ( wasmvm "github.com/CosmWasm/wasmvm/v2" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" @@ -20,7 +21,6 @@ import ( "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - dbm "github.com/cosmos/cosmos-db" sdk "github.com/cosmos/cosmos-sdk/types" sdkErrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" From 2815f22122a7d6531d384fb037ac46cd16b71117 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 30 Sep 2024 17:12:44 +0700 Subject: [PATCH 07/11] Remove ptr function --- x/wasm/keeper/keeper_test.go | 3 ++- x/wasm/keeper/querier_test.go | 16 +++++++++------- x/wasm/keeper/test_common.go | 5 ----- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 104d8202e..a0ce0c20a 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -87,9 +87,10 @@ func TestCreateNilCreatorAddress(t *testing.T) { } func TestWasmLimits(t *testing.T) { + one := uint32(1) cfg := types.DefaultWasmConfig() cfg.WasmLimits = wasmvmtypes.WasmLimits{ - MaxImports: ptr(uint32(1)), // very low limit that every contract will fail + MaxImports: &one, // very low limit that every contract will fail } ctx, keepers := createTestInput(t, false, AvailableCapabilities, cfg, dbm.NewMemDB()) keeper := keepers.ContractKeeper diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index 6712e3465..c25a9fafa 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -690,19 +690,21 @@ func TestQueryContractInfo(t *testing.T) { func TestQueryWasmLimitsConfig(t *testing.T) { cfg := types.DefaultWasmConfig() + fifteen := uint32(15) + specs := map[string]struct { limits wasmvmtypes.WasmLimits expJSON []byte }{ "all 15": { limits: wasmvmtypes.WasmLimits{ - InitialMemoryLimit: ptr(uint32(15)), - TableSizeLimit: ptr(uint32(15)), - MaxImports: ptr(uint32(15)), - MaxFunctions: ptr(uint32(15)), - MaxFunctionParams: ptr(uint32(15)), - MaxTotalFunctionParams: ptr(uint32(15)), - MaxFunctionResults: ptr(uint32(15)), + InitialMemoryLimit: &fifteen, + TableSizeLimit: &fifteen, + MaxImports: &fifteen, + MaxFunctions: &fifteen, + MaxFunctionParams: &fifteen, + MaxTotalFunctionParams: &fifteen, + MaxFunctionResults: &fifteen, }, expJSON: []byte(`{"initial_memory_limit":15,"table_size_limit":15,"max_imports":15,"max_functions":15,"max_function_params":15,"max_total_function_params":15,"max_function_results":15}`), }, diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index e6f20abd8..031498261 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -811,8 +811,3 @@ func keyPubAddr() (crypto.PrivKey, sdk.AccAddress) { addr := sdk.AccAddress(pub.Address()) return key, addr } - -// ptr returns a pointer to the value passed in -func ptr[T any](v T) *T { - return &v -} From 5da6acd3131034b724f5297a9f3ec81d1d36b703 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 7 Oct 2024 17:57:52 +0700 Subject: [PATCH 08/11] Rename WasmConfig to NodeConfig --- app/ante.go | 6 +++--- app/app.go | 10 +++++----- cmd/wasmd/commands.go | 4 ++-- tests/integration/module_test.go | 18 +++++++++--------- x/wasm/alias.go | 4 ++-- x/wasm/keeper/bench_test.go | 8 ++++---- x/wasm/keeper/genesis_test.go | 4 ++-- x/wasm/keeper/keeper_cgo.go | 12 ++++++------ x/wasm/keeper/keeper_no_cgo.go | 2 +- x/wasm/keeper/keeper_test.go | 2 +- x/wasm/keeper/options_test.go | 2 +- x/wasm/keeper/querier_test.go | 2 +- x/wasm/keeper/test_common.go | 6 +++--- x/wasm/module.go | 8 ++++---- x/wasm/types/types.go | 16 +++++++--------- 15 files changed, 51 insertions(+), 53 deletions(-) diff --git a/app/ante.go b/app/ante.go index aeb139360..8f09c5709 100644 --- a/app/ante.go +++ b/app/ante.go @@ -23,7 +23,7 @@ type HandlerOptions struct { ante.HandlerOptions IBCKeeper *keeper.Keeper - WasmConfig *wasmTypes.WasmConfig + NodeConfig *wasmTypes.NodeConfig WasmKeeper *wasmkeeper.Keeper TXCounterStoreService corestoretypes.KVStoreService CircuitKeeper *circuitkeeper.Keeper @@ -40,7 +40,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { if options.SignModeHandler == nil { return nil, errors.New("sign mode handler is required for ante builder") } - if options.WasmConfig == nil { + if options.NodeConfig == nil { return nil, errors.New("wasm config is required for ante builder") } if options.TXCounterStoreService == nil { @@ -52,7 +52,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { anteDecorators := []sdk.AnteDecorator{ ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first - wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit), // after setup context to enforce limits early + wasmkeeper.NewLimitSimulationGasDecorator(options.NodeConfig.SimulationGasLimit), // after setup context to enforce limits early wasmkeeper.NewCountTXDecorator(options.TXCounterStoreService), wasmkeeper.NewGasRegisterDecorator(options.WasmKeeper.GetGasRegister()), wasmkeeper.NewTxContractsDecorator(), diff --git a/app/app.go b/app/app.go index 85cd58d8b..bae00edb3 100644 --- a/app/app.go +++ b/app/app.go @@ -623,7 +623,7 @@ func NewWasmApp( ) wasmDir := filepath.Join(homePath, "wasm") - wasmConfig, err := wasm.ReadWasmConfig(appOpts) + nodeConfig, err := wasm.ReadNodeConfig(appOpts) if err != nil { panic(fmt.Sprintf("error while reading wasm config: %s", err)) } @@ -645,7 +645,7 @@ func NewWasmApp( app.MsgServiceRouter(), app.GRPCQueryRouter(), wasmDir, - wasmConfig, + nodeConfig, wasmkeeper.BuiltInCapabilities(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), wasmOpts..., @@ -871,7 +871,7 @@ func NewWasmApp( app.SetPreBlocker(app.PreBlocker) app.SetBeginBlocker(app.BeginBlocker) app.SetEndBlocker(app.EndBlocker) - app.setAnteHandler(txConfig, wasmConfig, keys[wasmtypes.StoreKey]) + app.setAnteHandler(txConfig, nodeConfig, keys[wasmtypes.StoreKey]) // must be before Loading version // requires the snapshot store to be created and registered as a BaseAppOption @@ -934,7 +934,7 @@ func NewWasmApp( return app } -func (app *WasmApp) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtypes.WasmConfig, txCounterStoreKey *storetypes.KVStoreKey) { +func (app *WasmApp) setAnteHandler(txConfig client.TxConfig, nodeConfig wasmtypes.NodeConfig, txCounterStoreKey *storetypes.KVStoreKey) { anteHandler, err := NewAnteHandler( HandlerOptions{ HandlerOptions: ante.HandlerOptions{ @@ -945,7 +945,7 @@ func (app *WasmApp) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtype SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, IBCKeeper: app.IBCKeeper, - WasmConfig: &wasmConfig, + NodeConfig: &nodeConfig, WasmKeeper: &app.WasmKeeper, TXCounterStoreService: runtime.NewKVStoreService(txCounterStoreKey), CircuitKeeper: &app.CircuitKeeper, diff --git a/cmd/wasmd/commands.go b/cmd/wasmd/commands.go index 29d696254..cb9d00668 100644 --- a/cmd/wasmd/commands.go +++ b/cmd/wasmd/commands.go @@ -61,7 +61,7 @@ func initAppConfig() (string, interface{}) { type CustomAppConfig struct { serverconfig.Config - Wasm wasmtypes.WasmConfig `mapstructure:"wasm"` + Wasm wasmtypes.NodeConfig `mapstructure:"wasm"` } // Optionally allow the chain developer to overwrite the SDK's default @@ -84,7 +84,7 @@ func initAppConfig() (string, interface{}) { customAppConfig := CustomAppConfig{ Config: *srvCfg, - Wasm: wasmtypes.DefaultWasmConfig(), + Wasm: wasmtypes.DefaultNodeConfig(), } customAppTemplate := serverconfig.DefaultConfigTemplate + diff --git a/tests/integration/module_test.go b/tests/integration/module_test.go index 115596858..2da621648 100644 --- a/tests/integration/module_test.go +++ b/tests/integration/module_test.go @@ -446,7 +446,7 @@ func TestHandleExecuteEscrow(t *testing.T) { assert.Equal(t, sdk.Coins{}, data.bankKeeper.GetAllBalances(data.ctx, contractAcct.GetAddress())) } -func TestReadWasmConfig(t *testing.T) { +func TestReadNodeConfig(t *testing.T) { withViper := func(s string) *viper.Viper { v := viper.New() v.SetConfigType("toml") @@ -454,17 +454,17 @@ func TestReadWasmConfig(t *testing.T) { return v } var one uint64 = 1 - defaults := types.DefaultWasmConfig() + defaults := types.DefaultNodeConfig() specs := map[string]struct { src servertypes.AppOptions - exp types.WasmConfig + exp types.NodeConfig }{ "set query gas limit via opts": { src: AppOptionsMock{ "wasm.query_gas_limit": 1, }, - exp: types.WasmConfig{ + exp: types.NodeConfig{ SmartQueryGasLimit: 1, MemoryCacheSize: defaults.MemoryCacheSize, }, @@ -473,7 +473,7 @@ func TestReadWasmConfig(t *testing.T) { src: AppOptionsMock{ "wasm.memory_cache_size": 2, }, - exp: types.WasmConfig{ + exp: types.NodeConfig{ MemoryCacheSize: 2, SmartQueryGasLimit: defaults.SmartQueryGasLimit, }, @@ -482,7 +482,7 @@ func TestReadWasmConfig(t *testing.T) { src: AppOptionsMock{ "trace": true, }, - exp: types.WasmConfig{ + exp: types.NodeConfig{ SmartQueryGasLimit: defaults.SmartQueryGasLimit, MemoryCacheSize: defaults.MemoryCacheSize, ContractDebugMode: true, @@ -497,12 +497,12 @@ func TestReadWasmConfig(t *testing.T) { exp: defaults, }, "custom config template values": { - src: withViper(types.ConfigTemplate(types.WasmConfig{ + src: withViper(types.ConfigTemplate(types.NodeConfig{ SimulationGasLimit: &one, SmartQueryGasLimit: 2, MemoryCacheSize: 3, })), - exp: types.WasmConfig{ + exp: types.NodeConfig{ SimulationGasLimit: &one, SmartQueryGasLimit: 2, MemoryCacheSize: 3, @@ -512,7 +512,7 @@ func TestReadWasmConfig(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - got, err := wasm.ReadWasmConfig(spec.src) + got, err := wasm.ReadNodeConfig(spec.src) require.NoError(t, err) assert.Equal(t, spec.exp, got) }) diff --git a/x/wasm/alias.go b/x/wasm/alias.go index f53463b99..fd4453e5e 100644 --- a/x/wasm/alias.go +++ b/x/wasm/alias.go @@ -51,7 +51,7 @@ var ( // Deprecated: Do not use. NewWasmCoins = types.NewWasmCoins // Deprecated: Do not use. - DefaultWasmConfig = types.DefaultWasmConfig + DefaultNodeConfig = types.DefaultNodeConfig // Deprecated: Do not use. DefaultParams = types.DefaultParams // Deprecated: Do not use. @@ -174,7 +174,7 @@ type ( // Deprecated: Do not use. CreatedAt = types.AbsoluteTxPosition // Deprecated: Do not use. - Config = types.WasmConfig + Config = types.NodeConfig // Deprecated: Do not use. CodeInfoResponse = types.CodeInfoResponse // Deprecated: Do not use. diff --git a/x/wasm/keeper/bench_test.go b/x/wasm/keeper/bench_test.go index 19bb7de44..aad678d96 100644 --- a/x/wasm/keeper/bench_test.go +++ b/x/wasm/keeper/bench_test.go @@ -51,8 +51,8 @@ func BenchmarkInstantiationOverhead(b *testing.B) { } for name, spec := range specs { b.Run(name, func(b *testing.B) { - wasmConfig := types.WasmConfig{MemoryCacheSize: 0} - ctx, keepers := createTestInput(b, false, AvailableCapabilities, wasmConfig, spec.db()) + nodeConfig := types.NodeConfig{MemoryCacheSize: 0} + ctx, keepers := createTestInput(b, false, AvailableCapabilities, nodeConfig, spec.db()) example := InstantiateHackatomExampleContract(b, ctx, keepers) if spec.pinned { require.NoError(b, keepers.ContractKeeper.PinCode(ctx, example.CodeID)) @@ -85,9 +85,9 @@ func BenchmarkCompilation(b *testing.B) { for name, spec := range specs { b.Run(name, func(b *testing.B) { - wasmConfig := types.WasmConfig{MemoryCacheSize: 0} + nodeConfig := types.NodeConfig{MemoryCacheSize: 0} db := dbm.NewMemDB() - ctx, keepers := createTestInput(b, false, AvailableCapabilities, wasmConfig, db) + ctx, keepers := createTestInput(b, false, AvailableCapabilities, nodeConfig, db) // print out code size for comparisons code, err := os.ReadFile(spec.wasmFile) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index f16b151a4..cfba8aa27 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -680,7 +680,7 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context) { // also registering gov interfaces for nested Any type v1beta1.RegisterInterfaces(encodingConfig.InterfaceRegistry) - wasmConfig := types.DefaultWasmConfig() + nodeConfig := types.DefaultNodeConfig() srcKeeper := NewKeeper( encodingConfig.Codec, @@ -697,7 +697,7 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context) { nil, nil, tempDir, - wasmConfig, + nodeConfig, AvailableCapabilities, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) diff --git a/x/wasm/keeper/keeper_cgo.go b/x/wasm/keeper/keeper_cgo.go index 88b283b49..a57dd64c9 100644 --- a/x/wasm/keeper/keeper_cgo.go +++ b/x/wasm/keeper/keeper_cgo.go @@ -33,7 +33,7 @@ func NewKeeper( router MessageRouter, _ GRPCQueryRouter, homeDir string, - wasmConfig types.WasmConfig, + nodeConfig types.NodeConfig, availableCapabilities []string, authority string, opts ...Option, @@ -48,7 +48,7 @@ func NewKeeper( accountPruner: NewVestingCoinBurner(bankKeeper), portKeeper: portKeeper, capabilityKeeper: capabilityKeeper, - queryGasLimit: wasmConfig.SmartQueryGasLimit, + queryGasLimit: nodeConfig.SmartQueryGasLimit, gasRegister: types.NewDefaultWasmGasRegister(), maxQueryStackSize: types.DefaultMaxQueryStackSize, maxCallDepth: types.DefaultMaxCallDepth, @@ -58,7 +58,7 @@ func NewKeeper( types.AuthZActionInstantiate: {}, }, authority: authority, - wasmLimits: wasmConfig.WasmLimits, + wasmLimits: nodeConfig.WasmLimits, } keeper.messenger = NewDefaultMessageHandler(keeper, router, ics4Wrapper, channelKeeper, capabilityKeeper, bankKeeper, cdc, portSource) keeper.wasmVMQueryHandler = DefaultQueryPlugins(bankKeeper, stakingKeeper, distrKeeper, channelKeeper, keeper) @@ -77,10 +77,10 @@ func NewKeeper( BaseDir: filepath.Join(homeDir, "wasm"), AvailableCapabilities: availableCapabilities, MemoryCacheSize: wasmvmtypes.NewSizeMebi(contractMemoryLimit), - InstanceMemoryLimit: wasmvmtypes.NewSizeMebi(wasmConfig.MemoryCacheSize), + InstanceMemoryLimit: wasmvmtypes.NewSizeMebi(nodeConfig.MemoryCacheSize), }, - WasmLimits: wasmConfig.WasmLimits, - }, wasmConfig.ContractDebugMode) + WasmLimits: nodeConfig.WasmLimits, + }, nodeConfig.ContractDebugMode) if err != nil { panic(err) } diff --git a/x/wasm/keeper/keeper_no_cgo.go b/x/wasm/keeper/keeper_no_cgo.go index 261b2bad2..2ad18ad17 100644 --- a/x/wasm/keeper/keeper_no_cgo.go +++ b/x/wasm/keeper/keeper_no_cgo.go @@ -27,7 +27,7 @@ func NewKeeper( router MessageRouter, _ GRPCQueryRouter, homeDir string, - wasmConfig types.WasmConfig, + nodeConfig types.NodeConfig, availableCapabilities string, authority string, opts ...Option, diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index a0ce0c20a..e3562d145 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -88,7 +88,7 @@ func TestCreateNilCreatorAddress(t *testing.T) { func TestWasmLimits(t *testing.T) { one := uint32(1) - cfg := types.DefaultWasmConfig() + cfg := types.DefaultNodeConfig() cfg.WasmLimits = wasmvmtypes.WasmLimits{ MaxImports: &one, // very low limit that every contract will fail } diff --git a/x/wasm/keeper/options_test.go b/x/wasm/keeper/options_test.go index f6576ce3a..541fcaaeb 100644 --- a/x/wasm/keeper/options_test.go +++ b/x/wasm/keeper/options_test.go @@ -155,7 +155,7 @@ func TestConstructorOptions(t *testing.T) { opt := spec.srcOpt _, gotPostOptMarker := opt.(postOptsFn) require.Equal(t, spec.isPostOpt, gotPostOptMarker) - k := NewKeeper(codec, runtime.NewKVStoreService(storeKey), authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, nil, nil, tempDir, types.DefaultWasmConfig(), AvailableCapabilities, "", spec.srcOpt) + k := NewKeeper(codec, runtime.NewKVStoreService(storeKey), authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, nil, nil, tempDir, types.DefaultNodeConfig(), AvailableCapabilities, "", spec.srcOpt) spec.verify(t, k) }) } diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index c25a9fafa..32a4676f0 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -688,7 +688,7 @@ func TestQueryContractInfo(t *testing.T) { } func TestQueryWasmLimitsConfig(t *testing.T) { - cfg := types.DefaultWasmConfig() + cfg := types.DefaultNodeConfig() fifteen := uint32(15) diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index 031498261..fe37906f3 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -212,7 +212,7 @@ func CreateDefaultTestInput(t testing.TB) (sdk.Context, TestKeepers) { // CreateTestInput encoders can be nil to accept the defaults, or set it to override some of the message handlers (like default) func CreateTestInput(t testing.TB, isCheckTx bool, availableCapabilities []string, opts ...Option) (sdk.Context, TestKeepers) { // Load default wasm config - return createTestInput(t, isCheckTx, availableCapabilities, types.DefaultWasmConfig(), dbm.NewMemDB(), opts...) + return createTestInput(t, isCheckTx, availableCapabilities, types.DefaultNodeConfig(), dbm.NewMemDB(), opts...) } // encoders can be nil to accept the defaults, or set it to override some of the message handlers (like default) @@ -220,7 +220,7 @@ func createTestInput( t testing.TB, isCheckTx bool, availableCapabilities []string, - wasmConfig types.WasmConfig, + nodeConfig types.NodeConfig, db dbm.DB, opts ...Option, ) (sdk.Context, TestKeepers) { @@ -405,7 +405,7 @@ func createTestInput( msgRouter, querier, tempDir, - wasmConfig, + nodeConfig, availableCapabilities, authtypes.NewModuleAddress(govtypes.ModuleName).String(), opts..., diff --git a/x/wasm/module.go b/x/wasm/module.go index 4fdf8f9dd..c0a628e03 100644 --- a/x/wasm/module.go +++ b/x/wasm/module.go @@ -222,7 +222,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp // AddModuleInitFlags implements servertypes.ModuleInitFlags interface. func AddModuleInitFlags(startCmd *cobra.Command) { - defaults := types.DefaultWasmConfig() + defaults := types.DefaultNodeConfig() startCmd.Flags().Uint32(flagWasmMemoryCacheSize, defaults.MemoryCacheSize, "Sets the size in MiB (NOT bytes) of an in-memory cache for Wasm modules. Set to 0 to disable.") startCmd.Flags().Uint64(flagWasmQueryGasLimit, defaults.SmartQueryGasLimit, "Set the max gas that can be spent on executing a query with a Wasm contract") startCmd.Flags().String(flagWasmSimulationGasLimit, "", "Set the max gas that can be spent when executing a simulation TX") @@ -242,9 +242,9 @@ func AddModuleInitFlags(startCmd *cobra.Command) { startCmd.PreRunE = chainPreRuns(preCheck, startCmd.PreRunE) } -// ReadWasmConfig reads the wasm specifig configuration -func ReadWasmConfig(opts servertypes.AppOptions) (types.WasmConfig, error) { - cfg := types.DefaultWasmConfig() +// ReadNodeConfig reads the node specific configuration +func ReadNodeConfig(opts servertypes.AppOptions) (types.NodeConfig, error) { + cfg := types.DefaultNodeConfig() var err error if v := opts.Get(flagWasmMemoryCacheSize); v != nil { if cfg.MemoryCacheSize, err = cast.ToUint32E(v); err != nil { diff --git a/x/wasm/types/types.go b/x/wasm/types/types.go index e10433706..f7c0707b6 100644 --- a/x/wasm/types/types.go +++ b/x/wasm/types/types.go @@ -315,8 +315,8 @@ func NewWasmCoins(cosmosCoins sdk.Coins) (wasmCoins []wasmvmtypes.Coin) { return wasmCoins } -// WasmConfig is the extra config required for wasm -type WasmConfig struct { +// NodeConfig is the extra config required for wasm +type NodeConfig struct { // SimulationGasLimit is the max gas to be used in a tx simulation call. // When not set the consensus max block gas is used instead SimulationGasLimit *uint64 `mapstructure:"simulation_gas_limit"` @@ -326,13 +326,11 @@ type WasmConfig struct { MemoryCacheSize uint32 `mapstructure:"memory_cache_size"` // ContractDebugMode log what contract print ContractDebugMode bool - // WasmLimits are the limits that are used for static validation of Wasm binaries. - WasmLimits wasmvmtypes.WasmLimits } -// DefaultWasmConfig returns the default settings for WasmConfig -func DefaultWasmConfig() WasmConfig { - return WasmConfig{ +// DefaultNodeConfig returns the default settings for NodeConfig +func DefaultNodeConfig() NodeConfig { + return NodeConfig{ SmartQueryGasLimit: defaultSmartQueryGasLimit, MemoryCacheSize: defaultMemoryCacheSize, ContractDebugMode: defaultContractDebugMode, @@ -341,11 +339,11 @@ func DefaultWasmConfig() WasmConfig { // DefaultConfigTemplate toml snippet with default values for app.toml func DefaultConfigTemplate() string { - return ConfigTemplate(DefaultWasmConfig()) + return ConfigTemplate(DefaultNodeConfig()) } // ConfigTemplate toml snippet for app.toml -func ConfigTemplate(c WasmConfig) string { +func ConfigTemplate(c NodeConfig) string { simGasLimit := `# simulation_gas_limit =` if c.SimulationGasLimit != nil { simGasLimit = fmt.Sprintf(`simulation_gas_limit = %d`, *c.SimulationGasLimit) From d9ac3b808bb114197a3c2c5ee9b901a6b99a703d Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 7 Oct 2024 18:00:01 +0700 Subject: [PATCH 09/11] Add VMConfig --- app/app.go | 1 + x/wasm/keeper/bench_test.go | 4 ++-- x/wasm/keeper/genesis_test.go | 2 ++ x/wasm/keeper/keeper_cgo.go | 5 +++-- x/wasm/keeper/keeper_no_cgo.go | 1 + x/wasm/keeper/keeper_test.go | 9 +++++---- x/wasm/keeper/options_test.go | 2 +- x/wasm/keeper/querier_test.go | 4 ++-- x/wasm/keeper/test_common.go | 6 ++++-- x/wasm/types/types.go | 6 ++++++ 10 files changed, 27 insertions(+), 13 deletions(-) diff --git a/app/app.go b/app/app.go index bae00edb3..984c5003d 100644 --- a/app/app.go +++ b/app/app.go @@ -646,6 +646,7 @@ func NewWasmApp( app.GRPCQueryRouter(), wasmDir, nodeConfig, + wasmtypes.VMConfig{}, wasmkeeper.BuiltInCapabilities(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), wasmOpts..., diff --git a/x/wasm/keeper/bench_test.go b/x/wasm/keeper/bench_test.go index aad678d96..4876b093f 100644 --- a/x/wasm/keeper/bench_test.go +++ b/x/wasm/keeper/bench_test.go @@ -52,7 +52,7 @@ func BenchmarkInstantiationOverhead(b *testing.B) { for name, spec := range specs { b.Run(name, func(b *testing.B) { nodeConfig := types.NodeConfig{MemoryCacheSize: 0} - ctx, keepers := createTestInput(b, false, AvailableCapabilities, nodeConfig, spec.db()) + ctx, keepers := createTestInput(b, false, AvailableCapabilities, nodeConfig, types.VMConfig{}, spec.db()) example := InstantiateHackatomExampleContract(b, ctx, keepers) if spec.pinned { require.NoError(b, keepers.ContractKeeper.PinCode(ctx, example.CodeID)) @@ -87,7 +87,7 @@ func BenchmarkCompilation(b *testing.B) { b.Run(name, func(b *testing.B) { nodeConfig := types.NodeConfig{MemoryCacheSize: 0} db := dbm.NewMemDB() - ctx, keepers := createTestInput(b, false, AvailableCapabilities, nodeConfig, db) + ctx, keepers := createTestInput(b, false, AvailableCapabilities, nodeConfig, types.VMConfig{}, db) // print out code size for comparisons code, err := os.ReadFile(spec.wasmFile) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index cfba8aa27..189e5e1b9 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -33,6 +33,7 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/CosmWasm/wasmd/x/wasm/types" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" ) func TestGenesisExportImport(t *testing.T) { @@ -698,6 +699,7 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context) { nil, tempDir, nodeConfig, + wasmtypes.VMConfig{}, AvailableCapabilities, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) diff --git a/x/wasm/keeper/keeper_cgo.go b/x/wasm/keeper/keeper_cgo.go index a57dd64c9..23542266b 100644 --- a/x/wasm/keeper/keeper_cgo.go +++ b/x/wasm/keeper/keeper_cgo.go @@ -34,6 +34,7 @@ func NewKeeper( _ GRPCQueryRouter, homeDir string, nodeConfig types.NodeConfig, + vmConfig types.VMConfig, availableCapabilities []string, authority string, opts ...Option, @@ -58,7 +59,7 @@ func NewKeeper( types.AuthZActionInstantiate: {}, }, authority: authority, - wasmLimits: nodeConfig.WasmLimits, + wasmLimits: vmConfig.WasmLimits, } keeper.messenger = NewDefaultMessageHandler(keeper, router, ics4Wrapper, channelKeeper, capabilityKeeper, bankKeeper, cdc, portSource) keeper.wasmVMQueryHandler = DefaultQueryPlugins(bankKeeper, stakingKeeper, distrKeeper, channelKeeper, keeper) @@ -79,7 +80,7 @@ func NewKeeper( MemoryCacheSize: wasmvmtypes.NewSizeMebi(contractMemoryLimit), InstanceMemoryLimit: wasmvmtypes.NewSizeMebi(nodeConfig.MemoryCacheSize), }, - WasmLimits: nodeConfig.WasmLimits, + WasmLimits: vmConfig.WasmLimits, }, nodeConfig.ContractDebugMode) if err != nil { panic(err) diff --git a/x/wasm/keeper/keeper_no_cgo.go b/x/wasm/keeper/keeper_no_cgo.go index 2ad18ad17..f28c8615b 100644 --- a/x/wasm/keeper/keeper_no_cgo.go +++ b/x/wasm/keeper/keeper_no_cgo.go @@ -28,6 +28,7 @@ func NewKeeper( _ GRPCQueryRouter, homeDir string, nodeConfig types.NodeConfig, + vmConfig types.VMConfig, availableCapabilities string, authority string, opts ...Option, diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index e3562d145..f80cd89be 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -89,10 +89,11 @@ func TestCreateNilCreatorAddress(t *testing.T) { func TestWasmLimits(t *testing.T) { one := uint32(1) cfg := types.DefaultNodeConfig() - cfg.WasmLimits = wasmvmtypes.WasmLimits{ - MaxImports: &one, // very low limit that every contract will fail - } - ctx, keepers := createTestInput(t, false, AvailableCapabilities, cfg, dbm.NewMemDB()) + ctx, keepers := createTestInput(t, false, AvailableCapabilities, cfg, types.VMConfig{ + WasmLimits: wasmvmtypes.WasmLimits{ + MaxImports: &one, // very low limit that every contract will fail + }, + }, dbm.NewMemDB()) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 1)) diff --git a/x/wasm/keeper/options_test.go b/x/wasm/keeper/options_test.go index 541fcaaeb..bb368c168 100644 --- a/x/wasm/keeper/options_test.go +++ b/x/wasm/keeper/options_test.go @@ -155,7 +155,7 @@ func TestConstructorOptions(t *testing.T) { opt := spec.srcOpt _, gotPostOptMarker := opt.(postOptsFn) require.Equal(t, spec.isPostOpt, gotPostOptMarker) - k := NewKeeper(codec, runtime.NewKVStoreService(storeKey), authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, nil, nil, tempDir, types.DefaultNodeConfig(), AvailableCapabilities, "", spec.srcOpt) + k := NewKeeper(codec, runtime.NewKVStoreService(storeKey), authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, nil, nil, tempDir, types.DefaultNodeConfig(), types.VMConfig{}, AvailableCapabilities, "", spec.srcOpt) spec.verify(t, k) }) } diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index 32a4676f0..933f316e2 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -688,7 +688,7 @@ func TestQueryContractInfo(t *testing.T) { } func TestQueryWasmLimitsConfig(t *testing.T) { - cfg := types.DefaultNodeConfig() + cfg := types.VMConfig{} fifteen := uint32(15) @@ -718,7 +718,7 @@ func TestQueryWasmLimitsConfig(t *testing.T) { t.Run(name, func(t *testing.T) { cfg.WasmLimits = spec.limits - ctx, keepers := createTestInput(t, false, AvailableCapabilities, cfg, dbm.NewMemDB()) + ctx, keepers := createTestInput(t, false, AvailableCapabilities, types.DefaultNodeConfig(), cfg, dbm.NewMemDB()) keeper := keepers.WasmKeeper q := Querier(keeper) diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index fe37906f3..eb1285b75 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -212,7 +212,7 @@ func CreateDefaultTestInput(t testing.TB) (sdk.Context, TestKeepers) { // CreateTestInput encoders can be nil to accept the defaults, or set it to override some of the message handlers (like default) func CreateTestInput(t testing.TB, isCheckTx bool, availableCapabilities []string, opts ...Option) (sdk.Context, TestKeepers) { // Load default wasm config - return createTestInput(t, isCheckTx, availableCapabilities, types.DefaultNodeConfig(), dbm.NewMemDB(), opts...) + return createTestInput(t, isCheckTx, availableCapabilities, types.DefaultNodeConfig(), types.VMConfig{}, dbm.NewMemDB(), opts...) } // encoders can be nil to accept the defaults, or set it to override some of the message handlers (like default) @@ -221,6 +221,7 @@ func createTestInput( isCheckTx bool, availableCapabilities []string, nodeConfig types.NodeConfig, + vmConfig types.VMConfig, db dbm.DB, opts ...Option, ) (sdk.Context, TestKeepers) { @@ -359,7 +360,7 @@ func createTestInput( faucet := NewTestFaucet(t, ctx, bankKeeper, minttypes.ModuleName, sdk.NewCoin("stake", sdkmath.NewInt(100_000_000_000))) - // set some funds ot pay out validatores, based on code from: + // set some funds to pay out validators, based on code from: // https://github.com/cosmos/cosmos-sdk/blob/fea231556aee4d549d7551a6190389c4328194eb/x/distribution/keeper/keeper_test.go#L50-L57 distrAcc := distKeeper.GetDistributionAccount(ctx) faucet.Fund(ctx, distrAcc.GetAddress(), sdk.NewCoin("stake", sdkmath.NewInt(2000000))) @@ -406,6 +407,7 @@ func createTestInput( querier, tempDir, nodeConfig, + vmConfig, availableCapabilities, authtypes.NewModuleAddress(govtypes.ModuleName).String(), opts..., diff --git a/x/wasm/types/types.go b/x/wasm/types/types.go index f7c0707b6..e0f74e72b 100644 --- a/x/wasm/types/types.go +++ b/x/wasm/types/types.go @@ -315,6 +315,12 @@ func NewWasmCoins(cosmosCoins sdk.Coins) (wasmCoins []wasmvmtypes.Coin) { return wasmCoins } +// VMConfig contains configurations that are passed on to CosmWasm VM. +type VMConfig struct { + // WasmLimits are the limits that are used for static validation of Wasm binaries. + WasmLimits wasmvmtypes.WasmLimits +} + // NodeConfig is the extra config required for wasm type NodeConfig struct { // SimulationGasLimit is the max gas to be used in a tx simulation call. From 0c551b936526bfe7cd0887a39d133355286c7d7b Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Fri, 11 Oct 2024 20:24:45 +0700 Subject: [PATCH 10/11] Fix typo --- x/wasm/keeper/keeper_cgo.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/wasm/keeper/keeper_cgo.go b/x/wasm/keeper/keeper_cgo.go index 23542266b..40c84668a 100644 --- a/x/wasm/keeper/keeper_cgo.go +++ b/x/wasm/keeper/keeper_cgo.go @@ -77,8 +77,8 @@ func NewKeeper( Cache: wasmvmtypes.CacheOptions{ BaseDir: filepath.Join(homeDir, "wasm"), AvailableCapabilities: availableCapabilities, - MemoryCacheSize: wasmvmtypes.NewSizeMebi(contractMemoryLimit), - InstanceMemoryLimit: wasmvmtypes.NewSizeMebi(nodeConfig.MemoryCacheSize), + MemoryCacheSize: wasmvmtypes.NewSizeMebi(nodeConfig.MemoryCacheSize), + InstanceMemoryLimit: wasmvmtypes.NewSizeMebi(contractMemoryLimit), }, WasmLimits: vmConfig.WasmLimits, }, nodeConfig.ContractDebugMode) From 930241d6093dfd5675b92c746089bb351c33582a Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Thu, 7 Nov 2024 21:47:12 +0700 Subject: [PATCH 11/11] Update to latest wasmvm code --- x/wasm/keeper/keeper_cgo.go | 8 ++++---- x/wasm/keeper/querier_test.go | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/x/wasm/keeper/keeper_cgo.go b/x/wasm/keeper/keeper_cgo.go index 40c84668a..180eb7b3c 100644 --- a/x/wasm/keeper/keeper_cgo.go +++ b/x/wasm/keeper/keeper_cgo.go @@ -75,10 +75,10 @@ func NewKeeper( var err error keeper.wasmVM, err = wasmvm.NewVMWithConfig(wasmvmtypes.VMConfig{ Cache: wasmvmtypes.CacheOptions{ - BaseDir: filepath.Join(homeDir, "wasm"), - AvailableCapabilities: availableCapabilities, - MemoryCacheSize: wasmvmtypes.NewSizeMebi(nodeConfig.MemoryCacheSize), - InstanceMemoryLimit: wasmvmtypes.NewSizeMebi(contractMemoryLimit), + BaseDir: filepath.Join(homeDir, "wasm"), + AvailableCapabilities: availableCapabilities, + MemoryCacheSizeBytes: wasmvmtypes.NewSizeMebi(nodeConfig.MemoryCacheSize), + InstanceMemoryLimitBytes: wasmvmtypes.NewSizeMebi(contractMemoryLimit), }, WasmLimits: vmConfig.WasmLimits, }, nodeConfig.ContractDebugMode) diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index 933f316e2..f35267f38 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -698,15 +698,15 @@ func TestQueryWasmLimitsConfig(t *testing.T) { }{ "all 15": { limits: wasmvmtypes.WasmLimits{ - InitialMemoryLimit: &fifteen, - TableSizeLimit: &fifteen, - MaxImports: &fifteen, - MaxFunctions: &fifteen, - MaxFunctionParams: &fifteen, - MaxTotalFunctionParams: &fifteen, - MaxFunctionResults: &fifteen, + InitialMemoryLimitPages: &fifteen, + TableSizeLimitElements: &fifteen, + MaxImports: &fifteen, + MaxFunctions: &fifteen, + MaxFunctionParams: &fifteen, + MaxTotalFunctionParams: &fifteen, + MaxFunctionResults: &fifteen, }, - expJSON: []byte(`{"initial_memory_limit":15,"table_size_limit":15,"max_imports":15,"max_functions":15,"max_function_params":15,"max_total_function_params":15,"max_function_results":15}`), + expJSON: []byte(`{"initial_memory_limit_pages":15,"table_size_limit_elements":15,"max_imports":15,"max_functions":15,"max_function_params":15,"max_total_function_params":15,"max_function_results":15}`), }, "empty": { limits: wasmvmtypes.WasmLimits{},