diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index f660cbbe90..6f9c6a879c 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -842,6 +842,7 @@ CodeInfoResponse contains code meta data from CodeInfo | `code_id` | [uint64](#uint64) | | id for legacy support | | `creator` | [string](#string) | | | | `data_hash` | [bytes](#bytes) | | | +| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | | diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index 8ec2c265fa..b7f7a0627f 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -183,6 +183,7 @@ message CodeInfoResponse { "github.com/tendermint/tendermint/libs/bytes.HexBytes" ]; // Used in v1beta1 reserved 4, 5; + AccessConfig instantiate_permission = 6 [ (gogoproto.nullable) = false ]; } // QueryCodeResponse is the response type for the Query/Code RPC method diff --git a/x/wasm/keeper/legacy_querier.go b/x/wasm/keeper/legacy_querier.go index f12e8b0ebc..a4dd3055aa 100644 --- a/x/wasm/keeper/legacy_querier.go +++ b/x/wasm/keeper/legacy_querier.go @@ -124,9 +124,10 @@ func queryCodeList(ctx sdk.Context, keeper types.ViewKeeper) ([]types.CodeInfoRe var info []types.CodeInfoResponse keeper.IterateCodeInfos(ctx, func(i uint64, res types.CodeInfo) bool { info = append(info, types.CodeInfoResponse{ - CodeID: i, - Creator: res.Creator, - DataHash: res.CodeHash, + CodeID: i, + Creator: res.Creator, + DataHash: res.CodeHash, + InstantiatePermission: res.InstantiateConfig, }) return false }) diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go index ae041aec1e..9b734d1870 100644 --- a/x/wasm/keeper/querier.go +++ b/x/wasm/keeper/querier.go @@ -239,9 +239,10 @@ func (q grpcQuerier) Codes(c context.Context, req *types.QueryCodesRequest) (*ty return false, err } r = append(r, types.CodeInfoResponse{ - CodeID: binary.BigEndian.Uint64(key), - Creator: c.Creator, - DataHash: c.CodeHash, + CodeID: binary.BigEndian.Uint64(key), + Creator: c.Creator, + DataHash: c.CodeHash, + InstantiatePermission: c.InstantiateConfig, }) } return true, nil @@ -275,9 +276,10 @@ func queryCode(ctx sdk.Context, codeID uint64, keeper types.ViewKeeper) (*types. return nil, nil } info := types.CodeInfoResponse{ - CodeID: codeID, - Creator: res.Creator, - DataHash: res.CodeHash, + CodeID: codeID, + Creator: res.Creator, + DataHash: res.CodeHash, + InstantiatePermission: res.InstantiateConfig, } code, err := keeper.GetByteCode(ctx, codeID) diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index 12208e2cd5..2541d487c5 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -655,6 +655,128 @@ func TestQueryPinnedCodes(t *testing.T) { } } +func TestQueryCodeInfo(t *testing.T) { + + wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + require.NoError(t, err) + + ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + keeper := keepers.WasmKeeper + + anyAddress, err := sdk.AccAddressFromBech32("cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz") + require.NoError(t, err) + specs := map[string]struct { + codeId uint64 + accessConfig types.AccessConfig + }{ + "everybody": { + codeId: 1, + accessConfig: types.AllowEverybody, + }, + "nobody": { + codeId: 10, + accessConfig: types.AllowNobody, + }, + "with_address": { + codeId: 20, + accessConfig: types.AccessTypeOnlyAddress.With(anyAddress), + }, + } + for msg, spec := range specs { + t.Run(msg, func(t *testing.T) { + codeInfo := types.CodeInfoFixture(types.WithSHA256CodeHash(wasmCode)) + codeInfo.InstantiateConfig = spec.accessConfig + require.NoError(t, keeper.importCode(ctx, spec.codeId, + codeInfo, + wasmCode), + ) + + q := Querier(keeper) + got, err := q.Code(sdk.WrapSDKContext(ctx), &types.QueryCodeRequest{ + CodeId: spec.codeId, + }) + require.NoError(t, err) + expectedResponse := &types.QueryCodeResponse{ + CodeInfoResponse: &types.CodeInfoResponse{ + CodeID: spec.codeId, + Creator: codeInfo.Creator, + DataHash: codeInfo.CodeHash, + InstantiatePermission: spec.accessConfig, + }, + Data: wasmCode, + } + require.NotNil(t, got.CodeInfoResponse) + require.EqualValues(t, expectedResponse, got) + }) + } +} + +func TestQueryCodeInfoList(t *testing.T) { + + wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + require.NoError(t, err) + + ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + keeper := keepers.WasmKeeper + + anyAddress, err := sdk.AccAddressFromBech32("cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz") + require.NoError(t, err) + codeInfoWithConfig := func(accessConfig types.AccessConfig) types.CodeInfo { + codeInfo := types.CodeInfoFixture(types.WithSHA256CodeHash(wasmCode)) + codeInfo.InstantiateConfig = accessConfig + return codeInfo + } + + codes := []struct { + name string + codeId uint64 + codeInfo types.CodeInfo + }{ + { + name: "everybody", + codeId: 1, + codeInfo: codeInfoWithConfig(types.AllowEverybody), + }, + { + codeId: 10, + name: "nobody", + codeInfo: codeInfoWithConfig(types.AllowNobody), + }, + { + name: "with_address", + codeId: 20, + codeInfo: codeInfoWithConfig(types.AccessTypeOnlyAddress.With(anyAddress)), + }, + } + + allCodesResponse := make([]types.CodeInfoResponse, 0) + for _, code := range codes { + t.Run(fmt.Sprintf("import_%s", code.name), func(t *testing.T) { + require.NoError(t, keeper.importCode(ctx, code.codeId, + code.codeInfo, + wasmCode), + ) + }) + + allCodesResponse = append(allCodesResponse, types.CodeInfoResponse{ + CodeID: code.codeId, + Creator: code.codeInfo.Creator, + DataHash: code.codeInfo.CodeHash, + InstantiatePermission: code.codeInfo.InstantiateConfig, + }) + } + q := Querier(keeper) + got, err := q.Codes(sdk.WrapSDKContext(ctx), &types.QueryCodesRequest{ + Pagination: &query.PageRequest{ + Limit: 3, + }, + }) + require.NoError(t, err) + require.Len(t, got.CodeInfos, 3) + require.EqualValues(t, allCodesResponse, got.CodeInfos) + +} + func fromBase64(s string) []byte { r, err := base64.StdEncoding.DecodeString(s) if err != nil { diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index 8506d32bb1..2b8efd6fdf 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -566,9 +566,10 @@ var xxx_messageInfo_QueryCodeRequest proto.InternalMessageInfo // CodeInfoResponse contains code meta data from CodeInfo type CodeInfoResponse struct { - CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"id"` - Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` - DataHash github_com_tendermint_tendermint_libs_bytes.HexBytes `protobuf:"bytes,3,opt,name=data_hash,json=dataHash,proto3,casttype=github.com/tendermint/tendermint/libs/bytes.HexBytes" json:"data_hash,omitempty"` + CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"id"` + Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` + DataHash github_com_tendermint_tendermint_libs_bytes.HexBytes `protobuf:"bytes,3,opt,name=data_hash,json=dataHash,proto3,casttype=github.com/tendermint/tendermint/libs/bytes.HexBytes" json:"data_hash,omitempty"` + InstantiatePermission AccessConfig `protobuf:"bytes,6,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission"` } func (m *CodeInfoResponse) Reset() { *m = CodeInfoResponse{} } @@ -828,79 +829,82 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/query.proto", fileDescriptor_9677c207036b9f2b) } var fileDescriptor_9677c207036b9f2b = []byte{ - // 1147 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0xa9, 0xe3, 0x1f, 0x93, 0xa0, 0x9a, 0x11, 0x6a, 0x8c, 0x49, 0x77, 0xa3, 0xa5,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 0xfc, 0x98, 0xe2, 0x0f, 0x71, 0x29, 0x21, 0xfe, 0xc7, 0xde, 0xfe, 0x2f, 0x00, - 0x00, 0xff, 0xff, 0x5a, 0x15, 0x21, 0x1e, 0x77, 0x0f, 0x00, 0x00, + // 1191 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0xcf, 0x4f, 0x24, 0x45, + 0x14, 0xc7, 0xa7, 0xd8, 0x61, 0x7e, 0x14, 0x98, 0x1d, 0x2b, 0x0a, 0xe3, 0xc8, 0x76, 0x93, 0x76, + 0x83, 0x2c, 0x8b, 0xdd, 0xc2, 0x42, 0x56, 0x4d, 0x8c, 0xd9, 0x61, 0x75, 0x81, 0x84, 0x84, 0xed, + 0x8d, 0xd9, 0xc4, 0x3d, 0x90, 0x9a, 0xe9, 0x62, 0xe8, 0x84, 0xe9, 0x1a, 0xba, 0x0a, 0xd8, 0x09, + 0x41, 0xcd, 0x26, 0x1e, 0x4c, 0x8c, 0x9a, 0x18, 0x8f, 0x46, 0x0f, 0x66, 0xf5, 0xac, 0x37, 0xff, + 0x02, 0x8e, 0x24, 0x5e, 0x3c, 0x4d, 0x74, 0xf0, 0x60, 0xf8, 0x13, 0xf6, 0x64, 0xaa, 0xba, 0x7a, + 0xe8, 0xf9, 0xd1, 0xcc, 0xb0, 0x21, 0x7b, 0x21, 0xdd, 0xd4, 0xab, 0x57, 0x9f, 0xf7, 0xed, 0x57, + 0xef, 0xbd, 0x81, 0x13, 0x65, 0xca, 0xaa, 0xfb, 0x98, 0x55, 0x2d, 0xf9, 0x67, 0x6f, 0xce, 0xda, + 0xd9, 0x25, 0x7e, 0xdd, 0xac, 0xf9, 0x94, 0x53, 0x94, 0x0b, 0x57, 0x4d, 0xf9, 0x67, 0x6f, 0xae, + 0xf0, 0x4a, 0x85, 0x56, 0xa8, 0x5c, 0xb4, 0xc4, 0x53, 0x60, 0x57, 0xe8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xd5, 0x35, 0x2c, 0x86, 0x3d, 0xd2, 0x3a, 0x50, 0x35, 0xef, + 0x10, 0x3d, 0x05, 0xf0, 0x6a, 0xc7, 0x70, 0x82, 0xde, 0xea, 0x73, 0x5c, 0xfb, 0x18, 0x55, 0x30, + 0x07, 0x35, 0x57, 0x80, 0x0b, 0x12, 0xd0, 0x44, 0xb3, 0x83, 0x00, 0x5a, 0x5b, 0x0a, 0xea, 0xe7, + 0x08, 0xa8, 0x9a, 0x07, 0xfa, 0x82, 0xb6, 0x0f, 0x2e, 0x7d, 0x41, 0x3b, 0xc6, 0x0c, 0x63, 0x5e, + 0x82, 0xce, 0xa2, 0x99, 0x5e, 0xa0, 0x0e, 0xb1, 0x0e, 0x54, 0x42, 0x1d, 0x5a, 0x67, 0xc3, 0xc7, + 0x2f, 0x00, 0xe6, 0x3a, 0x7b, 0x35, 0x8a, 0x3b, 0x38, 0x66, 0xae, 0x28, 0x58, 0x03, 0xdb, 0x0f, + 0x42, 0xda, 0x25, 0x29, 0x93, 0x50, 0xbf, 0x01, 0x98, 0xeb, 0xec, 0xad, 0xb1, 0xa4, 0x31, 0xdd, + 0x3d, 0x96, 0x34, 0xae, 0x69, 0x1b, 0xef, 0x4b, 0xd2, 0xdb, 0x68, 0x71, 0x20, 0x52, 0x1f, 0xef, + 0x5b, 0x07, 0x67, 0x4d, 0xf9, 0x10, 0xfd, 0x01, 0x20, 0xea, 0x6e, 0xb4, 0xe8, 0xed, 0x18, 0x8c, + 0xd8, 0x31, 0xa0, 0x30, 0x77, 0x81, 0x1d, 0x0a, 0xfd, 0x03, 0x89, 0xfe, 0x2e, 0xba, 0x3d, 0x98, + 0xc8, 0xc2, 0x51, 0x3b, 0x7c, 0x1d, 0x26, 0x65, 0xda, 0x1a, 0xb1, 0x79, 0x78, 0x96, 0xab, 0x6f, + 0x9c, 0x6b, 0xa3, 0x88, 0xa6, 0x25, 0x91, 0x81, 0x26, 0xfb, 0x25, 0x28, 0xf2, 0xe1, 0xb0, 0x2c, + 0x87, 0xe8, 0x3c, 0xbf, 0x61, 0x41, 0x2e, 0x5c, 0x3f, 0xdf, 0x48, 0x9d, 0xae, 0xc9, 0xd3, 0xf3, + 0x68, 0xac, 0xf7, 0xe9, 0xe8, 0x2b, 0x00, 0x47, 0x22, 0x95, 0x18, 0xdd, 0x88, 0xf1, 0xda, 0xdd, + 0x11, 0x0a, 0x33, 0x83, 0x98, 0x2a, 0x8c, 0x29, 0x89, 0x31, 0x89, 0xb4, 0xde, 0x18, 0xcc, 0xaa, + 0xc9, 0x4d, 0xc5, 0xe5, 0xa3, 0x7f, 0xb4, 0xc4, 0xaf, 0x4d, 0x2d, 0x71, 0xd4, 0xd4, 0xc0, 0x71, + 0x53, 0x03, 0x7f, 0x37, 0x35, 0xf0, 0xed, 0x89, 0x96, 0x38, 0x3e, 0xd1, 0x12, 0x7f, 0x9d, 0x68, + 0x89, 0x4f, 0xa6, 0x22, 0xc3, 0xcd, 0x12, 0x65, 0xd5, 0x87, 0xa1, 0x2f, 0xc7, 0x7a, 0x1c, 0xf8, + 0x94, 0xbf, 0xb6, 0x4b, 0x29, 0xf9, 0x23, 0xf9, 0xd6, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe8, + 0x7b, 0x25, 0x05, 0xd4, 0x0f, 0x00, 0x00, } func (this *QueryContractInfoResponse) Equal(that interface{}) bool { @@ -958,6 +962,9 @@ func (this *CodeInfoResponse) Equal(that interface{}) bool { if !bytes.Equal(this.DataHash, that1.DataHash) { return false } + if !this.InstantiatePermission.Equal(&that1.InstantiatePermission) { + return false + } return true } func (this *QueryCodeResponse) Equal(that interface{}) bool { @@ -1892,6 +1899,16 @@ func (m *CodeInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.InstantiatePermission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 if len(m.DataHash) > 0 { i -= len(m.DataHash) copy(dAtA[i:], m.DataHash) @@ -2108,20 +2125,20 @@ func (m *QueryPinnedCodesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error dAtA[i] = 0x12 } if len(m.CodeIDs) > 0 { - dAtA14 := make([]byte, len(m.CodeIDs)*10) - var j13 int + dAtA15 := make([]byte, len(m.CodeIDs)*10) + var j14 int for _, num := range m.CodeIDs { for num >= 1<<7 { - dAtA14[j13] = uint8(uint64(num)&0x7f | 0x80) + dAtA15[j14] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j13++ + j14++ } - dAtA14[j13] = uint8(num) - j13++ + dAtA15[j14] = uint8(num) + j14++ } - i -= j13 - copy(dAtA[i:], dAtA14[:j13]) - i = encodeVarintQuery(dAtA, i, uint64(j13)) + i -= j14 + copy(dAtA[i:], dAtA15[:j14]) + i = encodeVarintQuery(dAtA, i, uint64(j14)) i-- dAtA[i] = 0xa } @@ -2363,6 +2380,8 @@ func (m *CodeInfoResponse) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = m.InstantiatePermission.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -3933,6 +3952,39 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { m.DataHash = []byte{} } iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InstantiatePermission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InstantiatePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:])