You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.
Also this can help: https://nodejs.org/api/vm.html, as it allows to build a sandbox in which the entire context guarantees deterministic behaviour (e.g. Math.random is predictable, etc.); some things might still be tricky,, e.g. floating point arithmetic (not sure if that's non-deterministic in v8 though)
also there's this issue: #11, which has a nice enhancement idea
The text was updated successfully, but these errors were encountered:
Random is never a good idea in blockchains, since it's easy for miners to manipulate it by submitting various junk transactions to manipulate current block-hash so as to modify current random state, if it's based on block-hash of previous block, which is the only reliable source of random. What you can do is to have a "contract" or piece of code force a user to commit to a transaction in a block which is ex 5 blocks from now, being their random number seed, and then actually perform the "dice" roll at that time
Currently it's up to the developer to ensure the logic implemented directly in the app is deterministic, but it would definitely be nice to make it harder to accidentally create non-determinism.
There is currently work being done by @keppel to encapsulate contracts into WebAssembly VMs which are purely deterministic by default (I believe this will be published soon).
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
IMHO this framework should do more to ensure the tx handling/general behaviour is deterministic
There are a bunch of ways to do this, one of them seems really useful: https://deterministic.js.org
Also this can help: https://nodejs.org/api/vm.html, as it allows to build a sandbox in which the entire context guarantees deterministic behaviour (e.g.
Math.random
is predictable, etc.); some things might still be tricky,, e.g. floating point arithmetic (not sure if that's non-deterministic in v8 though)also there's this issue: #11, which has a nice enhancement idea
The text was updated successfully, but these errors were encountered: