-
Notifications
You must be signed in to change notification settings - Fork 158
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
question: can I use isolated-vm to have deterministic execution? #511
Comments
I'm familiar with the concept. Asking about filesystems is a weird, since JavaScript does not specify access to a filesystem. This is something provided by the DOM or other APIs. I'm not sure what you mean by "random based sorting" either. Anyway the short answer is: no, it is not a formal goal of the project because this is not a goal of the underlying runtime, v8, or even the language of JavaScript. In recent years there has been some work to fix previously implementation-defined sections of the specification-- I am working on a from-scratch rewrite which will have some features that would take it a bit closer. Specifically you can choose a deterministic monotonically increasing clock, and choose a random seed: isolated-vm/packages/isolated-vm/agent.ts Line 14 in e237c2b
|
Many JS/TS hosts provide IO/workers access, so it is more like how easy to disable/limit that oven-sh/bun#725
yes, this `for-in order and Array.prototype.sort stability. Really good answer! |
We use isolated-vm with a custom eslint plugin + patched functions to run JS deterministically. We wrote about it a while ago on our blog, might be useful to you: https://developers.rune.ai/blog/making-js-deterministic-for-fun-and-glory MIT-licensed eslint plugin: https://github.com/rune/rune/tree/staging/packages/eslint-plugin-rune |
Formal definition of
deterministic
is https://en.wikipedia.org/wiki/Deterministic_algorithm .Examples are,
https://github.com/facebookexperimental/hermit allows to execute native code deterministically on linux by isolating thread scheduling non determinism
Blockchains(like Ethereum) or accounting software (Cobol) do not allow code to call local clocks, randoms, or any other sources of non determinism.
Nix builds allow access only to predefined directory with fully replaced environment variables and consume only content addressable binaries.
So question, is about
Can isolated-vm make execution of JS deterministic isolating it from non determinism of local clocks, randoms, GC thread scheduling, random based sorting, any file system access?
The text was updated successfully, but these errors were encountered: