-
Notifications
You must be signed in to change notification settings - Fork 53
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
Wasmtime-py and randomness #244
Comments
I think this would involve implementing a new version of https://docs.rs/wasmtime-wasi/latest/wasmtime_wasi/bindings/random/random/trait.Host.html and plumbing that through to Maybe @pchickey can give a better answer? |
So I just noticed this comment:
In this case I suppose wasmtime doesn't actually need to do anything; rather, I would have to go through my dependencies and see where, if anywhere, they use |
The other thing you can do is virtualize the |
That is what I'm doing for the Node/web hosted YoWASP! It uses a reasonable PRNG (xoroshiro* or something like that), with a seed of 1. But it seems like I'm violating the interface by doing so. I don't think the application should actually link to get_random_bytes because it's intended to be deterministic, so this could be arguably a nextpnr bug... |
In Rust the way this would be customized would be As for |
I am, yes. I'm running a compiler, if it's doing anything nondeterministically, it's a bug. |
Ok yeah in that case I think this is fine. Would you be up for helping to add the C API to configure this in Wasmtime? |
I think so--do you have a guide for doing that, or even just a similar PR? I can emulate it then. |
Sure yeah, bytecodealliance/wasmtime#8907 is a pretty recent example of adding a minor API. I'd recommend following the example of bytecodealliance/wasmtime#7209 for this API in terms of structures to add in the header. We don't have many in-repo tests at this time for the C API so it's ok to skip those mostly and use wasmtime-py itself as the test instead. |
Thanks, I'll handle this when I have some spare time. |
I am using wasmtime-py to create a fully deterministic sandbox (for reproducible build purposes) for a toolchain. The toolchain uses
rand()
or similar for Monte Carlo method computations, which AFAICT requests randomness from wasmtime.Is there a way to tell wasmtime to only produce deterministic randomness? Is that something I can do via wasmtime-py? What does it do by default?
The text was updated successfully, but these errors were encountered: