-
Notifications
You must be signed in to change notification settings - Fork 450
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
ledger: move spver context hash calculation out from catchpoint writing #5574
ledger: move spver context hash calculation out from catchpoint writing #5574
Conversation
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.
LGTM
7d675c7
to
ad63e50
Compare
Codecov Report
@@ Coverage Diff @@
## master #5574 +/- ##
==========================================
+ Coverage 55.79% 55.81% +0.02%
==========================================
Files 446 446
Lines 63418 63425 +7
==========================================
+ Hits 35381 35401 +20
+ Misses 25668 25656 -12
+ Partials 2369 2368 -1
... and 7 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
LGTM
Just a suggestion, but the ledger readme doesn't mention the stateproof tracker. Should we add that? |
} | ||
|
||
wrappedContext := catchpointStateProofVerificationContext{Data: rawData} | ||
stateProofVerificationHash = crypto.HashObj(wrappedContext) |
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.
You are adding an extra DB call to GetAllSPContexts
here, to get the hash and drop the data. Then later in WriteStateProofVerificationContext() the DB is called again to get the data but throw away the hash. I guess it is safe to assume the DB will return the same data/hash between the two calls (is it possible it won't?). The data is written out when finishFirstStage
is called by finishFirstStageAfterCrash
for example and I wasn't sure whether there are cases where things can get mixed up between the two DB calls to get the SP data..
I'm looking at the code now trying to figure out, is there a way to have the hash and data be generated from the same DB call.. just to have one less thing to worry about getting out of sync
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.
Or maybe if you just have if !ct.enableGeneratingCatchpointFiles
around this?
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.
Well there is the same "issue" with accounts - they are written into a file in generateCatchpointData
and hash is calculated later in recordFirstStageInfo
by reading MT from DB. There is no difference in approach.
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.
What about a smaller change like this 7b28351
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.
could work, why not
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.
Both calls come from lt.postCommitUnlocked
, and the database is changed in lt.commitRound
sequentially before the postCommitUnlocked
call.
What do you think of #5579? |
replaced by #5579 |
Summary
CatchpointTracking=1
properly - its hash calculation is a side effect of writing spver data chunk into catchpoint file. Fixed that by calculating hash similarly to balance hash on demand.Test Plan