Skip to content

new method for import published deal #4832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions venus-devtool/api-gen/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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{}) {
Expand Down
5 changes: 3 additions & 2 deletions venus-shared/api/market/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, 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
Expand Down Expand Up @@ -129,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
Expand Down
105 changes: 88 additions & 17 deletions venus-shared/api/market/method.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* [MarketGetReserved](#MarketGetReserved)
* [MarketGetRetrievalAsk](#MarketGetRetrievalAsk)
* [MarketImportDealData](#MarketImportDealData)
* [MarketImportPublishedDeal](#MarketImportPublishedDeal)
* [MarketListAsk](#MarketListAsk)
* [MarketListDataTransfers](#MarketListDataTransfers)
* [MarketListDeals](#MarketListDeals)
Expand Down Expand Up @@ -139,11 +140,6 @@ Response:
```json
[
{
"Offset": 1032,
"Length": 1032,
"PayloadSize": 1024,
"DealID": 5432,
"TotalStorageFee": "0",
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
Expand All @@ -157,6 +153,11 @@ Response:
"StoragePricePerEpoch": "0",
"ProviderCollateral": "0",
"ClientCollateral": "0",
"Offset": 1032,
"Length": 1032,
"PayloadSize": 42,
"DealID": 5432,
"TotalStorageFee": "0",
"FastRetrieval": true,
"PublishCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
Expand Down Expand Up @@ -526,7 +527,7 @@ Response:
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"FastRetrieval": true,
"Status": "string value"
"Status": "Undefine"
}
]
```
Expand Down Expand Up @@ -566,11 +567,6 @@ Response:
```json
[
{
"Offset": 1032,
"Length": 1032,
"PayloadSize": 1024,
"DealID": 5432,
"TotalStorageFee": "0",
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
Expand All @@ -584,6 +580,11 @@ Response:
"StoragePricePerEpoch": "0",
"ProviderCollateral": "0",
"ClientCollateral": "0",
"Offset": 1032,
"Length": 1032,
"PayloadSize": 42,
"DealID": 5432,
"TotalStorageFee": "0",
"FastRetrieval": true,
"PublishCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
Expand Down Expand Up @@ -817,7 +818,7 @@ Response:
"Client": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"State": 42,
"PiecePath": "/some/path",
"PayloadSize": 1024,
"PayloadSize": 42,
"MetadataPath": "/some/path",
"SlashEpoch": 10101,
"FastRetrieval": true,
Expand All @@ -842,7 +843,7 @@ Response:
},
"SectorNumber": 9,
"Offset": 1032,
"PieceStatus": "string value",
"PieceStatus": "Undefine",
"InboundCAR": "string value"
}
```
Expand Down Expand Up @@ -900,6 +901,76 @@ Inputs:

Response: `{}`

### MarketImportPublishedDeal


Perms: write

Inputs:
```json
[
{
"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": 42,
"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": "Undefine",
"InboundCAR": "string value"
}
]
```

Response: `{}`

### MarketListAsk


Expand Down Expand Up @@ -1057,7 +1128,7 @@ Response:
"Client": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"State": 42,
"PiecePath": "/some/path",
"PayloadSize": 1024,
"PayloadSize": 42,
"MetadataPath": "/some/path",
"SlashEpoch": 10101,
"FastRetrieval": true,
Expand All @@ -1082,7 +1153,7 @@ Response:
},
"SectorNumber": 9,
"Offset": 1032,
"PieceStatus": "string value",
"PieceStatus": "Undefine",
"InboundCAR": "string value"
}
]
Expand Down Expand Up @@ -1655,7 +1726,7 @@ Inputs:
[
"f01234",
5432,
"string value"
"Undefine"
]
```

Expand All @@ -1673,7 +1744,7 @@ Inputs:
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
42,
"string value"
"Undefine"
]
```

Expand Down
18 changes: 16 additions & 2 deletions venus-shared/api/market/mock/mock_imarket.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions venus-shared/api/market/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 12 additions & 11 deletions venus-shared/types/market/assigner_type.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
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"
)

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 {
Expand All @@ -25,7 +26,7 @@ type DealInfo struct {
Root cid.Cid
PublishCid cid.Cid
FastRetrieval bool
Status string
Status PieceStatus
}

type GetDealSpec struct {
Expand All @@ -34,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 {
Expand Down
Loading