-
Notifications
You must be signed in to change notification settings - Fork 258
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
Fix and test sr25519 signing in nostd #1872
Conversation
Confirmed this working in wasm |
@@ -66,7 +66,7 @@ hmac = { workspace = true } | |||
zeroize = { workspace = true } | |||
bip39 = { workspace = true } | |||
bip32 = { workspace = true, features = ["alloc", "secp256k1"], optional = true } | |||
schnorrkel = { workspace = true, optional = true } | |||
schnorrkel = { workspace = true, optional = true, features = ["getrandom"] } |
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.
perhaps update the README in the signer crate that "sr25519 needs getrandom" which isn't supported on all platforms
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.
can we remove the getrandom feature flag now below?
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.
I don't believe so because we have web = ["getrandom/js"]
to enable the relevant getrandom feature if compiling for the web.
(There's a separate conversation around whether this should be a thing of whether to make downstream consumers enable said feature flag instead, which is what getrandom suggests IIRC)
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.
cool
826410c
to
8dd4d1b
Compare
We had WASM tests for signing things, but no nostd tests. Adding them shows an issue signing via sr25519 (reported in #1871), for which adding the
getrandom
feature to schnorrkel seems to fix (pending CI passing here).I had to remove some code in
testing/no-std-tests
because signing with sr25519 isn't supported on thethumbv7em-none-eabi
target we run the nostd tests on. Previously it would compile OK because we didn't enable thegetrandom
feature, but I think if we were able to run it, we'd have seen a runtime error instead. Some other nostd targets probably handle this all OK (getrandom
has a list here: https://docs.rs/getrandom/latest/getrandom/#unsupported-targets)