-
Notifications
You must be signed in to change notification settings - Fork 19
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
runtime-sdk: add RNG #1037
runtime-sdk: add RNG #1037
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1037 +/- ##
==========================================
- Coverage 65.18% 64.58% -0.61%
==========================================
Files 134 135 +1
Lines 12309 12356 +47
==========================================
- Hits 8024 7980 -44
- Misses 4253 4344 +91
Partials 32 32
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
33622cc
to
137e691
Compare
As a side note: Do we want to expose a VRF construct somewhere so that it would be easy to make a chainlink VRF knockoff? I think to do it "correctly", you would need prove, verify, and proof to hash (roughly speaking the chainlink design is a 2-step process: commit to alpha in one step, retrieve pi/beta in another step). This is done so that properly coded applications can prevent users/executors/etc from fishing for an alpha value (because it is committed), to get a beta that produces a desired result. |
8daaced
to
a81fc48
Compare
I like having an integrated way to do domain-separation. The case when nothing is provided should (still) be secure if this is done correctly. |
a81fc48
to
27d4924
Compare
2e0a445
to
b8b6752
Compare
9fb592b
to
3e86f5e
Compare
3e86f5e
to
90e6d6c
Compare
15d71e2
to
de91b23
Compare
@@ -19,7 +19,8 @@ hmac = "0.11.0" | |||
sha2 = "0.9.8" | |||
sha3 = { version = "0.10.1", default-features = false } | |||
k256 = { version = "0.10.4" } | |||
schnorrkel = "0.10.2" | |||
schnorrkel = { version = "0.10.2", features = ["asm", "avx2_backend"] } |
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.
I assume these instruction sets are fast and supported (@Yawning).
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.
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.
this is why we can't have nice things. I'll disable it :P
4 GHz and ancient SIMD. I don't know what's going on here.
c0f9d5f
to
a7680f3
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.
I know you merged this, but 2 comments.
impl Default for MockEnv { | ||
fn default() -> Self { | ||
Self { | ||
rng: Arc::new(Mutex::new(XorShiftRng::seed_from_u64(0))), |
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.
Should this be deterministic?
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.
it helps if you need to hardcode values into tests or something
@@ -19,7 +19,8 @@ hmac = "0.11.0" | |||
sha2 = "0.9.8" | |||
sha3 = { version = "0.10.1", default-features = false } | |||
k256 = { version = "0.10.4" } | |||
schnorrkel = "0.10.2" | |||
schnorrkel = { version = "0.10.2", features = ["asm", "avx2_backend"] } |
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.
This PR adds a VRF-based RNG to the contract and EVM modules.