Bump deps and fix build

This commit is contained in:
Demi M. Obenour
2020-06-25 21:14:00 -04:00
parent f15c5f6373
commit d3df9eabe0
13 changed files with 97 additions and 104 deletions
+2 -1
View File
@@ -30,6 +30,7 @@ use serde::de::DeserializeOwned;
use sp_runtime::{
traits::{
AtLeast32Bit,
AtLeast32BitUnsigned,
Bounded,
CheckEqual,
Extrinsic,
@@ -67,7 +68,7 @@ pub trait System {
+ MaybeSerializeDeserialize
+ Debug
+ MaybeDisplay
+ AtLeast32Bit
+ AtLeast32BitUnsigned
+ Default
+ Bounded
+ Copy
+1 -1
View File
@@ -248,7 +248,7 @@ impl<T: Runtime> Client<T> {
/// Get a block hash. By default returns the latest block hash
pub async fn block_hash(
&self,
block_number: Option<BlockNumber<T>>,
block_number: Option<BlockNumber>,
) -> Result<Option<T::Hash>, Error> {
let hash = self.rpc.block_hash(block_number).await?;
Ok(hash)
+8 -17
View File
@@ -83,23 +83,15 @@ pub type ChainBlock<T> =
/// Wrapper for NumberOrHex to allow custom From impls
#[derive(Serialize, Debug)]
#[serde(bound = "<T as System>::BlockNumber: Serialize")]
pub struct BlockNumber<T: System>(NumberOrHex<<T as System>::BlockNumber>);
pub struct BlockNumber(NumberOrHex);
impl<T> From<NumberOrHex<<T as System>::BlockNumber>> for BlockNumber<T>
where
T: System,
{
fn from(x: NumberOrHex<<T as System>::BlockNumber>) -> Self {
impl From<NumberOrHex> for BlockNumber {
fn from(x: NumberOrHex) -> Self {
BlockNumber(x)
}
}
impl<T> From<u32> for BlockNumber<T>
where
T: System,
<T as System>::BlockNumber: From<u32>,
{
impl From<u32> for BlockNumber {
fn from(x: u32) -> Self {
NumberOrHex::Number(x.into()).into()
}
@@ -159,10 +151,9 @@ impl<T: Runtime> Rpc<T> {
}
/// Fetch the genesis hash
pub async fn genesis_hash(&self) -> Result<T::Hash, Error> {
let block_zero = Some(ListOrValue::Value(NumberOrHex::Number(
T::BlockNumber::min_value(),
)));
pub async fn genesis_hash(&self) -> Result<T::Hash, Error>
{
let block_zero = Some(ListOrValue::Value(NumberOrHex::Number(0)));
let params = Params::Array(vec![to_json_value(block_zero)?]);
let list_or_value: ListOrValue<Option<T::Hash>> =
self.client.request("chain_getBlockHash", params).await?;
@@ -198,7 +189,7 @@ impl<T: Runtime> Rpc<T> {
/// Get a block hash, returns hash of latest block by default
pub async fn block_hash(
&self,
block_number: Option<BlockNumber<T>>,
block_number: Option<BlockNumber>,
) -> Result<Option<T::Hash>, Error> {
let block_number = block_number.map(ListOrValue::Value);
let params = Params::Array(vec![to_json_value(block_number)?]);
+6 -9
View File
@@ -79,7 +79,6 @@ impl sp_runtime::BoundToRuntimeAppPublic for AuthorityDiscovery {
type Public = AuthorityDiscoveryId;
}
#[cfg(feature = "kusama")]
impl_opaque_keys! {
/// Substrate base runtime keys
pub struct BasicSessionKeys {
@@ -96,7 +95,6 @@ impl_opaque_keys! {
}
}
#[cfg(feature = "kusama")]
impl_opaque_keys! {
/// Polkadot/Kusama runtime keys
pub struct SessionKeys {
@@ -124,9 +122,7 @@ use crate::{
AccountData,
Balances,
},
contracts::Contracts,
sudo::Sudo,
system::System,
},
session::Session,
staking::Staking,
@@ -235,6 +231,12 @@ impl Balances for NodeTemplateRuntime {
type Balance = u128;
}
impl Session for NodeTemplateRuntime {
type SessionIndex = u32;
type ValidatorId = <Self as System>::AccountId;
type Keys = BasicSessionKeys;
}
impl Sudo for NodeTemplateRuntime {}
/// Concrete type definitions compatible with those for kusama, v0.7
@@ -243,17 +245,14 @@ impl Sudo for NodeTemplateRuntime {}
///
/// Main difference is `type Address = AccountId`.
/// Also the contracts module is not part of the kusama runtime.
#[cfg(feature = "kusama")]
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct KusamaRuntime;
#[cfg(feature = "kusama")]
impl Runtime for KusamaRuntime {
type Signature = MultiSignature;
type Extra = DefaultExtra<Self>;
}
#[cfg(feature = "kusama")]
impl System for KusamaRuntime {
type Index = u32;
type BlockNumber = u32;
@@ -266,14 +265,12 @@ impl System for KusamaRuntime {
type AccountData = AccountData<<Self as Balances>::Balance>;
}
#[cfg(feature = "kusama")]
impl Session for KusamaRuntime {
type SessionIndex = u32;
type ValidatorId = <Self as System>::AccountId;
type Keys = SessionKeys;
}
#[cfg(feature = "kusama")]
impl Staking for KusamaRuntime {
type NominatorIndex = u32;
type ValidatorIndex = u16;
+1
View File
@@ -56,6 +56,7 @@ pub trait Signer<T: Runtime> {
}
/// Extrinsic signer using a private key.
#[derive(Debug)]
pub struct PairSigner<T: Runtime, P: Pair> {
account_id: T::AccountId,
nonce: Option<T::Index>,
+1
View File
@@ -33,6 +33,7 @@ use crate::{
/// Event subscription simplifies filtering a storage change set stream for
/// events of interest.
#[allow(missing_debug_implementations)]
pub struct EventSubscription<T: Runtime> {
subscription: Subscription<StorageChangeSet<T::Hash>>,
decoder: EventsDecoder<T>,