-
Notifications
You must be signed in to change notification settings - Fork 78
ETCM-626 - remove Option.get when searching for the best block #924
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
Conversation
src/main/scala/io/iohk/ethereum/consensus/ethash/EthashBlockCreator.scala
Outdated
Show resolved
Hide resolved
src/main/scala/io/iohk/ethereum/consensus/ethash/EthashMiner.scala
Outdated
Show resolved
Hide resolved
leo-bogastry
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.
Nice to see all those gets removed 👍
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.
✅ 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.
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.
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.
Reviewed with ❤️ by PullRequest
14e0b4b to
cc2a8ae
Compare
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.
⚠️ 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

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