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

signer: enable schnorrkel/getrandom feature #1871

Closed
wants to merge 1 commit into from

Conversation

ordian
Copy link
Member

@ordian ordian commented Nov 18, 2024

Without this I get a https://github.com/burdges/getrandom_or_panic/blob/8dc0f4d43c9aebfefcd0b8a226b40ef33e56f9c0/src/lib.rs#L21 from getrandom_or_panic crate in both wasm and regular no-std builds that try to sign something.

Without this I get a https://github.com/burdges/getrandom_or_panic/blob/8dc0f4d43c9aebfefcd0b8a226b40ef33e56f9c0/src/lib.rs#L21 from `getrandom_or_panic` crate in both wasm and regular no-std builds that try to sign something.
@ordian ordian requested a review from a team as a code owner November 18, 2024 16:27
@jsdw
Copy link
Collaborator

jsdw commented Nov 18, 2024

Interesting! We test basic signing in our CI here:

https://github.com/paritytech/subxt/blob/master/signer/wasm-tests/tests/wasm.rs

I wonder what's different between those tests and your setup; would you have an example you could share?

This comment is also interesting: https://github.com/w3f/schnorrkel/blob/master/Cargo.toml#L65

@ordian
Copy link
Member Author

ordian commented Nov 18, 2024

@jsdw
Copy link
Collaborator

jsdw commented Nov 19, 2024

Thankyou!

Ok so running natively, enabling the "std" feature seems to make everything work. I guess sr25519 uses randomness but thought we avoided this in no-std mode so I'll have to look at why it doesn't work without std.

If you were to compile and run this in WASM, we have a "web" feature which should make things work (it enables getrandom's JS feature to get the randomness from JS land). Does this work for you in WASM builds (you may need the "std" feature too but not sure)?

@ordian
Copy link
Member Author

ordian commented Nov 19, 2024

Does this work for you in WASM builds (you may need the "std" feature too but not sure)?

No, enabling getrandom/js feature doesn't enable getrandom_or_panic/getrandom feature.

I'm not sure how the wasm tests work here. Is it possible that std feature leaks?

I haven't tried enabling std feature in wasm and it will likely work, but seems like an overkill.

@jsdw
Copy link
Collaborator

jsdw commented Nov 19, 2024

I added the getrandom feature you suggested (albeit in a different place) and adding some nostd tests which reproduced your issue and work with that feature in #1872. If the CI passes for that then I think that's the way to go! I'd be very grateful if you could try that branch and see if it all works for you :)

@ordian
Copy link
Member Author

ordian commented Nov 19, 2024

Closing in favor of #1872

@ordian ordian closed this Nov 19, 2024
@ordian ordian deleted the ao-schnorrkel-getrandom branch November 19, 2024 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants