-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add base & implementation solidity contracts to demo secure randomness #20
Conversation
v1.9.2
dd90877
to
5459027
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great docs and nice example 👏🏼
I've added minor comments about the mentions of PRG. I noticed from other discussions that PRGs and their purpose have been causing confusion so I suggest to only mention them when needed (their purpose being to expand a small source into many bytes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👏
Co-authored-by: Tarak Ben Youssef <[email protected]>
326635c
to
5861871
Compare
|
||
// fulfill the random request | ||
uint64 randomResult = _fulfillRandomness(uint32(requestId)); | ||
uint8 coinFace = uint8(randomResult % 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tarakby is it safe to use modulo here to represent a resulting heads or tails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the modulo use is safe when the modulo divides the initial random range. For instance here 2
divides 2^64
. In this case there won't be any bias
I was running into issues with |
Closes: #17
Description