-
Notifications
You must be signed in to change notification settings - Fork 92
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
The API documentation for the heights
method does not accurately document the returned value.
#748
Comments
Thank you for reporting this. This is a tough one. Factomd used to use the height reported here internally and update internally based on unauthenticated traffic that it saw on the network. It used the traffic to guess what block the federated servers were actively building. Since it was unauthenticated, this turned out to be a security hole. In releases based on 6.2.0 and 6.3.0, it uses the unauthenticated traffic when starting up and when running along. This was convenient because it would show how far along in the bootstrap process you were. Sadly, this was not to be since it was a security problem. The problem is also made more difficult by the multi-stage finalization process that factomd uses. between minute 0 and 1, blocks are not saved to the database, but the next block is being built. This is a bit of a quirk of how factomd determines when a block is done. This is a hard problem in and of itself, that will probably need to be revisited in the future. The change you are talking about, where the leaderheight call shows the block that the leaders think is done was not recent. The 6.2.0 code is showing similar behavior, where leaderheight = acknowledged height -1. A better description would probably be that leaderheight is the block that the leaders think is done. The thought was that people running factomd software would compare their saved height (directory block height) with the leader's height. When they were equal, they would know they have everything. This value also ties into the control panel 1st pass complete percentage. That is less meaningful now in post 6.2.0 software, like in Bond. Ideally, when factomd matures more followers will be able to look at the current state of their blockchain, and look at the traffic on the network and use several different heuristics to guage how reliable the data is. It will be more accurate the more blocks factomd downloads. It will be the most accurate when factomd is just a few blocks behind. Some of the heuristics would be related to the expected number of blocks based on the clock time that has elapsed between the highest block and the acks that are being seen. Another thing would be if a majority of what they think the authority set was is creating acknowledgements. At this point, this is mostly a case of the leaderheight call being documented incorrectly, among other things. This issue brings up several things, most of which are not going to be an easy fix.
I think the best that can be done at this point is to update documentation. I wouldn't put too much confidence into this API call at this point. |
The API documentation for the
heights
method states:However, in reality, the returned value for
leaderheight
is usually equal to the returned value fordirectoryblockheight
, which is always a finalised block. The only deviation from this pattern is during minute 0, whenleaderheight
is equal todirectoryblockheight
+ 1.Here is an example query returned by the
heights
method. Theleaderheight
should be 195650, as that is the working block:The text was updated successfully, but these errors were encountered: