0chain / blobber

A storage provider (blobber) interface to the blockchain and consumers of storage.
Other
19 stars 23 forks source link

Download and upload fail if one of the blobbers return an error #810

Closed fabioDMFerreira closed 2 years ago

fabioDMFerreira commented 2 years ago

n data + 1 parity blobbers should be enough to allow a client to do all operations.

Steps

  1. Launch network with 3 miners, 1 sharder and 4 blobbers.
  2. Adapt one of the blobbers to return an error to the upload/download request.
  3. Create an allocation, stake tokens and upload/download a file.

Expected File to be uploaded/downloaded.

Actual On upload the next errors show up:

0box-sdk        [ERROR]  2022/08/24 10:26:39.762585 chunked_upload_blobber.go:79: http://198.18.0.91:5051 Upload error response: 400
Error in file operation: bad request: {"code":"upload_file","error":"upload_file: adversarial"}

Upload failed. bad request: {"code":"upload_file","error":"upload_file: adversarial"}

On download the next output shows up:

0box-sdk        [INFO]   2022/08/24 10:13:04.047048 filemetaworker.go:73: File Meta result:{"actual_file_hash":"3fe2fde68d81eee3df0e3d572ab80c0d21416c4edddbd6986c7341520c492aab","actual_file_size":5242880,"actual_thumbnail_hash":"","actual_thumbnail_size":0,"allocation_id":"f040a017e9571c6c7b6aaa146d48c1ad08d7fe05034d07f73b90de0026379b18","chunk_size":65536,"collaborators":[],"commit_meta_txns":[],"content_hash":"d564b84998ff969ad5205a896c8e3fbf9eac363eab335dc0c166e8d7b78b4cda","created_at":1661328780,"custom_meta":"","encrypted_key":"","hash":"ea1d3dc687a73ce89bc6e14592b1a93f61286e04d6eb426f07401168ffea46dc","lookup_hash":"316d33b0a3b5e5d4f178179c3239492d7f0982048af2e2be2bba65d9c5f4188c","merkle_root":"a8676bda92b0566a9ecfd298dabbd43c6ae2a470e20ec61f1eb28f1597aa2f99","mimetype":"application/octet-stream","name":"random.bin","num_of_blocks":40,"on_cloud":false,"path":"/remote/random.bin","path_hash":"316d33b0a3b5e5d4f178179c3239492d7f0982048af2e2be2bba65d9c5f4188c","size":2621440,"thumbnail_hash":"","thumbnail_size":0,"type":"f","updated_at":1661328780}
0box-sdk        [INFO]   2022/08/24 10:13:04.047426 filemetaworker.go:73: File Meta result:{"actual_file_hash":"3fe2fde68d81eee3df0e3d572ab80c0d21416c4edddbd6986c7341520c492aab","actual_file_size":5242880,"actual_thumbnail_hash":"","actual_thumbnail_size":0,"allocation_id":"f040a017e9571c6c7b6aaa146d48c1ad08d7fe05034d07f73b90de0026379b18","chunk_size":65536,"collaborators":[],"commit_meta_txns":[],"content_hash":"2119dc4590b1d67077d3a6be576889a432396080e859c04f9888cc923d441c6f","created_at":1661328780,"custom_meta":"","encrypted_key":"","hash":"263a6153b2232bea9212119bacfc3f16f3fd36e2bb25c02ee626f2337e02d6fe","lookup_hash":"316d33b0a3b5e5d4f178179c3239492d7f0982048af2e2be2bba65d9c5f4188c","merkle_root":"70b5caee851ff232bfae90109c80f9a62af9b3c9a2d2c15e04a40c61f21ab76f","mimetype":"application/octet-stream","name":"random.bin","num_of_blocks":40,"on_cloud":false,"path":"/remote/random.bin","path_hash":"316d33b0a3b5e5d4f178179c3239492d7f0982048af2e2be2bba65d9c5f4188c","size":2621440,"thumbnail_hash":"","thumbnail_size":0,"type":"f","updated_at":1661328780}
0box-sdk        [INFO]   2022/08/24 10:13:04.047893 filemetaworker.go:73: File Meta result:{"actual_file_hash":"3fe2fde68d81eee3df0e3d572ab80c0d21416c4edddbd6986c7341520c492aab","actual_file_size":5242880,"actual_thumbnail_hash":"","actual_thumbnail_size":0,"allocation_id":"f040a017e9571c6c7b6aaa146d48c1ad08d7fe05034d07f73b90de0026379b18","chunk_size":65536,"collaborators":[],"commit_meta_txns":[],"content_hash":"34b8fba5c8f7fb7d81cf1941305ee7d4e6dd0bc545a5a2ff532f1b1a998cc9e4","created_at":1661328780,"custom_meta":"","encrypted_key":"","hash":"a23579510117fc67d38c6f2aacd489da74c6e4af5cca96d38d25dab2529254e9","lookup_hash":"316d33b0a3b5e5d4f178179c3239492d7f0982048af2e2be2bba65d9c5f4188c","merkle_root":"22d74e357b48baea109b4e8cf40d3825e4ce1519feb1a3731be9c0cfcce4223a","mimetype":"application/octet-stream","name":"random.bin","num_of_blocks":40,"on_cloud":false,"path":"/remote/random.bin","path_hash":"316d33b0a3b5e5d4f178179c3239492d7f0982048af2e2be2bba65d9c5f4188c","size":2621440,"thumbnail_hash":"","thumbnail_size":0,"type":"f","updated_at":1661328780}
0box-sdk        [INFO]   2022/08/24 10:13:04.047991 filemetaworker.go:73: File Meta result:{"actual_file_hash":"3fe2fde68d81eee3df0e3d572ab80c0d21416c4edddbd6986c7341520c492aab","actual_file_size":5242880,"actual_thumbnail_hash":"","actual_thumbnail_size":0,"allocation_id":"f040a017e9571c6c7b6aaa146d48c1ad08d7fe05034d07f73b90de0026379b18","chunk_size":65536,"collaborators":[],"commit_meta_txns":[],"content_hash":"b6462411a27132fed763951eb2563a439af98c4ecdda9bbb0a6229c5a6a5bb1d","created_at":1661328780,"custom_meta":"","encrypted_key":"","hash":"a2cb3f947200717652b6404933869d1e3186ec305e6aff137d31030601fd61e5","lookup_hash":"316d33b0a3b5e5d4f178179c3239492d7f0982048af2e2be2bba65d9c5f4188c","merkle_root":"77489ca2c788f8d8a0dc0399d1153eb1185de976e308e4a287dea86e08f70244","mimetype":"application/octet-stream","name":"random.bin","num_of_blocks":40,"on_cloud":false,"path":"/remote/random.bin","path_hash":"316d33b0a3b5e5d4f178179c3239492d7f0982048af2e2be2bba65d9c5f4188c","size":2621440,"thumbnail_hash":"","thumbnail_size":0,"type":"f","updated_at":1661328780}
0box-sdk        [INFO]   2022/08/24 10:13:04.048080 downloadworker.go:256: Encrypted key from fileref
0box-sdk        [INFO]   2022/08/24 10:13:04.048389 downloadworker.go:295: Download Size:5242880 Shard:2621440 chunks/shard:40
0box-sdk        [INFO]   2022/08/24 10:13:04.048404 downloadworker.go:296: Start block: 1 End block: 40 Num blocks: 10
0box-sdk        [INFO]   2022/08/24 10:13:04.048446 downloadworker.go:308: Downloading block 1
0box-sdk        [INFO]   2022/08/24 10:13:04.048489 downloadworker.go:100: downloadBlock 1 numDownloads 4
0box-sdk        [ERROR]  2022/08/24 10:13:04.050989 downloadworker.go:114: Download block : http://198.18.0.91:5051 response_error: download_file: adversarial
Error in file operation: Download failed for block 1.
response_error: download_file: adversarial

More info The command used to create an allocation was

./zboxcli/zbox --wallet testing.json newallocation \ --read_price 0.001-10 --write_price 0.01-10 --size 104857600 --lock 4 \ --data 2 --parity 2 --expire 48h

lpoli commented 2 years ago

https://github.com/0chain/gosdk/pull/565 and https://github.com/0chain/gosdk/pull/558 will fix this issue

fabioDMFerreira commented 2 years ago

@lpoli I am reopening this issue because the test in the description doesn't pass successfully yet.

I'll check the test passes after the tickets you are referring to are merged.

fabioDMFerreira commented 2 years ago

The tests to check are still being reviewed on: https://github.com/0chain/blobber/pull/803 https://github.com/0chain/0chain/pull/1603

lpoli commented 2 years ago

Actually @fabioDMFerreira These are gosdk issues. That is why I had it closed. There is also an similar issue on gosdk.https://github.com/0chain/gosdk/issues/545

fabioDMFerreira commented 2 years ago

@lpoli I realized https://github.com/0chain/gosdk/pull/558 was closed, but the code wasn't merged.

Which tickets are blocking download and upload from working properly? https://github.com/0chain/gosdk/pull/565 and https://github.com/0chain/gosdk/issues/545?