-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Correct BABE randomness by calculating InOut bytes directly in pallet #5876
Conversation
frame/babe/src/lib.rs
Outdated
transcript | ||
).ok() | ||
}) | ||
.and_then(|inout| { |
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 could be a map
, right?
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 could be folded into the previous and_then
, no?
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.
Yeah this could be a map
. I'll change it.
Folded into previous and_then
also works, but I think that will make the code more nested.
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.
LGTM but should have a review from @burdges and @andresilva as well.
You wrote "the validity of the VRF is now also checked within runtime"? Where? Is it due to removing the distinction between If I read https://github.com/paritytech/substrate/pull/5876/files#diff-7ed093bfcad10b5194ca35132db3dfeaR493-R503 correctly, you just make the |
Yeah. So |
All invocations of Can you explain the original distinction between |
Wait. Are you saying that because the host now supplies the |
@burdges Yeah sorry if I wasn't entirely clear before. It's not the entire VRF check -- only the formatting check of those https://github.com/w3f/schnorrkel/blob/master/src/vrf.rs#L514 Previously those formatting check did not happen in runtime -- runtime accepted everything. |
Cool. I'm satisfied that I'm not miss-reading the code. It seems fine. :) I think this and #5788 looks pretty similar from my perspective, so whatever you guys prefer. |
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.
too late but lgtm.
This is an alternative to #5788. Fixes #5785.
All
Raw*
types are removed, and within pallet it will use the types directly in schnorrkel. As a result, the validity of the VRF is now also checked within runtime. With this, we can then use schnorrkel's method to regenerate theInOut
directly in the pallet.