Skip to content
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

Introduce stateless offline dealflow, bypassing the FSM/deallists #5961

Merged
merged 7 commits into from
May 17, 2021
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
2 changes: 2 additions & 0 deletions api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ type FullNode interface {
ClientRemoveImport(ctx context.Context, importID multistore.StoreID) error //perm:admin
// ClientStartDeal proposes a deal with a miner.
ClientStartDeal(ctx context.Context, params *StartDealParams) (*cid.Cid, error) //perm:admin
// ClientStatelessDeal fire-and-forget-proposes an offline deal to a miner without subsequent tracking.
ClientStatelessDeal(ctx context.Context, params *StartDealParams) (*cid.Cid, error) //perm:write
// ClientGetDealInfo returns the latest information about a given deal.
ClientGetDealInfo(context.Context, cid.Cid) (*DealInfo, error) //perm:read
// ClientListDeals returns information about the deals made by the local client.
Expand Down
15 changes: 15 additions & 0 deletions api/mocks/mock_full.go

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

10 changes: 10 additions & 0 deletions api/proxy_gen.go

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

2 changes: 2 additions & 0 deletions api/v0api/full.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ type FullNode interface {
ClientRemoveImport(ctx context.Context, importID multistore.StoreID) error //perm:admin
// ClientStartDeal proposes a deal with a miner.
ClientStartDeal(ctx context.Context, params *api.StartDealParams) (*cid.Cid, error) //perm:admin
// ClientStatelessDeal fire-and-forget-proposes an offline deal to a miner without subsequent tracking.
ClientStatelessDeal(ctx context.Context, params *api.StartDealParams) (*cid.Cid, error) //perm:write
// ClientGetDealInfo returns the latest information about a given deal.
ClientGetDealInfo(context.Context, cid.Cid) (*api.DealInfo, error) //perm:read
// ClientListDeals returns information about the deals made by the local client.
Expand Down
10 changes: 10 additions & 0 deletions api/v0api/proxy_gen.go

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

15 changes: 15 additions & 0 deletions api/v0api/v0mocks/mock_full.go

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

Binary file modified build/openrpc/full.json.gz
Binary file not shown.
Binary file modified build/openrpc/miner.json.gz
Binary file not shown.
Binary file modified build/openrpc/worker.json.gz
Binary file not shown.
19 changes: 17 additions & 2 deletions cli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ The minimum value is 518400 (6 months).`,
Name: "manual-piece-size",
Usage: "if manually specifying piece cid, used to specify size (dataCid must be to a car file)",
},
&cli.BoolFlag{
Name: "manual-stateless-deal",
Usage: "instructs the node to send an offline deal without registering it with the deallist/fsm",
},
&cli.StringFlag{
Name: "from",
Usage: "specify address to fund the deal with",
Expand Down Expand Up @@ -461,7 +465,7 @@ The minimum value is 518400 (6 months).`,
isVerified = verifiedDealParam
}

proposal, err := api.ClientStartDeal(ctx, &lapi.StartDealParams{
sdParams := &lapi.StartDealParams{
Data: ref,
Wallet: a,
Miner: miner,
Expand All @@ -471,7 +475,18 @@ The minimum value is 518400 (6 months).`,
FastRetrieval: cctx.Bool("fast-retrieval"),
VerifiedDeal: isVerified,
ProviderCollateral: provCol,
})
}

var proposal *cid.Cid
if cctx.Bool("manual-stateless-deal") {
if ref.TransferType != storagemarket.TTManual || price.Int64() != 0 {
return xerrors.New("when manual-stateless-deal is enabled, you must also provide a 'price' of 0 and specify 'manual-piece-cid' and 'manual-piece-size'")
}
proposal, err = api.ClientStatelessDeal(ctx, sdParams)
} else {
proposal, err = api.ClientStartDeal(ctx, sdParams)
}

if err != nil {
return err
}
Expand Down
34 changes: 34 additions & 0 deletions documentation/en/api-v0-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
* [ClientRetrieveTryRestartInsufficientFunds](#ClientRetrieveTryRestartInsufficientFunds)
* [ClientRetrieveWithEvents](#ClientRetrieveWithEvents)
* [ClientStartDeal](#ClientStartDeal)
* [ClientStatelessDeal](#ClientStatelessDeal)
* [Create](#Create)
* [CreateBackup](#CreateBackup)
* [Gas](#Gas)
Expand Down Expand Up @@ -1501,6 +1502,39 @@ Inputs:

Response: `null`

### ClientStatelessDeal
ClientStatelessDeal fire-and-forget-proposes an offline deal to a miner without subsequent tracking.


Perms: write

Inputs:
```json
[
{
"Data": {
"TransferType": "string value",
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceSize": 1024,
"RawBlockSize": 42
},
"Wallet": "f01234",
"Miner": "f01234",
"EpochPrice": "0",
"MinBlocksDuration": 42,
"ProviderCollateral": "0",
"DealStartEpoch": 10101,
"FastRetrieval": true,
"VerifiedDeal": true
}
]
```

Response: `null`

## Create


Expand Down
34 changes: 34 additions & 0 deletions documentation/en/api-v1-unstable-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
* [ClientRetrieveTryRestartInsufficientFunds](#ClientRetrieveTryRestartInsufficientFunds)
* [ClientRetrieveWithEvents](#ClientRetrieveWithEvents)
* [ClientStartDeal](#ClientStartDeal)
* [ClientStatelessDeal](#ClientStatelessDeal)
* [Create](#Create)
* [CreateBackup](#CreateBackup)
* [Gas](#Gas)
Expand Down Expand Up @@ -1503,6 +1504,39 @@ Inputs:

Response: `null`

### ClientStatelessDeal
ClientStatelessDeal fire-and-forget-proposes an offline deal to a miner without subsequent tracking.


Perms: write

Inputs:
```json
[
{
"Data": {
"TransferType": "string value",
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceSize": 1024,
"RawBlockSize": 42
},
"Wallet": "f01234",
"Miner": "f01234",
"EpochPrice": "0",
"MinBlocksDuration": 42,
"ProviderCollateral": "0",
"DealStartEpoch": 10101,
"FastRetrieval": true,
"VerifiedDeal": true
}
]
```

Response: `null`

## Create


Expand Down
1 change: 1 addition & 0 deletions documentation/en/cli-lotus.md
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ The minimum value is 518400 (6 months).
OPTIONS:
--manual-piece-cid value manually specify piece commitment for data (dataCid must be to a car file)
--manual-piece-size value if manually specifying piece cid, used to specify size (dataCid must be to a car file) (default: 0)
--manual-stateless-deal instructs the node to send an offline deal without registering it with the deallist/fsm (default: false)
--from value specify address to fund the deal with
--start-epoch value specify the epoch that the deal should start at (default: -1)
--fast-retrieval indicates that data should be available for fast retrieval (default: true)
Expand Down
Loading