mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 13:21:10 +00:00
Introduce a Slot type (#7997)
* Introduce a `Slot` type Instead of having some type definition that only was used in half of the code or directly using `u64`, this adds a new unit type wrapper `Slot`. This makes it especially easy for the outside api to know what type is expected/returned. * Change epoch duratioC * rename all instances of slot number to slot * Make the constructor private Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
use super::{
|
||||
AllowedSlots, AuthorityId, AuthorityIndex, AuthoritySignature, BabeAuthorityWeight,
|
||||
BabeEpochConfiguration, SlotNumber, BABE_ENGINE_ID,
|
||||
BabeEpochConfiguration, Slot, BABE_ENGINE_ID,
|
||||
};
|
||||
use codec::{Codec, Decode, Encode};
|
||||
use sp_std::vec::Vec;
|
||||
@@ -32,8 +32,8 @@ use sp_consensus_vrf::schnorrkel::{Randomness, VRFOutput, VRFProof};
|
||||
pub struct PrimaryPreDigest {
|
||||
/// Authority index
|
||||
pub authority_index: super::AuthorityIndex,
|
||||
/// Slot number
|
||||
pub slot_number: SlotNumber,
|
||||
/// Slot
|
||||
pub slot: Slot,
|
||||
/// VRF output
|
||||
pub vrf_output: VRFOutput,
|
||||
/// VRF proof
|
||||
@@ -50,8 +50,8 @@ pub struct SecondaryPlainPreDigest {
|
||||
/// it makes things easier for higher-level users of the chain data to
|
||||
/// be aware of the author of a secondary-slot block.
|
||||
pub authority_index: super::AuthorityIndex,
|
||||
/// Slot number
|
||||
pub slot_number: SlotNumber,
|
||||
/// Slot
|
||||
pub slot: Slot,
|
||||
}
|
||||
|
||||
/// BABE secondary deterministic slot assignment with VRF outputs.
|
||||
@@ -59,8 +59,8 @@ pub struct SecondaryPlainPreDigest {
|
||||
pub struct SecondaryVRFPreDigest {
|
||||
/// Authority index
|
||||
pub authority_index: super::AuthorityIndex,
|
||||
/// Slot number
|
||||
pub slot_number: SlotNumber,
|
||||
/// Slot
|
||||
pub slot: Slot,
|
||||
/// VRF output
|
||||
pub vrf_output: VRFOutput,
|
||||
/// VRF proof
|
||||
@@ -93,12 +93,12 @@ impl PreDigest {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the slot number of the pre digest.
|
||||
pub fn slot_number(&self) -> SlotNumber {
|
||||
/// Returns the slot of the pre digest.
|
||||
pub fn slot(&self) -> Slot {
|
||||
match self {
|
||||
PreDigest::Primary(primary) => primary.slot_number,
|
||||
PreDigest::SecondaryPlain(secondary) => secondary.slot_number,
|
||||
PreDigest::SecondaryVRF(secondary) => secondary.slot_number,
|
||||
PreDigest::Primary(primary) => primary.slot,
|
||||
PreDigest::SecondaryPlain(secondary) => secondary.slot,
|
||||
PreDigest::SecondaryVRF(secondary) => secondary.slot,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user