mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-11-29 05:49:55 +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:
1 parent
6c2dd28dfb
commit
b6294418f8
34 files changed
+549
-445
No files matched your search
@@ -26,7 +26,7 @@ use sp_inherents::{InherentDataProviders, ProvideInherentData};
|
||||
pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"auraslot";
|
||||
|
||||
/// The type of the Aura inherent.
|
||||
pub type InherentType = u64;
|
||||
pub type InherentType = sp_consensus_slots::Slot;
|
||||
|
||||
/// Auxiliary trait to extract Aura inherent data.
|
||||
pub trait AuraInherentData {
|
||||
@@ -87,8 +87,8 @@ impl ProvideInherentData for InherentDataProvider {
|
||||
use sp_timestamp::TimestampInherentData;
|
||||
|
||||
let timestamp = inherent_data.timestamp_inherent_data()?;
|
||||
let slot_num = timestamp / self.slot_duration;
|
||||
inherent_data.put_data(INHERENT_IDENTIFIER, &slot_num)
|
||||
let slot = timestamp / self.slot_duration;
|
||||
inherent_data.put_data(INHERENT_IDENTIFIER, &slot)
|
||||
}
|
||||
|
||||
fn error_to_string(&self, error: &[u8]) -> Option<String> {
|
||||
|
||||
Reference in new issue
Block a user