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

Sanity check in PrivateKey constructor using bytes #438

Merged
merged 6 commits into from
Aug 15, 2019

Conversation

ipdae
Copy link
Member

@ipdae ipdae commented Aug 15, 2019

resolved #358

CHANGES.md Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 15, 2019

Codecov Report

Merging #438 into master will decrease coverage by 0.02%.
The diff coverage is 94.44%.

@@            Coverage Diff             @@
##           master     #438      +/-   ##
==========================================
- Coverage   87.94%   87.92%   -0.03%     
==========================================
  Files         198      198              
  Lines       14426    14439      +13     
==========================================
+ Hits        12687    12695       +8     
- Misses       1425     1429       +4     
- Partials      314      315       +1
Impacted Files Coverage Δ
Libplanet/Crypto/PrivateKey.cs 86.2% <100%> (+0.62%) ⬆️
Libplanet.Tests/Crypto/PrivateKeyTest.cs 98.94% <87.5%> (-0.51%) ⬇️
Libplanet/Net/Swarm.cs 77.74% <0%> (-0.27%) ⬇️

Co-Authored-By: Seunghun Lee <[email protected]>
CHANGES.md Outdated
@@ -82,6 +82,7 @@ To be released.
the `Transaction<T>` more than once. [[#413]]
- `BlockChain<T>.Swap()` became to omit common block finding when `render` is
`false`. [[#423]]
- `PrivateKey(bytes)` became to valid check. [[#438]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- `PrivateKey(bytes)` became to valid check. [[#438]]
- `PrivateKey(byte[])` constructor became to check validity. [[#438]]

}
catch (ArgumentException)
{
throw new InvalidOperationException(
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe ArgumentException would be more suitable here.

Suggested change
throw new InvalidOperationException(
throw new ArgumentException(

dahlia
dahlia previously approved these changes Aug 15, 2019
earlbread
earlbread previously approved these changes Aug 15, 2019
);

var key = new PrivateKey(param);
var publicKey = key.PublicKey;
Copy link
Member

Choose a reason for hiding this comment

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

This statement also seems unnatural, so it would be better if there is some comment about it.

);

var key = new PrivateKey(param);
var publicKey = key.PublicKey;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var publicKey = key.PublicKey;
var _ = key.PublicKey;

@ipdae ipdae dismissed stale reviews from earlbread and dahlia via 9814a2c August 15, 2019 04:17
@dahlia dahlia added the bug Something isn't working label Aug 15, 2019
@dahlia dahlia added this to the 0.5.0 milestone Aug 15, 2019
@dahlia dahlia merged commit dabcaf6 into planetarium:master Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sanity check on new PrivateKey()
4 participants