Skip to content

Commit

Permalink
Backport paritytech#7381
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr authored and Xanewok committed Jan 6, 2021
1 parent a200cdb commit e4783a6
Show file tree
Hide file tree
Showing 52 changed files with 110 additions and 104 deletions.
48 changes: 24 additions & 24 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion client/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sc-cli"
version = "0.8.0"
version = "0.8.1"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Substrate CLI interface."
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion client/cli/src/commands/export_blocks_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl ExportBlocksCmd {
info!("DB path: {}", path.display());
}

let from = self.from.as_ref().and_then(|f| f.parse().ok()).unwrap_or(1);
let from = self.from.as_ref().and_then(|f| f.parse().ok()).unwrap_or(1u32);
let to = self.to.as_ref().and_then(|t| t.parse().ok());

let binary = self.binary;
Expand Down
2 changes: 1 addition & 1 deletion client/finality-grandpa/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sc-finality-grandpa"
version = "0.8.0"
version = "0.8.1"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
Expand Down
2 changes: 1 addition & 1 deletion client/finality-grandpa/src/voting_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl<Block, B> Default for VotingRulesBuilder<Block, B> where
{
fn default() -> Self {
VotingRulesBuilder::new()
.add(BeforeBestBlockBy(2.into()))
.add(BeforeBestBlockBy(2u32.into()))
.add(ThreeQuartersOfTheUnfinalizedChain)
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/informant/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sc-informant"
version = "0.8.0"
version = "0.8.1"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Substrate informant."
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion client/informant/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ fn speed<B: BlockT>(
} 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())
);
Expand Down
2 changes: 1 addition & 1 deletion client/network/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
description = "Substrate network protocol"
name = "sc-network"
version = "0.8.0"
version = "0.8.1"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion client/network/src/light_client_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ mod tests {
_: ChangesProof<B::Header>
) -> Result<Vec<(NumberFor<B>, u32)>, ClientError> {
match self.ok {
true => Ok(vec![(100.into(), 2)]),
true => Ok(vec![(100u32.into(), 2)]),
false => Err(ClientError::Backend("Test error".into())),
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sc-service"
version = "0.8.0"
version = "0.8.1"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
Expand Down
2 changes: 1 addition & 1 deletion client/service/src/chain_ops/export_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions client/service/src/chain_ops/import_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand Down Expand Up @@ -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())
);
Expand Down
4 changes: 2 additions & 2 deletions client/service/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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::{
Expand Down Expand Up @@ -1139,7 +1139,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;
Expand Down
4 changes: 2 additions & 2 deletions client/service/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion client/transaction-pool/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sc-transaction-pool"
version = "2.0.0"
version = "2.0.1"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
Expand Down
2 changes: 1 addition & 1 deletion client/transaction-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ impl<PoolApi, Block> MaintainedTransactionPool for BasicPool<PoolApi, Block>
let next_action = self.revalidation_strategy.lock().next(
block_number,
Some(std::time::Duration::from_secs(60)),
Some(20.into()),
Some(20u32.into()),
);
let revalidation_strategy = self.revalidation_strategy.clone();
let revalidation_queue = self.revalidation_queue.clone();
Expand Down
2 changes: 1 addition & 1 deletion frame/aura/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-aura"
version = "2.0.0"
version = "2.0.1"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions frame/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub trait Trait: pallet_timestamp::Trait {
decl_storage! {
trait Store for Module<T: Trait> as Aura {
/// The last timestamp.
LastTimestamp get(fn last) build(|_| 0.into()): T::Moment;
LastTimestamp get(fn last): T::Moment;

/// The current authorities
pub Authorities get(fn authorities): Vec<T::AuthorityId>;
Expand Down Expand Up @@ -196,7 +196,7 @@ impl<T: Trait> Module<T> {
pub fn slot_duration() -> T::Moment {
// we double the minimum block-period so each author can always propose within
// the majority of its slot.
<T as pallet_timestamp::Trait>::MinimumPeriod::get().saturating_mul(2.into())
<T as pallet_timestamp::Trait>::MinimumPeriod::get().saturating_mul(2u32.into())
}

fn on_timestamp_set(now: T::Moment, slot_duration: T::Moment) {
Expand Down
Loading

0 comments on commit e4783a6

Please sign in to comment.