mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
Remove As (#2602)
* Start to remove the `As` bound on `SimpleArtithmetic` This just introduces standard numeric bounds, assuming a minimum of `u32`. Also included is a saturating from/into trait allowing ergonomic infallible conversion when you don't care if it saturates. * Remove As from Balances trait * Remove As from Aura module * Remove As from Babe module * Expunge `As` from contract * Council module * Democracy * Finality tracker * Grandpa * First bit of indices * indices * Line lengths * session * system * Staking * Square up all other uses of As. * RHD update * Fix build/test * Remove As trait * line widths * Remove final As ref * Update srml/staking/src/lib.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update core/client/src/cht.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update core/client/db/src/light.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * whitespace * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> Co-Authored-By: André Silva <andre.beat@gmail.com> * Bring back u32 check for number on CLI
This commit is contained in:
@@ -33,7 +33,10 @@ use primitives::storage::{self, StorageKey, StorageData, StorageChangeSet};
|
||||
use crate::rpc::Result as RpcResult;
|
||||
use crate::rpc::futures::{stream, Future, Sink, Stream};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{Block as BlockT, Header, ProvideRuntimeApi, As, NumberFor};
|
||||
use runtime_primitives::traits::{
|
||||
Block as BlockT, Header, ProvideRuntimeApi, NumberFor,
|
||||
SaturatedConversion
|
||||
};
|
||||
use runtime_version::RuntimeVersion;
|
||||
use state_machine::{self, ExecutionStrategy};
|
||||
|
||||
@@ -229,7 +232,7 @@ impl<B, E, Block: BlockT, RA> State<B, E, Block, RA> where
|
||||
};
|
||||
// check if we can filter blocks-with-changes from some (sub)range using changes tries
|
||||
let changes_trie_range = self.client.max_key_changes_range(from_number, BlockId::Hash(to.hash()))?;
|
||||
let filtered_range_begin = changes_trie_range.map(|(begin, _)| (begin - from_number).as_() as usize);
|
||||
let filtered_range_begin = changes_trie_range.map(|(begin, _)| (begin - from_number).saturated_into::<usize>());
|
||||
let (unfiltered_range, filtered_range) = split_range(blocks.len(), filtered_range_begin);
|
||||
Ok(QueryStorageRange {
|
||||
hashes: blocks,
|
||||
@@ -281,7 +284,7 @@ impl<B, E, Block: BlockT, RA> State<B, E, Block, RA> where
|
||||
) -> Result<()> {
|
||||
let (begin, end) = match range.filtered_range {
|
||||
Some(ref filtered_range) => (
|
||||
range.first_number + As::sa(filtered_range.start as u64),
|
||||
range.first_number + filtered_range.start.saturated_into(),
|
||||
BlockId::Hash(range.hashes[filtered_range.end - 1].clone())
|
||||
),
|
||||
None => return Ok(()),
|
||||
@@ -293,7 +296,7 @@ impl<B, E, Block: BlockT, RA> State<B, E, Block, RA> where
|
||||
if last_block == Some(block) {
|
||||
continue;
|
||||
}
|
||||
let block_hash = range.hashes[(block - range.first_number).as_() as usize].clone();
|
||||
let block_hash = range.hashes[(block - range.first_number).saturated_into::<usize>()].clone();
|
||||
let id = BlockId::Hash(block_hash);
|
||||
let value_at_block = self.client.storage(&id, key)?;
|
||||
changes_map.entry(block)
|
||||
|
||||
Reference in New Issue
Block a user