-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Nullable ECPoint
and ECFieldElement
#3758
base: master
Are you sure you want to change the base?
Conversation
|
Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com>
@cschuchardt88 is not the first time that your "fixes" break the build, please fix it |
It was styling issue for variable name and yes we all make mistakes. But I put these rules in place to protect us... all of us, even me. Should be fixed now.
I can count on one hand, even with missing fingers too. |
var hexPubKey = ((ByteString)resJArray[2])?.GetSpan().ToHexString(); | ||
if (string.IsNullOrEmpty(hexPubKey)) | ||
{ | ||
ConsoleHelper.Error("Error parsing the result"); | ||
return; | ||
} | ||
|
||
var publickey = ECPoint.Parse(hexPubKey, ECCurve.Secp256r1); |
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.
ECPoint.TryParse
? Index for resJArray[2]
could be out of range as well.
action = () => new ECPoint(null, Y, null); | ||
Assert.ThrowsException<ArgumentException>(action); |
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.
Should still check if the output is correct. No test functionality should be removed. But should be adjusted for new logic.
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.
Is not null now
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.
Well whatever it should be, can we check that? What will new ECPoint(null, Y, null)
be?
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.
We can, but it has no logic to have tests with null, when the argument is not null, but it's ok, if this is your wish I will change it
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.
A test with a pragma for avoid the warning compilation seems weird, why are you asking for this test? Is not null argument, no coverage is increased
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.
To make sure the ECPoint
is returning the right thing. What if doesn't return null
.
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.
It's a constructor
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.
It's a constructor
What i meant is what does new ECPoint(null, Y, null)
equal? for example new ECPoint(null, Y, null) == CCurve.G
.
Can we test to make sure it equals the right thing?
ECPoint p = null; | ||
byte[] n = new byte[] { 1 }; | ||
Action action = () => p = p * n; | ||
Assert.ThrowsException<ArgumentNullException>(action); | ||
var p = ECCurve.Secp256k1.G; | ||
|
||
p = ECCurve.Secp256k1.G; | ||
n = null; | ||
action = () => p = p * n; | ||
Assert.ThrowsException<ArgumentNullException>(action); | ||
|
||
n = new byte[] { 1 }; | ||
action = () => p = p * n; |
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.
Same here
@shargon conflicts in this pr please. |
n = new byte[] { 1 }; | ||
action = () => p = p * n; | ||
byte[] n = [1]; | ||
var action = () => p = p * n; |
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.
var action = () => p = p * n; | |
Action action = () => p = p * n; |
Description
Check nullability in
ECPoint
andECFieldElement
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: