Skip to content

Catchpoints: Add the kv hashes into the trie#4812

Merged
jannotti merged 4 commits into
algorand:masterfrom
jannotti:initialize-kv-hashes
Nov 18, 2022
Merged

Catchpoints: Add the kv hashes into the trie#4812
jannotti merged 4 commits into
algorand:masterfrom
jannotti:initialize-kv-hashes

Conversation

@jannotti
Copy link
Copy Markdown
Contributor

When building the catchpoint merkle trie from scratch, need to include the kv hashes too.

@jannotti jannotti requested review from algorandskiy and cce November 17, 2022 18:06
@jannotti jannotti changed the title Add the kv hashes into the trie Catchpoints: Add the kv hashes into the trie Nov 17, 2022
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 17, 2022

Codecov Report

Merging #4812 (ebba1d7) into master (526cb89) will decrease coverage by 0.02%.
The diff coverage is 17.50%.

@@            Coverage Diff             @@
##           master    #4812      +/-   ##
==========================================
- Coverage   54.69%   54.67%   -0.03%     
==========================================
  Files         416      416              
  Lines       53596    53622      +26     
==========================================
+ Hits        29316    29319       +3     
- Misses      21851    21875      +24     
+ Partials     2429     2428       -1     
Impacted Files Coverage Δ
ledger/catchpointtracker.go 59.18% <17.50%> (-1.42%) ⬇️
ledger/testing/randomAccounts.go 56.00% <0.00%> (-1.24%) ⬇️
ledger/acctupdates.go 69.51% <0.00%> (-0.49%) ⬇️
network/wsPeer.go 68.68% <0.00%> (-0.49%) ⬇️
network/wsNetwork.go 66.51% <0.00%> (-0.46%) ⬇️
catchup/service.go 69.38% <0.00%> (ø)
crypto/merkletrie/node.go 93.48% <0.00%> (+1.86%) ⬆️
crypto/merkletrie/trie.go 68.61% <0.00%> (+2.18%) ⬆️
ledger/tracker.go 77.87% <0.00%> (+2.97%) ⬆️

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

// Now add the kvstore hashes
// CR Question: Does this neeed ordering? I don't see why it would, but
// the account iterator is explicitly ordered for some reason.
kvs, err := tx.QueryContext(ctx, "SELECT key, value FROM kvstore")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

makeOrderedAccountsIter reads ordered, shouldn't this do the same? IDK

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See the discussion in slack. @cce tracked down why the accounts were ordered - it had to do with ordering the hashes so that it was faster to insert them into the trie. But, given that this code only runs one time, in an uncommon situation (a node was running without catchpoints, then turns them on) I definitely don't think it's worth the effort and complexity to create a temp table, then grab the hashes in order, just to build the tree faster.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

orderdAccountsIter was added in #1697, there is a nice writeup about it

Comment thread ledger/catchpointtracker.go
Comment thread ledger/catchpointtracker.go
Comment thread ledger/catchpointtracker.go
algorandskiy
algorandskiy previously approved these changes Nov 17, 2022
@jannotti jannotti marked this pull request as ready for review November 18, 2022 12:28
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.

3 participants