-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: how to import offline deal in Chinese
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# 如何迁移离线订单 | ||
|
||
从`lotus` 迁移到`venus`的时候,需要迁移已完成封装证明的订单和还没开始进行封装的离线订单。 | ||
本文档主要介绍该过程中离线订单的迁移。 | ||
|
||
## 前置条件 | ||
|
||
要完成离线订单的迁移,需要满足以下两个条件: | ||
- 已经拥有一套带有`market`组件的`venus`链服务 | ||
- 已经将矿工账号迁入`venus`链服务 | ||
|
||
## 从`lotus-miner`导出离线订单 | ||
|
||
迄至2022年7月,`lotus-miner`尚未提供直接导出订单详细信息的命令行工具,所以订单的导出需要用户直接访问`lotus-miner`的rpc服务接口来完成。 | ||
可参考以下使用curl导出lotus-miner的离线订单的示例: | ||
|
||
```bash | ||
curl http://127.0.0.1:2345/rpc/v0 -X POST \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer <YOUR-TOKEN>" \ | ||
-d '{"method": "Filecoin.MarketListIncompleteDeals","params":[], "id": 0}' | ||
``` | ||
|
||
执行完命令后,你可能得到如下结果: | ||
|
||
``` | ||
{"jsonrpc":"2.0","result":[{"Proposal":{"PieceCID":{"/":"baga6ea4seaqcrddjqzqavqipgljq6jn3bmbnhzw5yucdmoqoji3tni6kisjqini"},"PieceSize":128,"VerifiedDeal":false,"Client":"t3r3nyp4sitvilwc5wggvrsyoqmue3zgliqsqzqxri5up2fmlx2e5xeltxv4qbokjj6qrdgz3t7zdwygogpjaa","Provider":"t01000","Label":"uAVUAHOi_meaYr-eUqOadpea1i-ivleeahOaVsOaNrgo","StartEpoch":173482,"EndEpoch":694737,"StoragePricePerEpoch":"0", | ||
...... | ||
":"bafkqahhix6m6ngfp46kkrzu5uxtllc7iv6k6pgue42k3bzunvyfa"},"PieceCid":{"/":"baga6ea4seaqcrddjqzqavqipgljq6jn3bmbnhzw5yucdmoqoji3tni6kisjqini"},"PieceSize":127,"RawBlockSize":0},"AvailableForRetrieval":false,"DealID":0,"CreationTime":"2022-08-03T10:35:09.774748628+08:00","TransferChannelId":null,"SectorNumber":0,"InboundCAR":""}],"id":0} | ||
``` | ||
|
||
其中,`result`中的每一项都是一个订单的详细信息。每个订单中的`State`字段表征了当前订单的状态,如果`State`=18,表示当前订单处于`StorageDealWaitingForData`的状态,也就是离线订单暂时停留的一个状态,可以手动地将离线订单抽离出来,也可以将所有的订单都保留直接通过`venus-market`导入,它会排除掉非离线订单。<br> | ||
将要导入的订单信息保存到一个json文件中,就算是完成了离线订单导出。 | ||
|
||
|
||
## 将离线订单导入到`venus-market` | ||
|
||
开始导入离线订单之前,先确认矿工账号是否在`venus`链服务中,如果不在,需要将矿工账号迁入`venus`链服务。 | ||
|
||
```bash | ||
./venus-market actor list | ||
``` | ||
|
||
确定完矿工之后,在`venus-market`中可以直接通过命令导入离线订单: | ||
|
||
```bash | ||
./venus-market storage-deals import-offlinedeal <DEALS-FILE> | ||
``` | ||
|
||
可以得到类似以下的结果: | ||
|
||
$ ./venus-market storage-deals import-offlinedeal offline-deals.json | ||
import 4 deals, 1 deal success , 3 deal fail . | ||
|
||
加上`--verbose`(`-v`)标志,可以获取更加详细的执行信息: | ||
|
||
|
||
$./venus-market storage-deals import-offlinedeal --verbose <DEAL-FILE> | ||
( 1 / 4 ) bafyreieb5uzq26rrvpp6cue34tuyz6xfrdgydxsul3u2fyez7wrnohoaye : fail : deal state StorageDealError not match StorageDealWaitingForData | ||
( 2 / 4 ) bafyreiergjl22fk5kfvxd3yopby62veeejhesuxzbmhsnoo7tp3mam6zzu : success | ||
( 3 / 4 ) bafyreig75z2tw2wz5qpign2r4773wugl6gf5fezo32dvucqnz3ftfajilu : fail : deal state StorageDealError not match StorageDealWaitingForData | ||
( 4 / 4 ) bafyreihdbazwk2zahpmpdhykyqrax6m5rkz472gvhfixfg5hse5ao4s6gq : fail : deal state StorageDealError not match StorageDealWaitingForData | ||
import 4 deals, 1 deal success , 3 deal fail . | ||
|
||
至此,就已经完成了离线订单的导入。 |