Skip to content
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

docs: remove any mentions of randomness lookback limits #2034

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions sdk/src/sys/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@ use crate::sys::ErrorNumber::*;
super::fvm_syscalls! {
module = "rand";

/// Gets 32 bytes of randomness from the ticket chain.
/// Gets 32 bytes of randomness from the ticket chain,
/// there is no lookback limit.
///
/// # Arguments
///
/// - `epoch` is the epoch to pull the randomness from.
///
/// # Errors
///
/// | Error | Reason |
/// |---------------------|-------------------------|
/// | [`LimitExceeded`] | lookback exceeds limit. |
/// | [`IllegalArgument`] | invalid buffer, etc. |
/// | Error | Reason |
/// |---------------------|------------------------|
/// | [`IllegalArgument`] | epoch is in the future |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"epoch is not a valid prior epoch number"? e.g. negatives, too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll just return randomness from epoch 0. Historically it hashed it with the epoch number (giving each epoch unique randomness), now we expect that to happen in the actors themselves.

I'll document that. Also, I'll document null tipset behavior (or try to... it changes network version to network version).

pub fn get_chain_randomness(
epoch: i64,
) -> Result<[u8; RANDOMNESS_LENGTH]>;

/// Gets 32 bytes of randomness from the beacon system (currently Drand).
/// Gets 32 bytes of randomness from the beacon system
/// (currently Drand), there is no lookback limit.
///
/// # Arguments
///
/// - `epoch` is the epoch to pull the randomness from.
///
/// # Errors
///
/// | Error | Reason |
/// |---------------------|-------------------------|
/// | [`LimitExceeded`] | lookback exceeds limit. |
/// | [`IllegalArgument`] | invalid buffer, etc. |
/// | Error | Reason |
/// |---------------------|------------------------|
/// | [`IllegalArgument`] | epoch is in the future |
pub fn get_beacon_randomness(
epoch: i64,
) -> Result<[u8; RANDOMNESS_LENGTH]>;
Expand Down
Loading