-
Notifications
You must be signed in to change notification settings - Fork 23
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
Update to nucypher-core@0.11.0
#250
Update to nucypher-core@0.11.0
#250
Conversation
e0e37ef
to
b384752
Compare
package.json
Outdated
@@ -52,7 +52,7 @@ | |||
"prebuild": "yarn typechain" | |||
}, | |||
"dependencies": { | |||
"@nucypher/nucypher-core": "^0.10.0", | |||
"@nucypher/nucypher-core": "file:../nucypher-core/nucypher-core-wasm/pkg", |
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 be updated after nucypher-core@0.11.0
release
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.
LGTM! 👍
return DecryptionSharePrecomputed; | ||
default: | ||
throw new Error(`Invalid FerveoVariant: ${variant}`); | ||
if (variant.equals(FerveoVariant.simple)) { |
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.
Just out of curiosity: why has this been changed from switch conditionals to If/ else if?
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.
Implementing comparison for WASM objects is tricky (==
, ===
). If we were to simply run a1 === a2
, it's going to fail even though a1
and a2
are identical. This is because JS will attempt to compare WASM objects which are just pointers to some memory on the heap (and not the values of the objects). This is why we expose equals
method - to compare the underlying values and not the pointers.
So previously we sort of got away without doing all of that because FerveoVariant
was just a number
. And you can compare primitive types just fine, so ===
and ==
work. switch
statement is relying on equality, so we could use it with number
. Again, all was good.
Now that the FerveoVariant
is a WASM object instead of a number
primitive type we can't use switch
anymore, we have to manually compare objects using equals
.
Perhaps there is a better way to do that, like somehow implementing a native ===
overloading in wasm-bindgen
, but I didn't figure out it yet.
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.
Ok, got it. Thanks for the elaborate explanation, Piotr 🙌
Codecov Report
@@ Coverage Diff @@
## alpha #250 +/- ##
==========================================
+ Coverage 80.56% 80.66% +0.09%
==========================================
Files 37 37
Lines 1055 1050 -5
Branches 144 141 -3
==========================================
- Hits 850 847 -3
+ Misses 196 194 -2
Partials 9 9
|
nucypher-core
after0.11.0
version is releasedType of PR:
Required reviews:
What this does:
nucypher-ts
for compatibility with a newnucypher-core
versionIssues fixed/closed:
FerveoVariant
exposed bynucypher-core
#236Why it's needed:
Notes for reviewers: