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

ETCM-626 - remove Option.get when searching for the best block #924

Merged
merged 3 commits into from
Feb 17, 2021

Conversation

bsuieric
Copy link
Contributor

Unsafe use of Option.get causes node desync when getting new best block

Copy link
Contributor

@leo-bogastry leo-bogastry left a comment

Choose a reason for hiding this comment

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

Nice to see all those gets removed 👍

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

✅ This pull request was sent to the PullRequest network.


@bsuieric you can click here to see the review status or cancel the code review job - or - cancel by adding [!pr] to the title of the pull request.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

This looks like a good fix overall.

Double-checking: All the new uses of .get are in test code? If they're in actual production code that seems worrisome, but not a big deal if it's only in test code.

IME it's useful to think about how any given issue arose and how it can be prevented in the future. In this case, it looks like it would due to a casual use of .get. Since .get undermines the safety Scala provides with Option, it should generally be regarded with suspicion. It may be worth getting a lint rule setup to flag all uses of .get like this for further review.

Image of Eric E Eric E


Reviewed with ❤️ by PullRequest

@bsuieric bsuieric force-pushed the ETCM-626-remove-best-block-option-get branch from 14e0b4b to cc2a8ae Compare February 17, 2021 10:49
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

⚠️ Warning

PullRequest detected a force-push on this branch. This may have caused some information to be lost, and additional time may be required to complete review of the code. Read More

@bsuieric bsuieric merged commit f98d2ef into develop Feb 17, 2021
@dzajkowski dzajkowski deleted the ETCM-626-remove-best-block-option-get branch April 9, 2021 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants