Skip to content

Construct the FVM with randomness info #525

@Stebalien

Description

@Stebalien

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:

  1. The minimum VRFTicket from each tipset (96 bytes)
  2. The drand ticket from each tipset (32 bytes)

And we need 1800 of these.

Specifically, we should pass a Boxed 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions