Skip to content
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

Feature/shard validation #3297

Closed
wants to merge 2 commits into from

Conversation

undertome
Copy link
Contributor

This was rebased on pull requests 3152 and 3252, which have yet to me merged to develop. To see only new changes you can compare against base pull/3252/head. Verfication testing pending new shard archives.

@miguelportilla miguelportilla self-assigned this Mar 12, 2020
@undertome undertome requested a review from scottschurr March 12, 2020 16:32
@scottschurr scottschurr self-assigned this Mar 12, 2020
@codecov-io
Copy link

codecov-io commented Mar 13, 2020

Codecov Report

Merging #3297 into develop will increase coverage by 0.00%.
The diff coverage is 52.06%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #3297   +/-   ##
========================================
  Coverage    70.44%   70.44%           
========================================
  Files          682      682           
  Lines        54392    54466   +74     
========================================
+ Hits         38315    38369   +54     
- Misses       16077    16097   +20     
Impacted Files Coverage Δ
src/ripple/app/main/Application.h 100.00% <ø> (ø)
src/ripple/net/SSLHTTPDownloader.h 100.00% <ø> (ø)
src/ripple/net/impl/DatabaseDownloader.cpp 91.30% <0.00%> (ø)
src/ripple/nodestore/impl/DatabaseShardImp.cpp 13.74% <0.00%> (+0.25%) ⬆️
src/ripple/nodestore/impl/DatabaseShardImp.h 52.00% <ø> (+20.00%) ⬆️
src/ripple/nodestore/impl/Shard.cpp 0.00% <0.00%> (ø)
src/ripple/nodestore/impl/Shard.h 0.00% <ø> (ø)
src/ripple/rpc/handlers/DownloadShard.cpp 0.00% <0.00%> (ø)
src/ripple/net/impl/DatabaseBody.ipp 41.37% <14.28%> (-0.73%) ⬇️
src/ripple/rpc/impl/ShardArchiveHandler.cpp 61.45% <58.40%> (-1.69%) ⬇️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9771210...de7abfd. Read the comment docs.

@miguelportilla miguelportilla requested a review from a user April 1, 2020 14:04
@miguelportilla miguelportilla assigned ghost Apr 1, 2020
@undertome undertome force-pushed the feature/shard-validation branch from 3dcf720 to 1793624 Compare April 1, 2020 17:29
@scottschurr
Copy link
Collaborator

Nice job with the two commit messages, but I'd like to request a couple small changes.

  1. For the heading if there are no additional following lines omit the period. I'm not sure why that's a guideline, but there you are. However both of your commit messages are nice, long, useful messages with multiple lines. So, in your case, both of the heading lines should end with a colon (:). That way folks can tell there's additional information if they only see the first line.

    Also, when the commit message includes multiple lines please include one line of white space between the heading and the following lines. Some tools treat lines that have no blank lines between them as though they are paragraphs and then concatenate the lines. Including a blank line between the heading and the following paragraphs will prevent that concatenation. That, in turn, will improve readability.

  2. Please limit line lengths to 60 characters for the heading and 72 characters for the body. Some tools add indentations above and beyond what you put in. So in those cases limiting your line lengths will make the commit message easier to read for everyone. The heading lines in your commit messages are great, but a few of the lines in the bodies of the messages are a bit long.

So the commit message for your top-most commit might look like this:

Validate LastLedgerHash for downloaded shards:

* Add documentation for shard validation
* Retrieve last ledger hash for imported shards
* Compare the reference hash to the lastLedgerHash in
  Shard::finalize
* Limit retry attempts for imported shards with unconfirmed last
  ledger hashes
* Use a common function for removing failed shards
* Add new ShardInfo::State for imported shards

Here's a useful guide to good commit messages: https://chris.beams.io/posts/git-commit/.

He says to limit the heading to 50 characters. I can seldom achieve that, so I allow myself to go up to 60 characters for the heading. But the rest of the guidance I try to follow.

I hope that helps.

@miguelportilla
Copy link
Contributor

@undertome the lastLedgerHash members in ShardInfo may be better encapsulated in a new class. I wrote an alternate version of your code in this branch: https://github.com/miguelportilla/rippled/commits/shard-validation-alternate

Disclaimer: I haven't tested this code.
If you end up using it, the class should probably be broken out into its own files.

@undertome undertome force-pushed the feature/shard-validation branch from 1793624 to 63d2d7f Compare April 3, 2020 20:37
@undertome undertome force-pushed the feature/shard-validation branch from bbea5c6 to b662824 Compare May 12, 2020 23:30
@undertome undertome requested a review from scottschurr May 13, 2020 01:06
scottschurr
scottschurr previously approved these changes May 14, 2020
Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me. I left some comments for you to consider, however none of them are worth blocking the pull request over.

src/ripple/rpc/impl/ShardArchiveHandler.cpp Outdated Show resolved Hide resolved
src/ripple/app/main/Application.cpp Show resolved Hide resolved
src/ripple/app/main/Application.cpp Show resolved Hide resolved
src/ripple/app/main/Application.cpp Outdated Show resolved Hide resolved
src/test/rpc/ShardArchiveHandler_test.cpp Outdated Show resolved Hide resolved
src/test/rpc/ShardArchiveHandler_test.cpp Show resolved Hide resolved
src/test/rpc/ShardArchiveHandler_test.cpp Outdated Show resolved Hide resolved
src/test/rpc/ShardArchiveHandler_test.cpp Show resolved Hide resolved
src/test/rpc/ShardArchiveHandler_test.cpp Outdated Show resolved Hide resolved
scottschurr
scottschurr previously approved these changes May 16, 2020
Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

👍 LGTM.

miguelportilla
miguelportilla previously approved these changes May 18, 2020
Copy link
Contributor

@miguelportilla miguelportilla left a comment

Choose a reason for hiding this comment

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

👍

@undertome undertome added the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label May 18, 2020
This was referenced May 21, 2020
@undertome undertome removed the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label May 21, 2020
@undertome undertome dismissed stale reviews from miguelportilla and scottschurr via 9e6be91 May 21, 2020 17:48
@undertome undertome force-pushed the feature/shard-validation branch 4 times, most recently from 552b2d8 to 318d77d Compare May 22, 2020 15:22
* Improve documentation
* Make the ShardArchiveHandler rather than the DatabaseShardImp perform
  LastLedgerHash verification for downloaded shards
* Remove ShardArchiveHandler's singleton implementation and make it an
  Application member
* Have the Application invoke ShardArchiveHandler initialization
  instead of clients
* Add RecoveryHandler as a ShardArchiveHandler derived class
* Improve commenting
@undertome undertome force-pushed the feature/shard-validation branch from 318d77d to 8e8da17 Compare May 22, 2020 15:24
Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

Still looks good to me.

Copy link
Contributor

@miguelportilla miguelportilla left a comment

Choose a reason for hiding this comment

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

👍

@undertome undertome added the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label May 26, 2020
@manojsdoshi manojsdoshi mentioned this pull request May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependencies Issues associated with 3rd party dependencies (RocksDB, SQLite, etc) Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants