-
Notifications
You must be signed in to change notification settings - Fork 524
catchpoints: don't make duplicate account hashes in prepareNormalizedBalances #4668
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
catchpoints: don't make duplicate account hashes in prepareNormalizedBalances #4668
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4668 +/- ##
==========================================
+ Coverage 54.38% 54.45% +0.06%
==========================================
Files 403 403
Lines 51928 51938 +10
==========================================
+ Hits 28243 28284 +41
+ Misses 21308 21280 -28
+ Partials 2377 2374 -3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
algorandskiy
left a comment
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.
The hashes fix looks ok to me
jannotti
left a comment
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.
All the stagingWriter jazz is so we can mock it to test it?
Correct. I mocked the minimal subset of functions otherwise it is a rabbit hole. |
…riterOverflowAccounts
|
I updated TestFullCatchpointWriter and TestFullCatchpointWriterOverflowAccounts to call accessor.BuildMerkleTrie() after accessor.ProgressStagingBalances(). This led to TestFullCatchpointWriterOverflowAccounts failing with the fix reverted, so that's good.. A more complete test might be to instantiate the catchpointService itself, which is what calls BuildMerkleTrie() after downloading the catchpoint file. Today we copy-paste much of the catchpointService’s logic into the tests (but not this part, to call BuildMerkleTrie). that kind of whole-service test would require mocking the network peers that provide catchpoint files and blocks. |
algorandskiy
left a comment
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 guess good enough for now
Summary
When an account is split over multiple catchpoint file chunks, we attempt to add its account hash to the catchpoint merkle trie twice, yielding a database error when processing the catchpoint. This is an alternate method to #4666 for fixing this issue, that stops the duplicate merkle trie hash issue at the source, rather than later at insert time.
Test Plan
New tests added to exercise accounts split over multiple catchpoint records/chunks.