NebulousLabs / Sia

Blockchain-based marketplace for file storage. Project has moved to GitLab: https://gitlab.com/NebulousLabs/Sia
https://sia.tech
MIT License
2.71k stars 440 forks source link

The host/contracts output shows contracts that do not exist on the blockchain #3006

Closed hakkane84 closed 6 years ago

hakkane84 commented 6 years ago

BUG REPORT

Stack Trace or error message No error message. This report is originated by analyzing the output of the command towards blockchain databases

Expected Behavior The new host/contracts endpoint to be introduced on 1.3.3 generates a (very useful, btw!) report about the status of each contract. I am about to release a feature in SiaStats that allows to throw up to 1000 lines of the report and get back a summary and a timeline representation of them, merging the data of the report with data collected from the blockchain about those contracts. Surprisingly, I was receiving back only about 650 valid entries. Checking carefully I found those contracts no only do not exist in my database, but neither they exist on the official Explorer or SiaHub's explorer. These are some of those contracts IDs:

fecb9b2be6a8b9768d8644ef46b4ec8bd262404d9b2ca40a73a5d9fee0eacde1 8758160f56c5e7e9fc2948d6767ed548e15f1f38a1fb2a7d438605a7449273cb 05060b13ee70943d02b95d4b925c9c83c65d5d6c294ce0c25c87cb1b488308ea 670d923d641ee8831980c0738cf43fbc599291447e627a924bb6f285ad4947c8 8bc2fc2afd160bd6081ce0e3384cac64a13ed05b49db827199a23f71addf9e1f db779896a1eb34be895e395a27c203661c06119ad9659d07d2ba0429d10abe83 81589c96c5aa407a4f8f83381ad7025df68a808780b3c31bf895fb3fab3fb76a caf347299260c1d846172984ff56b846cdf73d63ca3c4f91db3557d464f8418c

The first contract is specially revealing, as it should have been resolved many, many blocks ago (151228), yet it still shows up as "Unresolved":

fecb9b2be6a8b9768d8644ef46b4ec8bd262404d9b2ca40a73a5d9fee0eacde1 Unresolved 100 mS 530.5 mS 0 H 0 H 151228 0 H

Interestingly, most of the inexistent contracts are accumulated at the bottom of the host/contracts report: if I push 100-200 contracts to my tool I only find <5 bad ones, but the more I push, the bigger the proportion. This could suggest these contracts are accumulating in recent times (as the report is sorted chronologically). I cannot say if this is a bug of the new endpoint or a deeper issue in the host databases.

How to reproduce it (as minimally and precisely as possible)

I am glad to share the contracts report if it helps.

I can also do experiments with other reports in my tool if you need it, and return you a list with the bad contracts, or share the tool link (still under construction)

hakkane84 commented 6 years ago

In case you want to check a list of contracts against my tool to collect those that (to the best of the knowledge of my DB) do not exist in the blockchain, you can use my API: https://siastats.info:3500/navigator-api/host-contracts Type of request: POST In the body, send one single key query with the host/contracts report as the value (as a simple string). It will admit up to 1000 contracts.

The returned JSON is an array of 3 elements. Check on the third one for the list of not found contracts. Using something like Postman should be very easy to test.

nielscastien commented 6 years ago

@hakkane84 this is due to the bug described in #2901 Basically it means you can end up having 'fake' contracts in the host database. It is one of the reasons why the information presented in siac host -v is not correct.

hakkane84 commented 6 years ago

Oh, thanks @nielscastien, I was not aware of that Issue. Thank you!

I guess then this issue can be removed as it is a duplicate

sanasol commented 6 years ago

https://s-anasol.github.io/hostdbviewer/#/ You can see some sample contracts dataset here. Wallet contract db store many failed contracts and even contracts that actually never "started". That's why there is no way to show some useful and correct contract list, at least i dont know how to filter correct and dummy rows :)

Also stats in siac host -v incorrect too https://github.com/NebulousLabs/Sia/issues/2144

tbenz9 commented 6 years ago

Duplicate of #2901 .