Trait forest_filecoin::beacon::drand::Beacon
source · pub trait Beacon{
// Required methods
fn network(&self) -> DrandNetwork;
fn verify_entries(
&self,
entries: &[BeaconEntry],
prev: &BeaconEntry,
) -> Result<bool, Error>;
fn entry<'life0, 'async_trait>(
&'life0 self,
round: u64,
) -> Pin<Box<dyn Future<Output = Result<BeaconEntry>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn max_beacon_round_for_epoch(
&self,
network_version: NetworkVersion,
fil_epoch: i64,
) -> u64;
}
Expand description
Trait used as the interface to be able to retrieve bytes from a randomness beacon.
Required Methods§
sourcefn network(&self) -> DrandNetwork
fn network(&self) -> DrandNetwork
Gets the drand
network
sourcefn verify_entries(
&self,
entries: &[BeaconEntry],
prev: &BeaconEntry,
) -> Result<bool, Error>
fn verify_entries( &self, entries: &[BeaconEntry], prev: &BeaconEntry, ) -> Result<bool, Error>
Verify beacon entries that are sorted by round.
sourcefn entry<'life0, 'async_trait>(
&'life0 self,
round: u64,
) -> Pin<Box<dyn Future<Output = Result<BeaconEntry>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn entry<'life0, 'async_trait>(
&'life0 self,
round: u64,
) -> Pin<Box<dyn Future<Output = Result<BeaconEntry>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a BeaconEntry
given a round. It fetches the BeaconEntry
from a Drand
node over gRPC
In the future, we will cache values, and support streaming.
sourcefn max_beacon_round_for_epoch(
&self,
network_version: NetworkVersion,
fil_epoch: i64,
) -> u64
fn max_beacon_round_for_epoch( &self, network_version: NetworkVersion, fil_epoch: i64, ) -> u64
Returns the most recent beacon round for the given Filecoin chain epoch.
Trait Implementations§
source§impl Beacon for Box<dyn Beacon>
impl Beacon for Box<dyn Beacon>
source§fn network(&self) -> DrandNetwork
fn network(&self) -> DrandNetwork
Gets the
drand
networksource§fn verify_entries(
&self,
entries: &[BeaconEntry],
prev: &BeaconEntry,
) -> Result<bool, Error>
fn verify_entries( &self, entries: &[BeaconEntry], prev: &BeaconEntry, ) -> Result<bool, Error>
Verify beacon entries that are sorted by round.
source§fn entry<'life0, 'async_trait>(
&'life0 self,
round: u64,
) -> Pin<Box<dyn Future<Output = Result<BeaconEntry, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn entry<'life0, 'async_trait>(
&'life0 self,
round: u64,
) -> Pin<Box<dyn Future<Output = Result<BeaconEntry, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a
BeaconEntry
given a round. It fetches the BeaconEntry
from a Drand
node over gRPC
In the future, we will cache values, and support streaming.source§fn max_beacon_round_for_epoch(
&self,
network_version: NetworkVersion,
fil_epoch: i64,
) -> u64
fn max_beacon_round_for_epoch( &self, network_version: NetworkVersion, fil_epoch: i64, ) -> u64
Returns the most recent beacon round for the given Filecoin chain epoch.