Make Substrate compile with latest nightly (#7381)

* Try to get it compiling

* One more

* Make stable happy

* Make stable even more happy ;)

* Update shell.nix
This commit is contained in:
Bastian Köcher
2020-10-23 21:08:04 +02:00
committed by GitHub
parent 4366fe366a
commit 5808f467c5
29 changed files with 63 additions and 57 deletions
@@ -87,7 +87,7 @@ where
// Reached end of the chain.
None => return Poll::Ready(Ok(())),
}
if (block % 10000.into()).is_zero() {
if (block % 10000u32.into()).is_zero() {
info!("#{}", block);
}
if block == last {
@@ -200,7 +200,7 @@ impl<B: BlockT> Speedometer<B> {
/// Creates a fresh Speedometer.
fn new() -> Self {
Self {
best_number: NumberFor::<B>::from(0),
best_number: NumberFor::<B>::from(0u32),
last_number: None,
last_update: Instant::now(),
}
@@ -232,7 +232,7 @@ impl<B: BlockT> Speedometer<B> {
} else {
// If the number of blocks can't be converted to a regular integer, then we need a more
// algebraic approach and we stay within the realm of integers.
let one_thousand = NumberFor::<B>::from(1_000);
let one_thousand = NumberFor::<B>::from(1_000u32);
let elapsed = NumberFor::<B>::from(
<u32 as TryFrom<_>>::try_from(elapsed_ms).unwrap_or(u32::max_value())
);
@@ -40,7 +40,7 @@ use sp_runtime::{
generic::{BlockId, SignedBlock, DigestItem},
traits::{
Block as BlockT, Header as HeaderT, Zero, NumberFor,
HashFor, SaturatedConversion, One, DigestFor,
HashFor, SaturatedConversion, One, DigestFor, UniqueSaturatedInto,
},
};
use sp_state_machine::{
@@ -1141,7 +1141,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
let mut ancestor = load_header(ancestor_hash)?;
let mut uncles = Vec::new();
for _generation in 0..max_generation.saturated_into() {
for _generation in 0u32..UniqueSaturatedInto::<u32>::unique_saturated_into(max_generation) {
let children = self.backend.blockchain().children(ancestor_hash)?;
uncles.extend(children.into_iter().filter(|h| h != &current_hash));
current_hash = ancestor_hash;
+2 -2
View File
@@ -316,9 +316,9 @@ impl MetricsService {
);
if let Some(metrics) = self.metrics.as_ref() {
let best_seen_block = net_status
let best_seen_block: Option<u64> = net_status
.best_seen_block
.map(|num: NumberFor<T>| num.unique_saturated_into() as u64);
.map(|num: NumberFor<T>| UniqueSaturatedInto::<u64>::unique_saturated_into(num));
if let Some(best_seen_block) = best_seen_block {
metrics.block_height.with_label_values(&["sync_target"]).set(best_seen_block);