Skip to content

Conversation

@cce
Copy link
Contributor

@cce cce commented Oct 18, 2022

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 attempts to fix that issue.

Test Plan

Needs testing

@cce cce added the Bug-Fix label Oct 18, 2022
@codecov
Copy link

codecov bot commented Oct 18, 2022

Codecov Report

Merging #4666 (8975195) into master (b29d7ff) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4666   +/-   ##
=======================================
  Coverage   54.38%   54.39%           
=======================================
  Files         403      403           
  Lines       51928    51930    +2     
=======================================
+ Hits        28243    28245    +2     
+ Misses      21308    21305    -3     
- Partials     2377     2380    +3     
Impacted Files Coverage Δ
ledger/accountdb.go 72.89% <100.00%> (+0.02%) ⬆️
ledger/catchupaccessor.go 62.03% <100.00%> (ø)
cmd/algoh/blockWatcher.go 77.77% <0.00%> (-3.18%) ⬇️
agreement/cryptoVerifier.go 67.60% <0.00%> (-2.12%) ⬇️
agreement/proposalManager.go 96.07% <0.00%> (-1.97%) ⬇️
cmd/tealdbg/debugger.go 72.69% <0.00%> (-0.81%) ⬇️
network/wsNetwork.go 65.34% <0.00%> (-0.19%) ⬇️
ledger/acctupdates.go 69.44% <0.00%> (-0.15%) ⬇️
catchup/service.go 68.88% <0.00%> (+0.74%) ⬆️
ledger/tracker.go 76.59% <0.00%> (+1.70%) ⬆️
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

for _, hash := range balance.accountHashes {
for i, balance := range bals {
for j, hash := range balance.accountHashes {
if expectingMoreEntries[i] && j == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two questions:

  1. expectingMoreEntries set to true for the first chunk, and it is not in the beginning of a chunk, so why j == 0?
  2. Totals calculation - the original issue also reports off by one expected vs processed, I guess this is not addressed by this fix, please confirm.

Copy link
Contributor Author

@cce cce Oct 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

j == 0 is because the first account hash in the list is the account's own and the rest are for resources. It would be more clear to split accountHashes into separate "accountHash" and "resourceHashes" fields though. And also add expectingMoreEntries to the normalizedAccountBalances type perhaps..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for total chunks, @jannotti was telling me he noticed the current code cannot know how many chunks there are but that he modified it in the boxes PR

Copy link
Contributor Author

@cce cce Oct 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess a better fix might be to add this directly to prepareNormalizedBalancesV6 to prevent the account's hash from ending up in accountHashes altogether, instead of skipping it later like I'm doing here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is that alternate fix: #4668

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the j==0 explanation.
RE totals - I'm taking about number of accounts, not chunks:

Catchpoint total accounts: 15251246
Catchpoint accounts processed: 15251247

@cce
Copy link
Contributor Author

cce commented Oct 19, 2022

Closing in favor of #4668.

@cce cce closed this Oct 19, 2022
@cce cce deleted the fix-catchpoint-expectingmoreentries branch October 19, 2022 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants