-
Notifications
You must be signed in to change notification settings - Fork 139
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
feat: FVM no longer draws randomness for you #1848
Conversation
Codecov Report
|
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.
Logic LGTM
fvm/src/kernel/default.rs
Outdated
// TODO | ||
.on_get_randomness(), |
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.
Let's pass in the lookback length and put this "todo" in the price list itself (that way, all of our todos are in the price-list side of things and we can merge this before we necessarily have final gas numbers.
089a574
to
1f27adf
Compare
fvm/src/kernel/default.rs
Outdated
let t = self.call_manager.charge_gas( | ||
self.call_manager | ||
.price_list() | ||
.on_get_randomness(entropy.len()), | ||
.on_get_randomness(self.call_manager.context().epoch - rand_epoch), |
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.
.on_get_randomness(self.call_manager.context().epoch - rand_epoch), | |
.on_get_randomness(current_epoch - rand_epoch), |
1f27adf
to
1f6c418
Compare
1f6c418
to
cc35c99
Compare
Nest step: disable conformance tests in |
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 have carefully checked that we're using the right randomness functions.
(and I swear to never build another blockchain with two randomness functions)
fvm/src/kernel/default.rs
Outdated
) -> Result<[u8; RANDOMNESS_LENGTH]> { | ||
let current_epoch = self.call_manager.context().epoch; | ||
if rand_epoch > current_epoch { |
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.
FYI... it is possible to write this as:
if rand_epoch > current_epoch { | |
let lookback = current_epoch.checked_sub(rand_epoch) | |
.ok_or_else(syscall_error!(IllegalArgument; "randomness epoch {} is in the future", rand_epoch))?; |
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.
(lets you skip the subtraction below)
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.
Not that you necessarily should do it this way. I just figured I'd let you know.
sdk/src/rand.rs
Outdated
round: ChainEpoch, | ||
entropy: &[u8], | ||
) -> SyscallResult<[u8; RANDOMNESS_LENGTH]> { | ||
let ret = unsafe { | ||
sys::rand::get_beacon_randomness(dst, round, entropy.as_ptr(), entropy.len() as u32)? | ||
}; | ||
pub fn get_beacon_randomness(round: ChainEpoch) -> SyscallResult<[u8; RANDOMNESS_LENGTH]> { | ||
let ret = unsafe { sys::rand::get_beacon_randomness(round)? }; | ||
Ok(ret) |
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.
nit: no need for the temporary ret
variable, the entire function can be written as:
unsafe { sys::rand::get_beacon_randomness(round) }
* feat: FVM no longer draws randomness for you * update actors bundle * address review * disable Hygge test vectors
* feat: FVM no longer draws randomness for you * update actors bundle * address review * disable Hygge test vectors
* feat: FVM no longer draws randomness for you * update actors bundle * address review * disable Hygge test vectors
#1847
I might need to iron out the FVM-actors-FVM dependencies for green CI, but should be reviewable.