Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Incremental verify checkpoints #4487
base: master
Are you sure you want to change the base?
Incremental verify checkpoints #4487
Changes from 9 commits
e94e613
c4810de
45f3a65
a619942
4de2273
fc48916
6f77a40
1009960
7f419c1
fa98355
7eb1104
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
return mCurrCheckpoint >= mLatestTrustedHashPair->first;
? Currently I don't think we actually check the hash consistency frommLatestTrustedHashPair.ledgerSeq
tomLatestTrustedHashPair.ledgerSeq + 1
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, when validating down to mLatestTrustedHashPair, this won't check the hash consistency between
mLatestTrustedHashPair.ledgerSeq
andmLatestTrustedHashPair.ledgerSeq + 1
if mLatestTrustedHashPair.ledgerSeq is a checkpoint boundary (which it ought to be).I think this is fine, as the user trusts the input already and the output will contain all the subsequent hashes based in the trust obtained from the network. In the case of
fromLedger
, we do always need to verify down to that ledger as we do not have a trusted hash for its corresponding checkpoint.That said, I can widen the bounds if we want to be extra sure that the hashes match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably throw if
mOutputFile && mOutputFile->is_open()
is false, instead of silently suceeding without writing an output file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endOutputFile
is called byresetIter
(which then calls start output file, so no problem there),~ WriteVerifiedCheckpointHashesWork
, andonSuccess
. When the work finishes,onSuccess
executes and the file is written to and closed. Then later when the shared ptr containing the work is reset~ WriteVerifiedCheckpointHashesWork
is called andmOutputFile
is not open. (in this diff, an spurious warning will be emitted). I think instead we should not be emitting a warning or raising an error in that case. I agree that we shouldn't silently succeed without writing an output file, but Considering there is logic to report errors opening the file instartOutputFile
, I don't think we need to warn or throw here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an assert or a throw. If we made it to this point, we've had to open the trustedHashFile before starting verification. If for some reason we can't open that file at the end of verification, we can't output a proper appended file and should throw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to be this defensive, given that we just wrote to and closed this temp file on the line above.