flow-go icon indicating copy to clipboard operation
flow-go copied to clipboard

[EVM] Add support for revertible random

Open devbugging opened this issue 9 months ago • 1 comments

Currently, we implemented access to random sources through a cadence arch contract, which uses the Flow history source of randomness contract and can be used with commit-reveal schemes to create non-revertible randomness.

However, it would be useful to also allow revertible random generation (revertible if the transaction execution is suspended after revealing the random results). Currently, we expose a random source for the current block in the EVM block field, which is not good since all random results of the same transaction and other transactions can be predicted by the execution environment. We should instead implement a new cadence arch function that uses the same source of randomness in the FVM backend as well as a Go PRG implementation to produce random output, this is then returned through the cadence arch function into EVM. This way we hide the random source and the PRG instance from the transaction execution environment and only expose the random results.

devbugging avatar May 07 '24 12:05 devbugging

The discussion thread that initiated the issue can be found on Discord: https://discord.com/channels/613813861610684416/1230199673629835375/1237010136032215121

devbugging avatar May 07 '24 15:05 devbugging