tech-greedy / singularity

New node software for large-scale clients with PB-scale data onboarding to Filecoin network
Other
39 stars 18 forks source link

Invalid deal end epoch when replication in Devnet #163

Closed frank-ang closed 1 year ago

frank-ang commented 1 year ago

Describe the bug Invalid deal end epoch when replication in Devnet

lotus-miner storage-deals list -v
...
Nov 18 05:58:33  false     bafyreic7mzdyfqrxgtxt7h3cxzzrjirytlwyam7q3m6eg3caxeumejwgkm  0       StorageDealError   t1fbdoo6z55zdi47hmpnh63fji33qg2q7pm7sdxki  2KiB  0 FIL                  520920                                                                                                                                   deal rejected: invalid deal end epoch 2872017: cannot be more than 1555200 past current epoch 1691

Version 2.0.0

To Reproduce Steps to reproduce the behavior:

2022-11-18T05:58:30Z: singularity repl start --start-delay 1 --duration 180 --max-deals 10 --verified false --output-csv /root/singularity-integ-test/lotus/singularity-out.csv 8b95c1de t01000 t1fbdoo6z55zdi47hmpnh63fji33qg2q7pm7sdxki
...

Singularity deal rejected.

      "errorMessage": "Error: Command failed: lotus client deal --manual-piece-cid=baga6ea4seaqprgij3kvb3w2omlto7bqtrd67ngnpwltd3tbmbzviilr4cciiimy --manual-piece-size=2032 --manual-stateless-deal --from=t1fbdoo6z55zdi47hmpnh63fji33qg2q7pm7sdxki --verified-deal=false --start-epoch=2351097 bafybeigfuvdcjyivovy5l5wynyshjhhrn5hyztiyihgu4s43mebl2srxwq t01000 0 518400\nERROR: provider returned unexpected state 26 for proposal bafyreic7mzdyfqrxgtxt7h3cxzzrjirytlwyam7q3m6eg3caxeumejwgkm, with message: deal rejected: invalid deal end epoch 2872017: cannot be more than 1555200 past current epoch 1691\n\n",

Note --start-epoch=2351097 is referencing Mainnet block height. However devnet was 1691 at the time.

singularity repl status -v 63771f09987d840fafb38101
{
  "id": "63771f09987d840fafb38101",
  "datasetId": "6376fa4823512e86b641441a",
  "replica": 10,
  "storageProviders": "t01000",
  "client": "t1fbdoo6z55zdi47hmpnh63fji33qg2q7pm7sdxki",
  "urlPrefix": "http://127.0.0.1/",
  "maxPrice": 0,
  "maxNumberOfDeals": 10,
  "isVerfied": "false",
  "startDelay": 2880,
  "duration": 518400,
  "isOffline": "true",
  "status": "completed",
  "csvOutputDir": "/root/singularity-integ-test/lotus/singularity-out.csv",
  "isForced": false,
  "dealsProposed": 0,
  "dealsPublished": 0,
  "dealsActive": 0,
  "dealsProposalExpired": 0,
  "dealsExpired": 0,
  "dealsSlashed": 0,
  "dealsError": 1,
  "dealsTotal": 1,
  "deals": [
    {
      "_id": "63771fdc3600342e41c273f2",
      "client": "t1fbdoo6z55zdi47hmpnh63fji33qg2q7pm7sdxki",
      "provider": "t01000",
      "dealCid": "unknown",
      "dataCid": "bafybeigfuvdcjyivovy5l5wynyshjhhrn5hyztiyihgu4s43mebl2srxwq",
      "pieceCid": "baga6ea4seaqprgij3kvb3w2omlto7bqtrd67ngnpwltd3tbmbzviilr4cciiimy",
      "pieceSize": 2048,
      "startEpoch": 2351097,
      "expiration": 2869497,
      "duration": 518400,
      "price": 0,
      "verified": false,
      "state": "error",
      "replicationRequestId": "63771f09987d840fafb38101",
      "datasetId": "6376fa4823512e86b641441a",
      "errorMessage": "Error: Command failed: lotus client deal --manual-piece-cid=baga6ea4seaqprgij3kvb3w2omlto7bqtrd67ngnpwltd3tbmbzviilr4cciiimy --manual-piece-size=2032 --manual-stateless-deal --from=t1fbdoo6z55zdi47hmpnh63fji33qg2q7pm7sdxki --verified-deal=false --start-epoch=2351097 bafybeigfuvdcjyivovy5l5wynyshjhhrn5hyztiyihgu4s43mebl2srxwq t01000 0 518400\nERROR: provider returned unexpected state 26 for proposal bafyreic7mzdyfqrxgtxt7h3cxzzrjirytlwyam7q3m6eg3caxeumejwgkm, with message: deal rejected: invalid deal end epoch 2872017: cannot be more than 1555200 past current epoch 1691\n\n",
      "createdAt": "2022-11-18T06:02:04.385Z",
      "updatedAt": "2022-11-18T06:02:04.385Z",
      "__v": 0
    }
  ]
}

Devnet miner error.

lotus-miner storage-deals list -v
...
Nov 18 05:58:33  false     bafyreic7mzdyfqrxgtxt7h3cxzzrjirytlwyam7q3m6eg3caxeumejwgkm  0       StorageDealError   t1fbdoo6z55zdi47hmpnh63fji33qg2q7pm7sdxki  2KiB  0 FIL                  520920                                                                                                                                   deal rejected: invalid deal end epoch 2872017: cannot be more than 1555200 past current epoch 1691

Lotus devnet is only at epoch 2803.

date && lotus status
Fri Nov 18 07:41:34 UTC 2022
Sync Epoch: 2803
Epochs Behind: 150
Peers to Publish Messages: 0
Peers to Publish Blocks: 0

Expected behavior Devnet deal epoch should reference actual epoch height, including devnet 4k / calib height.

Probable root cause https://github.com/tech-greedy/singularity/blob/3f8c893ad45df7e0eab06d98a377d9280ec8df0a/src/common/ChainHeight.ts#L23

xinaxu commented 1 year ago

We did not plan to support devnet. Other than the epoch issue you pointed out, there is also lack of devnet explorer making it nearly impossible to track deal status in devnet. @kernelogic The best thing we can do is probably have a --manual-start-epoch but we won't be able to track the status of the deal

frank-ang commented 1 year ago

Disagree. I believe devnet support aligns with sw engr best practices. Devnet support will with high confidence, improve software quality, by unblocking test automation, CI integration tests, CI load tests, CI fuzz tests, etc, to catch classes of errors in devnet before releasing for mainnet clients.

xinaxu commented 1 year ago

A complete support for devnet is not trivial and the return is not clear. Most users of singularity are using mainnet where we get all the feedback to improve the software quality. The main difference between mainnet and devnet here is, mainnet uses real money but either data preparation or deal replication via this software does not cost money so the users could use mainnet for their test environment.

frank-ang commented 1 year ago

...--manual-start-epoch but we won't be able to track the status of the deal

This is an acceptable partial workaround for me.

frank-ang commented 1 year ago

Devnet is working for me by querying the block height from lotus status. PR.

frank-ang commented 1 year ago

PR 174 merged. Issue closed.