diff --git a/proto/panacea/datadeal/v2/query.proto b/proto/panacea/datadeal/v2/query.proto index a2df3b12..20c4527e 100644 --- a/proto/panacea/datadeal/v2/query.proto +++ b/proto/panacea/datadeal/v2/query.proto @@ -40,7 +40,7 @@ message QueryDealsRequest { // QueryDealsResponse defines the response type for the Query/Deals RPC method. message QueryDealsResponse { - repeated Deal deal = 1; + repeated Deal deals = 1; cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/types/testsuite/suite.go b/types/testsuite/suite.go index c4e280a4..f0c25ea8 100644 --- a/types/testsuite/suite.go +++ b/types/testsuite/suite.go @@ -221,6 +221,7 @@ func (suite *TestSuite) SetupTest() { memKeys[oracletypes.MemStoreKey], paramsKeeper.Subspace(oracletypes.ModuleName), ) + suite.OracleMsgServer = oraclekeeper.NewMsgServerImpl(suite.OracleKeeper) suite.DataDealKeeper = *datadealkeeper.NewKeeper( cdc.Marshaler, @@ -231,8 +232,6 @@ func (suite *TestSuite) SetupTest() { suite.OracleKeeper, ) suite.DataDealMsgServer = datadealkeeper.NewMsgServerImpl(suite.DataDealKeeper) - - suite.OracleMsgServer = oraclekeeper.NewMsgServerImpl(suite.OracleKeeper) } func (suite *TestSuite) BeforeTest(suiteName, testName string) { diff --git a/x/datadeal/client/cli/query.go b/x/datadeal/client/cli/query.go index 277ce4c1..61c9c9a2 100644 --- a/x/datadeal/client/cli/query.go +++ b/x/datadeal/client/cli/query.go @@ -19,8 +19,10 @@ func GetQueryCmd(queryRoute string) *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(CmdGetDeal()) cmd.AddCommand(CmdGetDeals()) + cmd.AddCommand(CmdGetDeal()) + cmd.AddCommand(CmdGetCertificates()) + cmd.AddCommand(CmdGetCertificate()) return cmd } diff --git a/x/datadeal/client/cli/queryCertificate.go b/x/datadeal/client/cli/queryCertificate.go new file mode 100644 index 00000000..701a79e4 --- /dev/null +++ b/x/datadeal/client/cli/queryCertificate.go @@ -0,0 +1,87 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/medibloc/panacea-core/v2/x/datadeal/types" + "github.com/spf13/cobra" +) + +func CmdGetCertificates() *cobra.Command { + cmd := &cobra.Command{ + Use: "certificates [deal-id]", + Short: "Query certificates", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + dealID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + + req := &types.QueryCertificates{ + DealId: dealID, + Pagination: pageReq, + } + res, err := queryClient.Certificates(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdGetCertificate() *cobra.Command { + cmd := &cobra.Command{ + Use: "certificate [deal-id] [data-hash]", + Short: "Query a certificate info", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + dealID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + + req := &types.QueryCertificate{ + DealId: dealID, + DataHash: args[1], + } + res, err := queryClient.Certificate(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} \ No newline at end of file diff --git a/x/datadeal/keeper/grpc_query_deal.go b/x/datadeal/keeper/grpc_query_deal.go index 2bef49a1..fb56b0ab 100644 --- a/x/datadeal/keeper/grpc_query_deal.go +++ b/x/datadeal/keeper/grpc_query_deal.go @@ -52,17 +52,53 @@ func (k Keeper) Deals(goCtx context.Context, req *types.QueryDealsRequest) (*typ } return &types.QueryDealsResponse{ - Deal: deals, + Deals: deals, Pagination: pageRes, }, nil } -func (k Keeper) Certificates(ctx context.Context, certificates *types.QueryCertificates) (*types.QueryCertificatesResponse, error) { - //TODO implement me - panic("implement me") +func (k Keeper) Certificates(goCtx context.Context, req *types.QueryCertificates) (*types.QueryCertificatesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + store := ctx.KVStore(k.storeKey) + + certsStore := prefix.NewStore(store, append(types.CertificateKey, sdk.Uint64ToBigEndian(req.DealId)...)) + + var certs []*types.Certificate + pageRes, err := query.Paginate(certsStore, req.Pagination, func(_ []byte, value []byte) error { + var cert types.Certificate + err := k.cdc.UnmarshalLengthPrefixed(value, &cert) + if err != nil { + return err + } + certs = append(certs, &cert) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryCertificatesResponse{ + Certificates: certs, + Pagination: pageRes, + }, nil } -func (k Keeper) Certificate(ctx context.Context, certificate *types.QueryCertificate) (*types.QueryCertificateResponse, error) { - //TODO implement me - panic("implement me") +func (k Keeper) Certificate(goCtx context.Context, req *types.QueryCertificate) (*types.QueryCertificateResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + cert, err := k.GetCertificate(sdk.UnwrapSDKContext(goCtx), req.DealId, req.DataHash) + if err != nil { + return nil, err + } + + return &types.QueryCertificateResponse{ + Certificate: cert, + }, nil } diff --git a/x/datadeal/keeper/grpc_query_deal_test.go b/x/datadeal/keeper/grpc_query_deal_test.go index 8fbd3071..f8d7fc00 100644 --- a/x/datadeal/keeper/grpc_query_deal_test.go +++ b/x/datadeal/keeper/grpc_query_deal_test.go @@ -3,7 +3,9 @@ package keeper_test import ( "testing" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" "github.com/medibloc/panacea-core/v2/x/datadeal/testutil" "github.com/medibloc/panacea-core/v2/x/datadeal/types" "github.com/stretchr/testify/suite" @@ -12,6 +14,8 @@ import ( type queryDealTestSuite struct { testutil.DataDealBaseTestSuite + oracleAccAddr sdk.AccAddress + providerAccAddr sdk.AccAddress consumerAccAddr sdk.AccAddress } @@ -19,6 +23,12 @@ func TestQueryDealTest(t *testing.T) { suite.Run(t, new(queryDealTestSuite)) } +func (suite *queryDealTestSuite) BeforeTest(_, _ string) { + suite.oracleAccAddr = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) + suite.providerAccAddr = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) + suite.consumerAccAddr = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) +} + func (suite *queryDealTestSuite) TestQueryDeal() { deal := suite.MakeTestDeal(1, suite.consumerAccAddr, 100) err := suite.DataDealKeeper.SetDeal(suite.Ctx, deal) @@ -36,24 +46,104 @@ func (suite *queryDealTestSuite) TestQueryDeal() { } func (suite *queryDealTestSuite) TestQueryDeals() { - deal1 := suite.MakeTestDeal(1, suite.consumerAccAddr, 100) - err := suite.DataDealKeeper.SetDeal(suite.Ctx, deal1) + deal := suite.MakeTestDeal(1, suite.consumerAccAddr, 100) + err := suite.DataDealKeeper.SetDeal(suite.Ctx, deal) suite.Require().NoError(err) - deal2 := suite.MakeTestDeal(2, suite.consumerAccAddr, 100) + deal2 := suite.MakeTestDeal(2, suite.consumerAccAddr, 10) err = suite.DataDealKeeper.SetDeal(suite.Ctx, deal2) suite.Require().NoError(err) - deal3 := suite.MakeTestDeal(3, suite.consumerAccAddr, 100) - err = suite.DataDealKeeper.SetDeal(suite.Ctx, deal3) + req := types.QueryDealsRequest{} + res, err := suite.DataDealKeeper.Deals(sdk.WrapSDKContext(suite.Ctx), &req) suite.Require().NoError(err) + suite.Require().NotNil(res) + suite.Require().Equal(2, len(res.Deals)) + suite.Require().Equal(deal, res.Deals[0]) + suite.Require().Equal(deal2, res.Deals[1]) +} - req := types.QueryDealsRequest{} +func (suite *queryDealTestSuite) TestQueryCert() { + cert := &types.Certificate{ + UnsignedCertificate: &types.UnsignedCertificate{ + Cid: "cid1", + OracleAddress: suite.oracleAccAddr.String(), + DealId: 1, + ProviderAddress: suite.providerAccAddr.String(), + DataHash: "dataHash", + }, + Signature: []byte("signature"), + } - res, err := suite.DataDealKeeper.Deals(sdk.WrapSDKContext(suite.Ctx), &req) + err := suite.DataDealKeeper.SetCertificate(suite.Ctx, cert) + suite.Require().NoError(err) + + req := &types.QueryCertificate{ + DealId: cert.UnsignedCertificate.DealId, + DataHash: cert.UnsignedCertificate.DataHash, + } + res, err := suite.DataDealKeeper.Certificate(sdk.WrapSDKContext(suite.Ctx), req) suite.Require().NoError(err) - suite.Require().Len(res.Deal, 3) - suite.Require().Equal(res.Deal[0].Address, deal1.Address) - suite.Require().Equal(res.Deal[1].Address, deal2.Address) - suite.Require().Equal(res.Deal[2].Address, deal3.Address) + suite.Require().NotNil(res) + suite.Require().Equal(cert, res.Certificate) } + +func (suite *queryDealTestSuite) TestQueryCerts() { + cert := &types.Certificate{ + UnsignedCertificate: &types.UnsignedCertificate{ + Cid: "cid1", + OracleAddress: suite.oracleAccAddr.String(), + DealId: 1, + ProviderAddress: suite.providerAccAddr.String(), + DataHash: "dataHash", + }, + Signature: []byte("signature"), + } + + err := suite.DataDealKeeper.SetCertificate(suite.Ctx, cert) + suite.Require().NoError(err) + + cert2 := &types.Certificate{ + UnsignedCertificate: &types.UnsignedCertificate{ + Cid: "cid2", + OracleAddress: suite.oracleAccAddr.String(), + DealId: 1, + ProviderAddress: suite.providerAccAddr.String(), + DataHash: "dataHash2", + }, + Signature: []byte("signature"), + } + + err = suite.DataDealKeeper.SetCertificate(suite.Ctx, cert2) + suite.Require().NoError(err) + + cert3 := &types.Certificate{ + UnsignedCertificate: &types.UnsignedCertificate{ + Cid: "cid2", + OracleAddress: suite.oracleAccAddr.String(), + DealId: 2, + ProviderAddress: suite.providerAccAddr.String(), + DataHash: "dataHash2", + }, + Signature: []byte("signature"), + } + + err = suite.DataDealKeeper.SetCertificate(suite.Ctx, cert3) + suite.Require().NoError(err) + + req := &types.QueryCertificates{ + DealId: 1, + Pagination: &query.PageRequest{}, + } + res, err := suite.DataDealKeeper.Certificates(sdk.WrapSDKContext(suite.Ctx), req) + suite.Require().NoError(err) + suite.Require().Equal(2, len(res.Certificates)) + suite.Require().Equal(cert, res.Certificates[0]) + suite.Require().Equal(cert2, res.Certificates[1]) + + req.DealId = 2 + res, err = suite.DataDealKeeper.Certificates(sdk.WrapSDKContext(suite.Ctx), req) + suite.Require().NoError(err) + suite.Require().Equal(1, len(res.Certificates)) + suite.Require().Equal(cert3, res.Certificates[0]) +} \ No newline at end of file diff --git a/x/datadeal/types/deal.go b/x/datadeal/types/deal.go index f6b5e8f7..1befa8f5 100644 --- a/x/datadeal/types/deal.go +++ b/x/datadeal/types/deal.go @@ -69,4 +69,4 @@ func (m *Deal) GetPricePerData() sdk.Dec { func (m *Deal) IncreaseCurNumData() { m.CurNumData += 1 -} +} \ No newline at end of file diff --git a/x/datadeal/types/query.pb.go b/x/datadeal/types/query.pb.go index b708a0d3..fea9090a 100644 --- a/x/datadeal/types/query.pb.go +++ b/x/datadeal/types/query.pb.go @@ -77,7 +77,7 @@ func (m *QueryDealsRequest) GetPagination() *query.PageRequest { // QueryDealsResponse defines the response type for the Query/Deals RPC method. type QueryDealsResponse struct { - Deal []*Deal `protobuf:"bytes,1,rep,name=deal,proto3" json:"deal,omitempty"` + Deals []*Deal `protobuf:"bytes,1,rep,name=deals,proto3" json:"deals,omitempty"` Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -114,9 +114,9 @@ func (m *QueryDealsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDealsResponse proto.InternalMessageInfo -func (m *QueryDealsResponse) GetDeal() []*Deal { +func (m *QueryDealsResponse) GetDeals() []*Deal { if m != nil { - return m.Deal + return m.Deals } return nil } @@ -436,44 +436,45 @@ func init() { func init() { proto.RegisterFile("panacea/datadeal/v2/query.proto", fileDescriptor_4c7a445ecc4b9161) } var fileDescriptor_4c7a445ecc4b9161 = []byte{ - // 588 bytes of a gzipped FileDescriptorProto + // 594 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4f, 0x6f, 0x12, 0x4f, - 0x18, 0xc7, 0x19, 0x7e, 0xb4, 0x3f, 0x3b, 0xf4, 0xa0, 0xa3, 0x89, 0x74, 0x6d, 0x56, 0xb2, 0x11, - 0xda, 0xa8, 0xcc, 0x04, 0x7a, 0xf2, 0x60, 0x4c, 0xb0, 0x6a, 0x8d, 0x17, 0xdd, 0xa3, 0x26, 0x36, - 0xc3, 0x32, 0x2e, 0x9b, 0xc0, 0xce, 0x96, 0x19, 0x88, 0x4d, 0xed, 0x45, 0xaf, 0x1e, 0x4c, 0x7c, - 0x05, 0x5e, 0xfb, 0x4a, 0x3c, 0x36, 0xf1, 0xe2, 0xc1, 0x83, 0x01, 0x5f, 0x88, 0xd9, 0xd9, 0x61, - 0x19, 0xda, 0xa5, 0xa0, 0xf1, 0x06, 0x3c, 0xdf, 0xe7, 0xf9, 0x7e, 0x9e, 0x3f, 0x03, 0xbc, 0x19, - 0xd1, 0x90, 0x7a, 0x8c, 0x92, 0x36, 0x95, 0xb4, 0xcd, 0x68, 0x97, 0x0c, 0x1b, 0xe4, 0x60, 0xc0, - 0xfa, 0x87, 0x38, 0xea, 0x73, 0xc9, 0xd1, 0x55, 0x2d, 0xc0, 0x13, 0x01, 0x1e, 0x36, 0xac, 0x6b, - 0x3e, 0xf7, 0xb9, 0x8a, 0x93, 0xf8, 0x53, 0x22, 0xb5, 0x6e, 0x7b, 0x5c, 0xf4, 0xb8, 0x20, 0x2d, - 0x2a, 0x58, 0x52, 0x83, 0x0c, 0xeb, 0x2d, 0x26, 0x69, 0x9d, 0x44, 0xd4, 0x0f, 0x42, 0x2a, 0x03, - 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 0x91, 0x9e, + 0x02, 0x58, 0x48, 0xdf, 0x55, 0x79, 0x25, 0x6b, 0xab, 0xba, 0x92, 0x2c, 0x01, 0x7c, 0xa4, 0x01, + 0x1f, 0xa0, 0xfb, 0x7f, 0x0c, 0x48, 0x8e, 0x93, 0x6b, 0x3e, 0x69, 0x3c, 0xfb, 0x3a, 0xb4, 0xc1, + 0xd9, 0xd0, 0x06, 0x3f, 0x87, 0x36, 0xf8, 0x34, 0xb2, 0x33, 0x67, 0x23, 0x3b, 0xf3, 0x7d, 0x64, + 0x67, 0x5e, 0xd6, 0xfc, 0x40, 0xb6, 0xfb, 0x4d, 0xec, 0xf1, 0x2e, 0xe9, 0xb2, 0x56, 0xd0, 0xec, + 0x70, 0x6f, 0xec, 0x55, 0xf5, 0x78, 0x8f, 0x91, 0xb7, 0x13, 0x4b, 0x79, 0x14, 0x31, 0xd1, 0x5c, + 0xd3, 0x7f, 0xef, 0xbb, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x41, 0x61, 0x95, 0x46, 0xbd, 0x06, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -739,10 +740,10 @@ func (m *QueryDealsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Deal) > 0 { - for iNdEx := len(m.Deal) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Deals) > 0 { + for iNdEx := len(m.Deals) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Deal[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Deals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1008,8 +1009,8 @@ func (m *QueryDealsResponse) Size() (n int) { } var l int _ = l - if len(m.Deal) > 0 { - for _, e := range m.Deal { + if len(m.Deals) > 0 { + for _, e := range m.Deals { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -1233,7 +1234,7 @@ func (m *QueryDealsResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deal", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Deals", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1260,8 +1261,8 @@ func (m *QueryDealsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Deal = append(m.Deal, &Deal{}) - if err := m.Deal[len(m.Deal)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Deals = append(m.Deals, &Deal{}) + if err := m.Deals[len(m.Deals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex