Skip to content
This repository was archived by the owner on Jul 4, 2022. It is now read-only.

Commit 5da1a8c

Browse files
jordy25519bkchr
andauthored
Fix compilation with latest nightly (#162)
* 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 * CI use latest nightly Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
1 parent d3d9596 commit 5da1a8c

File tree

31 files changed

+103
-63
lines changed

31 files changed

+103
-63
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ commands:
1313
source ~/.cargo/env
1414
rustup install $RUST_VERSION
1515
rustup default $RUST_VERSION
16-
rustup install nightly-2020-04-17
17-
rustup target add wasm32-unknown-unknown --toolchain=nightly-2020-04-17
16+
rustup install nightly
17+
rustup target add wasm32-unknown-unknown --toolchain=nightly
1818
rustup target add x86_64-unknown-linux-musl --toolchain=$RUST_VERSION
1919
export RUSTC_WRAPPER="" # sccache is uninstalled at this point so it must be unset here for `wasm-gc` install
2020
command -v wasm-gc || cargo install --git https://github.com/alexcrichton/wasm-gc --force

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/cli/src/commands/export_blocks_cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl ExportBlocksCmd {
8585
info!("DB path: {}", path.display());
8686
}
8787

88-
let from = self.from.as_ref().and_then(|f| f.parse().ok()).unwrap_or(1);
88+
let from = self.from.as_ref().and_then(|f| f.parse().ok()).unwrap_or(1u32);
8989
let to = self.to.as_ref().and_then(|t| t.parse().ok());
9090

9191
let binary = self.binary;

client/finality-grandpa/src/voting_rule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl<Block, B> Default for VotingRulesBuilder<Block, B> where
241241
{
242242
fn default() -> Self {
243243
VotingRulesBuilder::new()
244-
.add(BeforeBestBlockBy(2.into()))
244+
.add(BeforeBestBlockBy(2u32.into()))
245245
.add(ThreeQuartersOfTheUnfinalizedChain)
246246
}
247247
}

client/informant/src/display.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn speed<B: BlockT>(
168168
} else {
169169
// If the number of blocks can't be converted to a regular integer, then we need a more
170170
// algebraic approach and we stay within the realm of integers.
171-
let one_thousand = NumberFor::<B>::from(1_000);
171+
let one_thousand = NumberFor::<B>::from(1_000u32);
172172
let elapsed = NumberFor::<B>::from(
173173
<u32 as TryFrom<_>>::try_from(elapsed_ms).unwrap_or(u32::max_value())
174174
);

client/network/src/light_client_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ mod tests {
14291429
_: ChangesProof<B::Header>
14301430
) -> Result<Vec<(NumberFor<B>, u32)>, ClientError> {
14311431
match self.ok {
1432-
true => Ok(vec![(100.into(), 2)]),
1432+
true => Ok(vec![(100u32.into(), 2)]),
14331433
false => Err(ClientError::Backend("Test error".into())),
14341434
}
14351435
}

client/service/src/chain_ops/export_blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ where
8787
// Reached end of the chain.
8888
None => return Poll::Ready(Ok(())),
8989
}
90-
if (block % 10000.into()).is_zero() {
90+
if (block % 10000u32.into()).is_zero() {
9191
info!("#{}", block);
9292
}
9393
if block == last {

client/service/src/chain_ops/import_blocks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl<B: BlockT> Speedometer<B> {
200200
/// Creates a fresh Speedometer.
201201
fn new() -> Self {
202202
Self {
203-
best_number: NumberFor::<B>::from(0),
203+
best_number: NumberFor::<B>::from(0u32),
204204
last_number: None,
205205
last_update: Instant::now(),
206206
}
@@ -232,7 +232,7 @@ impl<B: BlockT> Speedometer<B> {
232232
} else {
233233
// If the number of blocks can't be converted to a regular integer, then we need a more
234234
// algebraic approach and we stay within the realm of integers.
235-
let one_thousand = NumberFor::<B>::from(1_000);
235+
let one_thousand = NumberFor::<B>::from(1_000u32);
236236
let elapsed = NumberFor::<B>::from(
237237
<u32 as TryFrom<_>>::try_from(elapsed_ms).unwrap_or(u32::max_value())
238238
);

client/service/src/client/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use sp_runtime::{
3838
generic::{BlockId, SignedBlock, DigestItem},
3939
traits::{
4040
Block as BlockT, Header as HeaderT, Zero, NumberFor,
41-
HashFor, SaturatedConversion, One, DigestFor,
41+
HashFor, SaturatedConversion, One, DigestFor, UniqueSaturatedInto,
4242
},
4343
};
4444
use sp_state_machine::{
@@ -1139,7 +1139,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
11391139
let mut ancestor = load_header(ancestor_hash)?;
11401140
let mut uncles = Vec::new();
11411141

1142-
for _generation in 0..max_generation.saturated_into() {
1142+
for _generation in 0u32..UniqueSaturatedInto::<u32>::unique_saturated_into(max_generation) {
11431143
let children = self.backend.blockchain().children(ancestor_hash)?;
11441144
uncles.extend(children.into_iter().filter(|h| h != &current_hash));
11451145
current_hash = ancestor_hash;

client/service/src/metrics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ impl MetricsService {
316316
);
317317

318318
if let Some(metrics) = self.metrics.as_ref() {
319-
let best_seen_block = net_status
319+
let best_seen_block: Option<u64> = net_status
320320
.best_seen_block
321-
.map(|num: NumberFor<T>| num.unique_saturated_into() as u64);
321+
.map(|num: NumberFor<T>| UniqueSaturatedInto::<u64>::unique_saturated_into(num));
322322

323323
if let Some(best_seen_block) = best_seen_block {
324324
metrics.block_height.with_label_values(&["sync_target"]).set(best_seen_block);

0 commit comments

Comments
 (0)