mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 07:47:57 +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:
@@ -22,8 +22,8 @@ use std::fmt;
|
||||
use rstd::prelude::*;
|
||||
use runtime_io::blake2_256;
|
||||
use crate::codec::{Decode, Encode, Input, Compact};
|
||||
use crate::traits::{self, Member, SimpleArithmetic, MaybeDisplay, CurrentHeight, BlockNumberToHash, Lookup,
|
||||
Checkable, Extrinsic};
|
||||
use crate::traits::{self, Member, SimpleArithmetic, MaybeDisplay, CurrentHeight, BlockNumberToHash,
|
||||
Lookup, Checkable, Extrinsic, SaturatedConversion};
|
||||
use super::{CheckedExtrinsic, Era};
|
||||
|
||||
const TRANSACTION_VERSION: u8 = 1;
|
||||
@@ -84,7 +84,8 @@ where
|
||||
fn check(self, context: &Context) -> Result<Self::Checked, &'static str> {
|
||||
Ok(match self.signature {
|
||||
Some((signed, signature, index, era)) => {
|
||||
let h = context.block_number_to_hash(BlockNumber::sa(era.birth(context.current_height().as_())))
|
||||
let current_u64 = context.current_height().saturated_into::<u64>();
|
||||
let h = context.block_number_to_hash(era.birth(current_u64).saturated_into())
|
||||
.ok_or("transaction birth block ancient")?;
|
||||
let signed = context.lookup(signed)?;
|
||||
let raw_payload = (index, self.function, era, h);
|
||||
|
||||
@@ -22,8 +22,10 @@ use std::fmt;
|
||||
use rstd::prelude::*;
|
||||
use runtime_io::blake2_256;
|
||||
use crate::codec::{Decode, Encode, Input};
|
||||
use crate::traits::{self, Member, SimpleArithmetic, MaybeDisplay, CurrentHeight, BlockNumberToHash, Lookup,
|
||||
Checkable, Extrinsic};
|
||||
use crate::traits::{
|
||||
self, Member, SimpleArithmetic, MaybeDisplay, CurrentHeight, BlockNumberToHash,
|
||||
Lookup, Checkable, Extrinsic, SaturatedConversion
|
||||
};
|
||||
use super::{CheckedExtrinsic, Era};
|
||||
|
||||
const TRANSACTION_VERSION: u8 = 1;
|
||||
@@ -83,7 +85,8 @@ where
|
||||
fn check(self, context: &Context) -> Result<Self::Checked, &'static str> {
|
||||
Ok(match self.signature {
|
||||
Some((signed, signature, index, era)) => {
|
||||
let h = context.block_number_to_hash(BlockNumber::sa(era.birth(context.current_height().as_())))
|
||||
let current_u64 = context.current_height().saturated_into::<u64>();
|
||||
let h = context.block_number_to_hash(era.birth(current_u64).saturated_into())
|
||||
.ok_or("transaction birth block ancient")?;
|
||||
let signed = context.lookup(signed)?;
|
||||
let raw_payload = (index, self.function, era, h);
|
||||
|
||||
Reference in New Issue
Block a user