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

Ensure determinism #94

Closed
damip opened this issue Jan 30, 2022 Discussed in #73 · 7 comments
Closed

Ensure determinism #94

damip opened this issue Jan 30, 2022 Discussed in #73 · 7 comments
Assignees
Labels
P1 Top priority

Comments

@damip
Copy link
Member

damip commented Jan 30, 2022

Discussed in #73

Originally posted by damip January 9, 2022
To make sure execution is deterministic we need to:

@damip damip moved this to Todo - for that week in Smart Contracts Jan 30, 2022
@damip damip moved this to Todo this week in Big refactoring Jan 30, 2022
@damip damip removed this from Big refactoring Feb 14, 2022
@damip damip added the P1 Top priority label Feb 14, 2022
@yvan-sraka yvan-sraka removed their assignment Apr 6, 2022
@gterzian
Copy link
Contributor

@gterzian
Copy link
Contributor

@gterzian
Copy link
Contributor

Except when otherwise specified, when an arithmetic operator returns NaN, there is nondeterminism in determining the specific bits of the NaN. However, wasm does still provide the guarantee that NaN values returned from an operation will not have 1 bits in their fraction field that aren't set in any NaN values in the input operands, except for the most significant bit of the fraction field (which most operators set to 1).
Except when otherwise specified, when an arithmetic operator with a floating point result type receives no NaN input values and produces a NaN result value, the sign bit of the NaN result value is nondeterministic.

Are these two fixed by using canonical nans? Source: https://github.com/WebAssembly/design/blob/037c6fe94151eb13e30d174f5f7ce851be0a573e/Nondeterminism.md

@damip
Copy link
Member Author

damip commented Apr 11, 2022

Are these two fixed by using canonical nans?

should be, yes

@damip
Copy link
Member Author

damip commented Apr 11, 2022

The only remaining potential source of nondeterminism is the stack limit.
This needs more study.

@gterzian
Copy link
Contributor

The only remaining potential source of nondeterminism is the stack limit.
This needs more study.

This seems like a good starting point: wasmerio/wasmer#2807

bors bot added a commit that referenced this issue Apr 11, 2022
124: Remove several sources of non-determinism r=damip a=damip

For determinism: #94

Co-authored-by: damip <[email protected]>
Co-authored-by: gterzian <[email protected]>
@damip
Copy link
Member Author

damip commented May 5, 2022

Based on the discussion with Wasmer people, https://github.com/massalabs/massa-sc-runtime/pull/127/files adds stack checks. This should be enough to ensure determinism

@damip damip closed this as completed May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 Top priority
Projects
No open projects
Status: Todo - for that week
Development

No branches or pull requests

5 participants