Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ mod tests {
let chain_spec = crate::chain_spec::tests::integration_test_config_with_single_authority();

// For the block factory
let mut slot_num = 1u64;
let mut slot = 1u64;

// For the extrinsics factory
let bob = Arc::new(AccountKeyring::Bob.pair());
Expand Down Expand Up @@ -575,17 +575,17 @@ mod tests {
descendent_query(&*service.client()),
&parent_hash,
parent_number,
slot_num,
slot.into(),
).unwrap().unwrap();

let mut digest = Digest::<H256>::default();

// even though there's only one authority some slots might be empty,
// so we must keep trying the next slots until we can claim one.
let babe_pre_digest = loop {
inherent_data.replace_data(sp_timestamp::INHERENT_IDENTIFIER, &(slot_num * SLOT_DURATION));
inherent_data.replace_data(sp_timestamp::INHERENT_IDENTIFIER, &(slot * SLOT_DURATION));
if let Some(babe_pre_digest) = sc_consensus_babe::test_helpers::claim_slot(
slot_num,
slot.into(),
&parent_header,
&*service.client(),
keystore.clone(),
Expand All @@ -594,7 +594,7 @@ mod tests {
break babe_pre_digest;
}

slot_num += 1;
slot += 1;
};

digest.push(<DigestItem as CompatibleDigestItem>::babe_pre_digest(babe_pre_digest));
Expand Down Expand Up @@ -625,7 +625,7 @@ mod tests {
let item = <DigestItem as CompatibleDigestItem>::babe_seal(
signature,
);
slot_num += 1;
slot += 1;

let mut params = BlockImportParams::new(BlockOrigin::File, new_header);
params.post_digests.push(item);
Expand Down
4 changes: 2 additions & 2 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ impl_runtime_apis! {
}
}

fn current_epoch_start() -> sp_consensus_babe::SlotNumber {
fn current_epoch_start() -> sp_consensus_babe::Slot {
Babe::current_epoch_start()
}

Expand All @@ -1199,7 +1199,7 @@ impl_runtime_apis! {
}

fn generate_key_ownership_proof(
_slot_number: sp_consensus_babe::SlotNumber,
_slot: sp_consensus_babe::Slot,
authority_id: sp_consensus_babe::AuthorityId,
) -> Option<sp_consensus_babe::OpaqueKeyOwnershipProof> {
use codec::Encode;
Expand Down
1 change: 1 addition & 0 deletions client/consensus/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sc-block-builder = { version = "0.8.0", path = "../../block-builder" }
sc-client-api = { version = "2.0.0", path = "../../api" }
codec = { package = "parity-scale-codec", version = "1.3.6" }
sp-consensus = { version = "0.8.0", path = "../../../primitives/consensus/common" }
sp-consensus-slots = { version = "0.8.0", path = "../../../primitives/consensus/slots" }
derive_more = "0.99.2"
futures = "0.3.9"
futures-timer = "3.0.1"
Expand Down
11 changes: 6 additions & 5 deletions client/consensus/aura/src/digests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use sp_core::Pair;
use sp_consensus_aura::AURA_ENGINE_ID;
use sp_runtime::generic::{DigestItem, OpaqueDigestItemId};
use sp_consensus_slots::Slot;
use codec::{Encode, Codec};
use std::fmt::Debug;

Expand All @@ -38,10 +39,10 @@ pub trait CompatibleDigestItem<P: Pair>: Sized {
fn as_aura_seal(&self) -> Option<Signature<P>>;

/// Construct a digest item which contains the slot number
fn aura_pre_digest(slot_num: u64) -> Self;
fn aura_pre_digest(slot: Slot) -> Self;

/// If this item is an AuRa pre-digest, return the slot number
fn as_aura_pre_digest(&self) -> Option<u64>;
fn as_aura_pre_digest(&self) -> Option<Slot>;
}

impl<P, Hash> CompatibleDigestItem<P> for DigestItem<Hash> where
Expand All @@ -57,11 +58,11 @@ impl<P, Hash> CompatibleDigestItem<P> for DigestItem<Hash> where
self.try_to(OpaqueDigestItemId::Seal(&AURA_ENGINE_ID))
}

fn aura_pre_digest(slot_num: u64) -> Self {
DigestItem::PreRuntime(AURA_ENGINE_ID, slot_num.encode())
fn aura_pre_digest(slot: Slot) -> Self {
DigestItem::PreRuntime(AURA_ENGINE_ID, slot.encode())
}

fn as_aura_pre_digest(&self) -> Option<u64> {
fn as_aura_pre_digest(&self) -> Option<Slot> {
self.try_to(OpaqueDigestItemId::PreRuntime(&AURA_ENGINE_ID))
}
}
Loading