-
Notifications
You must be signed in to change notification settings - Fork 146
Open
Labels
Milestone
Description
Currently, we need to pay an "extern" cost to get the randomness. However, we can pretty easily construct the FVM with 2x finality randomness information to avoid having to go back to the client to "fetch" it on demand.
Specifically, we need:
- The minimum VRFTicket from each tipset (96 bytes)
- The drand ticket from each tipset (32 bytes)
And we need 1800 of these.
Specifically, we should pass a Box
ed Randomness
as follows:
type VRFTicket = [u8; 96];
type DrandTicket = [u8; 32];
type EpochRandomness {
chain: VRFTicket, // all zeros means this was a null tipset (could also use a boolean flag?)
drand: DrandTicket,
}
// A ring buffer of 1800 epochs worth of randomness.
struct Randomness {
pub head: u64, // The first element in the ring buffer.
pub first_epoch: u64, // The first epoch in the ring buffer.
pub rand: [EpochRandomness; 1800], // a ring buffer of randomness.
}
The client would then "lend" a Box<Randomness>
to the FVM, updating the randomness between epochs.