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

Determinism of the library #153

Open
angrymouse opened this issue Feb 10, 2024 · 3 comments
Open

Determinism of the library #153

angrymouse opened this issue Feb 10, 2024 · 3 comments
Labels
community Community discussion or information question Further information is requested

Comments

@angrymouse
Copy link

Hey! Is it possible to create fully deterministic sandbox from this library? (So that same code will always give same result with same input, even if code authors try to get different results). Assuming exposing only asyncified function (no callbacks or promises) and not exposing any non-deterministic functions, would there be some other ways to produce non-determinism?

@justjake justjake added the community Community discussion or information label Feb 10, 2024
@justjake
Copy link
Owner

justjake commented Feb 10, 2024

I don't think the Javascript bits of the library introduce non-determinism into the VM. You should double-check the Emscripten module initialization code for your preferred variant.

As far as behavior of the upstream quickjs interpreter, I don't understand the underlying code enough to give a confident answer. You can try asking folks at quickjs-ng quickjs-ng issues, the upstream bellard/quickjs issues or the mailing list

@angrymouse
Copy link
Author

Thank you! Will do.

@justjake justjake added the question Further information is requested label Feb 12, 2024
@Lohann
Copy link

Lohann commented Jun 22, 2024

@angrymouse I think just for the fact that all numbers in javascript are IEEE-754 float, I don't think is possible to guarantee determinism across different machines without emulate all numbers (which can make it very slow):
https://gafferongames.com/post/floating_point_determinism/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community discussion or information question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants