From ed927bcc63bd60e3cdb6d94077b7074932096c78 Mon Sep 17 00:00:00 2001 From: hunjixin <1084400399@qq.com> Date: Wed, 16 Mar 2022 11:40:25 +0800 Subject: [PATCH 1/4] new method for import published deal --- venus-shared/api/market/api.go | 1 + venus-shared/api/market/method.md | 72 ++++++++++++++++++++ venus-shared/api/market/mock/mock_imarket.go | 14 ++++ venus-shared/api/market/proxy_gen.go | 4 ++ 4 files changed, 91 insertions(+) diff --git a/venus-shared/api/market/api.go b/venus-shared/api/market/api.go index 0f4e861568..060720a8dd 100644 --- a/venus-shared/api/market/api.go +++ b/venus-shared/api/market/api.go @@ -26,6 +26,7 @@ type IMarket interface { ActorSectorSize(context.Context, address.Address) (abi.SectorSize, error) //perm:read MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write + MarketImportPublishedDeal(ctx context.Context, id string, deal market.MinerDeal) error //perm:write MarketListDeals(ctx context.Context, addrs []address.Address) ([]types.MarketDeal, error) //perm:read MarketListRetrievalDeals(ctx context.Context, mAddr address.Address) ([]market.ProviderDealState, error) //perm:read MarketGetDealUpdates(ctx context.Context) (<-chan market.MinerDeal, error) //perm:read diff --git a/venus-shared/api/market/method.md b/venus-shared/api/market/method.md index 7e20f151d0..13307f300b 100644 --- a/venus-shared/api/market/method.md +++ b/venus-shared/api/market/method.md @@ -41,6 +41,7 @@ * [MarketGetReserved](#MarketGetReserved) * [MarketGetRetrievalAsk](#MarketGetRetrievalAsk) * [MarketImportDealData](#MarketImportDealData) + * [MarketImportPublishedDeal](#MarketImportPublishedDeal) * [MarketListAsk](#MarketListAsk) * [MarketListDataTransfers](#MarketListDataTransfers) * [MarketListDeals](#MarketListDeals) @@ -900,6 +901,77 @@ Inputs: Response: `{}` +### MarketImportPublishedDeal + + +Perms: write + +Inputs: +```json +[ + "string value", + { + "Proposal": { + "PieceCID": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "PieceSize": 1032, + "VerifiedDeal": true, + "Client": "f01234", + "Provider": "f01234", + "Label": "string value", + "StartEpoch": 10101, + "EndEpoch": 10101, + "StoragePricePerEpoch": "0", + "ProviderCollateral": "0", + "ClientCollateral": "0" + }, + "ClientSignature": { + "Type": 2, + "Data": "Ynl0ZSBhcnJheQ==" + }, + "ProposalCid": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "AddFundsCid": null, + "PublishCid": null, + "Miner": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", + "Client": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", + "State": 42, + "PiecePath": "/some/path", + "PayloadSize": 1024, + "MetadataPath": "/some/path", + "SlashEpoch": 10101, + "FastRetrieval": true, + "Message": "string value", + "FundsReserved": "0", + "Ref": { + "TransferType": "string value", + "Root": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "PieceCid": null, + "PieceSize": 1024, + "RawBlockSize": 42 + }, + "AvailableForRetrieval": true, + "DealID": 5432, + "CreationTime": "0001-01-01T00:00:00Z", + "TransferChannelId": { + "Initiator": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", + "Responder": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", + "ID": 3 + }, + "SectorNumber": 9, + "Offset": 1032, + "PieceStatus": "string value", + "InboundCAR": "string value" + } +] +``` + +Response: `{}` + ### MarketListAsk diff --git a/venus-shared/api/market/mock/mock_imarket.go b/venus-shared/api/market/mock/mock_imarket.go index d52208c291..91b146bc8b 100644 --- a/venus-shared/api/market/mock/mock_imarket.go +++ b/venus-shared/api/market/mock/mock_imarket.go @@ -635,6 +635,20 @@ func (mr *MockIMarketMockRecorder) MarketImportDealData(arg0, arg1, arg2 interfa return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarketImportDealData", reflect.TypeOf((*MockIMarket)(nil).MarketImportDealData), arg0, arg1, arg2) } +// MarketImportPublishedDeal mocks base method. +func (m *MockIMarket) MarketImportPublishedDeal(arg0 context.Context, arg1 string, arg2 market.MinerDeal) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MarketImportPublishedDeal", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// MarketImportPublishedDeal indicates an expected call of MarketImportPublishedDeal. +func (mr *MockIMarketMockRecorder) MarketImportPublishedDeal(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarketImportPublishedDeal", reflect.TypeOf((*MockIMarket)(nil).MarketImportPublishedDeal), arg0, arg1, arg2) +} + // MarketListAsk mocks base method. func (m *MockIMarket) MarketListAsk(arg0 context.Context) ([]*storagemarket.SignedStorageAsk, error) { m.ctrl.T.Helper() diff --git a/venus-shared/api/market/proxy_gen.go b/venus-shared/api/market/proxy_gen.go index 7d76d68964..be8e9d183a 100644 --- a/venus-shared/api/market/proxy_gen.go +++ b/venus-shared/api/market/proxy_gen.go @@ -62,6 +62,7 @@ type IMarketStruct struct { MarketGetReserved func(ctx context.Context, addr address.Address) (types.BigInt, error) `perm:"sign"` MarketGetRetrievalAsk func(ctx context.Context, mAddr address.Address) (*retrievalmarket.Ask, error) `perm:"read"` MarketImportDealData func(ctx context.Context, propcid cid.Cid, path string) error `perm:"write"` + MarketImportPublishedDeal func(ctx context.Context, id string, deal market.MinerDeal) error `perm:"write"` MarketListAsk func(ctx context.Context) ([]*storagemarket.SignedStorageAsk, error) `perm:"read"` MarketListDataTransfers func(ctx context.Context) ([]market.DataTransferChannel, error) `perm:"write"` MarketListDeals func(ctx context.Context, addrs []address.Address) ([]types.MarketDeal, error) `perm:"read"` @@ -212,6 +213,9 @@ func (s *IMarketStruct) MarketGetRetrievalAsk(p0 context.Context, p1 address.Add func (s *IMarketStruct) MarketImportDealData(p0 context.Context, p1 cid.Cid, p2 string) error { return s.Internal.MarketImportDealData(p0, p1, p2) } +func (s *IMarketStruct) MarketImportPublishedDeal(p0 context.Context, p1 string, p2 market.MinerDeal) error { + return s.Internal.MarketImportPublishedDeal(p0, p1, p2) +} func (s *IMarketStruct) MarketListAsk(p0 context.Context) ([]*storagemarket.SignedStorageAsk, error) { return s.Internal.MarketListAsk(p0) } From ac42c2042939071b17f0cb7a82c9eafa37359f65 Mon Sep 17 00:00:00 2001 From: hunjixin <1084400399@qq.com> Date: Wed, 16 Mar 2022 15:12:42 +0800 Subject: [PATCH 2/4] alias piecestatus payloadsize --- venus-devtool/api-gen/example.go | 14 ++++++++------ venus-shared/api/market/api.go | 2 +- venus-shared/api/market/method.md | 13 ++++++------- venus-shared/api/market/mock/mock_imarket.go | 8 ++++---- venus-shared/api/market/proxy_gen.go | 6 +++--- venus-shared/types/market/assigner_type.go | 10 ++++++---- venus-shared/types/market/cbor_gen.go | 12 ++++++------ venus-shared/types/market/miner_deal.go | 4 ++-- 8 files changed, 36 insertions(+), 33 deletions(-) diff --git a/venus-devtool/api-gen/example.go b/venus-devtool/api-gen/example.go index 8f318cf217..6958ec9b59 100644 --- a/venus-devtool/api-gen/example.go +++ b/venus-devtool/api-gen/example.go @@ -17,6 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/exitcode" + "github.com/filecoin-project/venus/venus-shared/types/market" "github.com/ipfs/go-cid" "github.com/ipfs/go-graphsync" textselector "github.com/ipld/go-ipld-selector-text-lite" @@ -36,12 +37,13 @@ import ( ) var ExampleValues = map[reflect.Type]interface{}{ - reflect.TypeOf(auth.Permission("")): auth.Permission("write"), - reflect.TypeOf(""): "string value", - reflect.TypeOf(uint64(42)): uint64(42), - reflect.TypeOf(uint(42)): uint(42), - reflect.TypeOf(byte(7)): byte(7), - reflect.TypeOf([]byte{}): []byte("byte array"), + reflect.TypeOf(auth.Permission("")): auth.Permission("write"), + reflect.TypeOf(""): "string value", + reflect.TypeOf(market.PieceStatus("")): market.Undefine, + reflect.TypeOf(uint64(42)): uint64(42), + reflect.TypeOf(uint(42)): uint(42), + reflect.TypeOf(byte(7)): byte(7), + reflect.TypeOf([]byte{}): []byte("byte array"), } func addExample(v interface{}) { diff --git a/venus-shared/api/market/api.go b/venus-shared/api/market/api.go index 060720a8dd..8021ba31b0 100644 --- a/venus-shared/api/market/api.go +++ b/venus-shared/api/market/api.go @@ -26,7 +26,7 @@ type IMarket interface { ActorSectorSize(context.Context, address.Address) (abi.SectorSize, error) //perm:read MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write - MarketImportPublishedDeal(ctx context.Context, id string, deal market.MinerDeal) error //perm:write + MarketImportPublishedDeal(ctx context.Context, deal market.MinerDeal) error //perm:write MarketListDeals(ctx context.Context, addrs []address.Address) ([]types.MarketDeal, error) //perm:read MarketListRetrievalDeals(ctx context.Context, mAddr address.Address) ([]market.ProviderDealState, error) //perm:read MarketGetDealUpdates(ctx context.Context) (<-chan market.MinerDeal, error) //perm:read diff --git a/venus-shared/api/market/method.md b/venus-shared/api/market/method.md index 13307f300b..ec2d81afff 100644 --- a/venus-shared/api/market/method.md +++ b/venus-shared/api/market/method.md @@ -818,7 +818,7 @@ Response: "Client": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", "State": 42, "PiecePath": "/some/path", - "PayloadSize": 1024, + "PayloadSize": 42, "MetadataPath": "/some/path", "SlashEpoch": 10101, "FastRetrieval": true, @@ -843,7 +843,7 @@ Response: }, "SectorNumber": 9, "Offset": 1032, - "PieceStatus": "string value", + "PieceStatus": "Undefine", "InboundCAR": "string value" } ``` @@ -909,7 +909,6 @@ Perms: write Inputs: ```json [ - "string value", { "Proposal": { "PieceCID": { @@ -939,7 +938,7 @@ Inputs: "Client": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", "State": 42, "PiecePath": "/some/path", - "PayloadSize": 1024, + "PayloadSize": 42, "MetadataPath": "/some/path", "SlashEpoch": 10101, "FastRetrieval": true, @@ -964,7 +963,7 @@ Inputs: }, "SectorNumber": 9, "Offset": 1032, - "PieceStatus": "string value", + "PieceStatus": "Undefine", "InboundCAR": "string value" } ] @@ -1129,7 +1128,7 @@ Response: "Client": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", "State": 42, "PiecePath": "/some/path", - "PayloadSize": 1024, + "PayloadSize": 42, "MetadataPath": "/some/path", "SlashEpoch": 10101, "FastRetrieval": true, @@ -1154,7 +1153,7 @@ Response: }, "SectorNumber": 9, "Offset": 1032, - "PieceStatus": "string value", + "PieceStatus": "Undefine", "InboundCAR": "string value" } ] diff --git a/venus-shared/api/market/mock/mock_imarket.go b/venus-shared/api/market/mock/mock_imarket.go index 91b146bc8b..83e4e33145 100644 --- a/venus-shared/api/market/mock/mock_imarket.go +++ b/venus-shared/api/market/mock/mock_imarket.go @@ -636,17 +636,17 @@ func (mr *MockIMarketMockRecorder) MarketImportDealData(arg0, arg1, arg2 interfa } // MarketImportPublishedDeal mocks base method. -func (m *MockIMarket) MarketImportPublishedDeal(arg0 context.Context, arg1 string, arg2 market.MinerDeal) error { +func (m *MockIMarket) MarketImportPublishedDeal(arg0 context.Context, arg1 market.MinerDeal) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MarketImportPublishedDeal", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "MarketImportPublishedDeal", arg0, arg1) ret0, _ := ret[0].(error) return ret0 } // MarketImportPublishedDeal indicates an expected call of MarketImportPublishedDeal. -func (mr *MockIMarketMockRecorder) MarketImportPublishedDeal(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockIMarketMockRecorder) MarketImportPublishedDeal(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarketImportPublishedDeal", reflect.TypeOf((*MockIMarket)(nil).MarketImportPublishedDeal), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarketImportPublishedDeal", reflect.TypeOf((*MockIMarket)(nil).MarketImportPublishedDeal), arg0, arg1) } // MarketListAsk mocks base method. diff --git a/venus-shared/api/market/proxy_gen.go b/venus-shared/api/market/proxy_gen.go index be8e9d183a..83774136de 100644 --- a/venus-shared/api/market/proxy_gen.go +++ b/venus-shared/api/market/proxy_gen.go @@ -62,7 +62,7 @@ type IMarketStruct struct { MarketGetReserved func(ctx context.Context, addr address.Address) (types.BigInt, error) `perm:"sign"` MarketGetRetrievalAsk func(ctx context.Context, mAddr address.Address) (*retrievalmarket.Ask, error) `perm:"read"` MarketImportDealData func(ctx context.Context, propcid cid.Cid, path string) error `perm:"write"` - MarketImportPublishedDeal func(ctx context.Context, id string, deal market.MinerDeal) error `perm:"write"` + MarketImportPublishedDeal func(ctx context.Context, deal market.MinerDeal) error `perm:"write"` MarketListAsk func(ctx context.Context) ([]*storagemarket.SignedStorageAsk, error) `perm:"read"` MarketListDataTransfers func(ctx context.Context) ([]market.DataTransferChannel, error) `perm:"write"` MarketListDeals func(ctx context.Context, addrs []address.Address) ([]types.MarketDeal, error) `perm:"read"` @@ -213,8 +213,8 @@ func (s *IMarketStruct) MarketGetRetrievalAsk(p0 context.Context, p1 address.Add func (s *IMarketStruct) MarketImportDealData(p0 context.Context, p1 cid.Cid, p2 string) error { return s.Internal.MarketImportDealData(p0, p1, p2) } -func (s *IMarketStruct) MarketImportPublishedDeal(p0 context.Context, p1 string, p2 market.MinerDeal) error { - return s.Internal.MarketImportPublishedDeal(p0, p1, p2) +func (s *IMarketStruct) MarketImportPublishedDeal(p0 context.Context, p1 market.MinerDeal) error { + return s.Internal.MarketImportPublishedDeal(p0, p1) } func (s *IMarketStruct) MarketListAsk(p0 context.Context) ([]*storagemarket.SignedStorageAsk, error) { return s.Internal.MarketListAsk(p0) diff --git a/venus-shared/types/market/assigner_type.go b/venus-shared/types/market/assigner_type.go index 54af7a4d3a..ee3c5a4235 100644 --- a/venus-shared/types/market/assigner_type.go +++ b/venus-shared/types/market/assigner_type.go @@ -10,11 +10,13 @@ import ( "github.com/filecoin-project/venus/venus-shared/actors/builtin/market" ) +type PieceStatus string + const ( - Undefine = "Undefine" - Assigned = "Assigned" - Packing = "Packing" - Proving = "Proving" + Undefine PieceStatus = "Undefine" + Assigned PieceStatus = "Assigned" + Packing PieceStatus = "Packing" + Proving PieceStatus = "Proving" ) type DealInfo struct { diff --git a/venus-shared/types/market/cbor_gen.go b/venus-shared/types/market/cbor_gen.go index 5b38c57b57..d6b8670334 100644 --- a/venus-shared/types/market/cbor_gen.go +++ b/venus-shared/types/market/cbor_gen.go @@ -762,7 +762,7 @@ func (t *MinerDeal) MarshalCBOR(w io.Writer) error { return err } - // t.PayloadSize (abi.UnpaddedPieceSize) (uint64) + // t.PayloadSize (uint64) (uint64) if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.PayloadSize)); err != nil { return err @@ -851,7 +851,7 @@ func (t *MinerDeal) MarshalCBOR(w io.Writer) error { return err } - // t.PieceStatus (string) (string) + // t.PieceStatus (market.PieceStatus) (string) if len(t.PieceStatus) > cbg.MaxLength { return xerrors.Errorf("Value in field t.PieceStatus was too long") } @@ -1004,7 +1004,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error { t.PiecePath = filestore.Path(sval) } - // t.PayloadSize (abi.UnpaddedPieceSize) (uint64) + // t.PayloadSize (uint64) (uint64) { @@ -1015,7 +1015,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error { if maj != cbg.MajUnsignedInt { return fmt.Errorf("wrong type for uint64 field") } - t.PayloadSize = abi.UnpaddedPieceSize(extra) + t.PayloadSize = uint64(extra) } // t.MetadataPath (filestore.Path) (string) @@ -1195,7 +1195,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error { t.Offset = abi.PaddedPieceSize(extra) } - // t.PieceStatus (string) (string) + // t.PieceStatus (market.PieceStatus) (string) { sval, err := cbg.ReadStringBuf(br, scratch) @@ -1203,7 +1203,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error { return err } - t.PieceStatus = string(sval) + t.PieceStatus = PieceStatus(sval) } // t.InboundCAR (string) (string) diff --git a/venus-shared/types/market/miner_deal.go b/venus-shared/types/market/miner_deal.go index dffdef8d49..72047f91bb 100644 --- a/venus-shared/types/market/miner_deal.go +++ b/venus-shared/types/market/miner_deal.go @@ -21,7 +21,7 @@ type MinerDeal struct { Client peer.ID State storagemarket.StorageDealStatus PiecePath filestore.Path - PayloadSize abi.UnpaddedPieceSize + PayloadSize uint64 MetadataPath filestore.Path SlashEpoch abi.ChainEpoch FastRetrieval bool @@ -37,7 +37,7 @@ type MinerDeal struct { SectorNumber abi.SectorNumber Offset abi.PaddedPieceSize - PieceStatus string + PieceStatus PieceStatus InboundCAR string } From 764480be9dd6362afc1a91e83318368609ff4432 Mon Sep 17 00:00:00 2001 From: hunjixin <1084400399@qq.com> Date: Wed, 16 Mar 2022 15:50:20 +0800 Subject: [PATCH 3/4] change field type --- venus-shared/api/market/method.md | 22 +++++++++++----------- venus-shared/types/market/assigner_type.go | 13 ++++++------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/venus-shared/api/market/method.md b/venus-shared/api/market/method.md index ec2d81afff..b7b4af025a 100644 --- a/venus-shared/api/market/method.md +++ b/venus-shared/api/market/method.md @@ -140,11 +140,6 @@ Response: ```json [ { - "Offset": 1032, - "Length": 1032, - "PayloadSize": 1024, - "DealID": 5432, - "TotalStorageFee": "0", "PieceCID": { "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" }, @@ -158,6 +153,11 @@ Response: "StoragePricePerEpoch": "0", "ProviderCollateral": "0", "ClientCollateral": "0", + "Offset": 1032, + "Length": 1032, + "PayloadSize": 42, + "DealID": 5432, + "TotalStorageFee": "0", "FastRetrieval": true, "PublishCid": { "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" @@ -527,7 +527,7 @@ Response: "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" }, "FastRetrieval": true, - "Status": "string value" + "Status": "Undefine" } ] ``` @@ -567,11 +567,6 @@ Response: ```json [ { - "Offset": 1032, - "Length": 1032, - "PayloadSize": 1024, - "DealID": 5432, - "TotalStorageFee": "0", "PieceCID": { "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" }, @@ -585,6 +580,11 @@ Response: "StoragePricePerEpoch": "0", "ProviderCollateral": "0", "ClientCollateral": "0", + "Offset": 1032, + "Length": 1032, + "PayloadSize": 42, + "DealID": 5432, + "TotalStorageFee": "0", "FastRetrieval": true, "PublishCid": { "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" diff --git a/venus-shared/types/market/assigner_type.go b/venus-shared/types/market/assigner_type.go index ee3c5a4235..1529a80527 100644 --- a/venus-shared/types/market/assigner_type.go +++ b/venus-shared/types/market/assigner_type.go @@ -1,12 +1,11 @@ package market import ( + market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market" "github.com/ipfs/go-cid" "github.com/filecoin-project/go-fil-markets/piecestore" "github.com/filecoin-project/go-state-types/abi" - market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market" - "github.com/filecoin-project/venus/venus-shared/actors/builtin/market" ) @@ -27,7 +26,7 @@ type DealInfo struct { Root cid.Cid PublishCid cid.Cid FastRetrieval bool - Status string + Status PieceStatus } type GetDealSpec struct { @@ -36,14 +35,14 @@ type GetDealSpec struct { } type DealInfoIncludePath struct { + market7.DealProposal Offset abi.PaddedPieceSize Length abi.PaddedPieceSize - PayloadSize abi.UnpaddedPieceSize + PayloadSize uint64 DealID abi.DealID TotalStorageFee abi.TokenAmount - market7.DealProposal - FastRetrieval bool - PublishCid cid.Cid + FastRetrieval bool + PublishCid cid.Cid } type PieceInfo struct { From 74a17cbaddb1583820dc80fff7ef522b2d30cd8b Mon Sep 17 00:00:00 2001 From: hunjixin <1084400399@qq.com> Date: Wed, 16 Mar 2022 16:08:15 +0800 Subject: [PATCH 4/4] change api arg type --- venus-shared/api/market/api.go | 4 ++-- venus-shared/api/market/method.md | 4 ++-- venus-shared/api/market/mock/mock_imarket.go | 4 ++-- venus-shared/api/market/proxy_gen.go | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/venus-shared/api/market/api.go b/venus-shared/api/market/api.go index 8021ba31b0..a3d814fd86 100644 --- a/venus-shared/api/market/api.go +++ b/venus-shared/api/market/api.go @@ -130,11 +130,11 @@ type IMarket interface { MarkDealsAsPacking(ctx context.Context, miner address.Address, deals []abi.DealID) error //perm:write UpdateDealOnPacking(ctx context.Context, miner address.Address, dealID abi.DealID, sectorid abi.SectorNumber, offset abi.PaddedPieceSize) error //perm:write - UpdateDealStatus(ctx context.Context, miner address.Address, dealID abi.DealID, pieceStatus string) error //perm:write + UpdateDealStatus(ctx context.Context, miner address.Address, dealID abi.DealID, pieceStatus market.PieceStatus) error //perm:write GetDeals(ctx context.Context, miner address.Address, pageIndex, pageSize int) ([]*market.DealInfo, error) //perm:read AssignUnPackedDeals(ctx context.Context, miner address.Address, ssize abi.SectorSize, spec *market.GetDealSpec) ([]*market.DealInfoIncludePath, error) //perm:write GetUnPackedDeals(ctx context.Context, miner address.Address, spec *market.GetDealSpec) ([]*market.DealInfoIncludePath, error) //perm:read - UpdateStorageDealStatus(ctx context.Context, dealProposalCid cid.Cid, state storagemarket.StorageDealStatus, pieceState string) error //perm:write + UpdateStorageDealStatus(ctx context.Context, dealProposalCid cid.Cid, state storagemarket.StorageDealStatus, pieceState market.PieceStatus) error //perm:write //market event ResponseMarketEvent(ctx context.Context, resp *gateway.ResponseEvent) error //perm:read ListenMarketEvent(ctx context.Context, policy *gateway.MarketRegisterPolicy) (<-chan *gateway.RequestEvent, error) //perm:read diff --git a/venus-shared/api/market/method.md b/venus-shared/api/market/method.md index b7b4af025a..6f4044bff2 100644 --- a/venus-shared/api/market/method.md +++ b/venus-shared/api/market/method.md @@ -1726,7 +1726,7 @@ Inputs: [ "f01234", 5432, - "string value" + "Undefine" ] ``` @@ -1744,7 +1744,7 @@ Inputs: "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" }, 42, - "string value" + "Undefine" ] ``` diff --git a/venus-shared/api/market/mock/mock_imarket.go b/venus-shared/api/market/mock/mock_imarket.go index 83e4e33145..bc99c04928 100644 --- a/venus-shared/api/market/mock/mock_imarket.go +++ b/venus-shared/api/market/mock/mock_imarket.go @@ -1047,7 +1047,7 @@ func (mr *MockIMarketMockRecorder) UpdateDealOnPacking(arg0, arg1, arg2, arg3, a } // UpdateDealStatus mocks base method. -func (m *MockIMarket) UpdateDealStatus(arg0 context.Context, arg1 address.Address, arg2 abi.DealID, arg3 string) error { +func (m *MockIMarket) UpdateDealStatus(arg0 context.Context, arg1 address.Address, arg2 abi.DealID, arg3 market.PieceStatus) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateDealStatus", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) @@ -1061,7 +1061,7 @@ func (mr *MockIMarketMockRecorder) UpdateDealStatus(arg0, arg1, arg2, arg3 inter } // UpdateStorageDealStatus mocks base method. -func (m *MockIMarket) UpdateStorageDealStatus(arg0 context.Context, arg1 cid.Cid, arg2 uint64, arg3 string) error { +func (m *MockIMarket) UpdateStorageDealStatus(arg0 context.Context, arg1 cid.Cid, arg2 uint64, arg3 market.PieceStatus) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateStorageDealStatus", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) diff --git a/venus-shared/api/market/proxy_gen.go b/venus-shared/api/market/proxy_gen.go index 83774136de..d226a83cdb 100644 --- a/venus-shared/api/market/proxy_gen.go +++ b/venus-shared/api/market/proxy_gen.go @@ -90,8 +90,8 @@ type IMarketStruct struct { SectorGetSealDelay func(context.Context) (time.Duration, error) `perm:"read"` SectorSetExpectedSealDuration func(context.Context, time.Duration) error `perm:"write"` UpdateDealOnPacking func(ctx context.Context, miner address.Address, dealID abi.DealID, sectorid abi.SectorNumber, offset abi.PaddedPieceSize) error `perm:"write"` - UpdateDealStatus func(ctx context.Context, miner address.Address, dealID abi.DealID, pieceStatus string) error `perm:"write"` - UpdateStorageDealStatus func(ctx context.Context, dealProposalCid cid.Cid, state storagemarket.StorageDealStatus, pieceState string) error `perm:"write"` + UpdateDealStatus func(ctx context.Context, miner address.Address, dealID abi.DealID, pieceStatus market.PieceStatus) error `perm:"write"` + UpdateStorageDealStatus func(ctx context.Context, dealProposalCid cid.Cid, state storagemarket.StorageDealStatus, pieceState market.PieceStatus) error `perm:"write"` } } @@ -297,9 +297,9 @@ func (s *IMarketStruct) SectorSetExpectedSealDuration(p0 context.Context, p1 tim func (s *IMarketStruct) UpdateDealOnPacking(p0 context.Context, p1 address.Address, p2 abi.DealID, p3 abi.SectorNumber, p4 abi.PaddedPieceSize) error { return s.Internal.UpdateDealOnPacking(p0, p1, p2, p3, p4) } -func (s *IMarketStruct) UpdateDealStatus(p0 context.Context, p1 address.Address, p2 abi.DealID, p3 string) error { +func (s *IMarketStruct) UpdateDealStatus(p0 context.Context, p1 address.Address, p2 abi.DealID, p3 market.PieceStatus) error { return s.Internal.UpdateDealStatus(p0, p1, p2, p3) } -func (s *IMarketStruct) UpdateStorageDealStatus(p0 context.Context, p1 cid.Cid, p2 storagemarket.StorageDealStatus, p3 string) error { +func (s *IMarketStruct) UpdateStorageDealStatus(p0 context.Context, p1 cid.Cid, p2 storagemarket.StorageDealStatus, p3 market.PieceStatus) error { return s.Internal.UpdateStorageDealStatus(p0, p1, p2, p3) }