Upgrade to substrate 2.0.0 (#173)

* Upgrade to substrate 2.0.0

* WIP implement Subcommand manually (see https://github.com/paritytech/substrate/pull/6894#issuecomment-676060197)

* Add pallet-staking/std to the std feature

* Sort out the subcommand impl

* Sort out the module index (ty @ascjones)
Sort out the RefCount type (ty @dvc94ch)
Random tweaks to make test-node more similar to the vanilla node-template

* obey the fmt

* cleanup

* more cleanup
This commit is contained in:
David
2020-09-24 13:57:35 +02:00
committed by GitHub
parent 56bd633706
commit 8e2a4f06ee
14 changed files with 114 additions and 102 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ mod tests {
let event = client
.transfer_and_watch(&alice, &bob.account_id(), 10_000)
.await
.unwrap()
.expect("sending an xt works")
.transfer()
.unwrap()
.unwrap();
+1
View File
@@ -116,6 +116,7 @@ pub struct InstantiatedEvent<T: Contracts> {
}
#[cfg(test)]
#[cfg(feature = "integration-tests")]
mod tests {
use sp_keyring::AccountKeyring;
+2 -2
View File
@@ -57,7 +57,7 @@ pub struct ErasRewardPointsStore<T: Staking> {
#[derive(Clone, Encode, Decode, Debug, Call)]
pub struct SetPayeeCall<T: Staking> {
/// The payee
pub payee: RewardDestination,
pub payee: RewardDestination<T::AccountId>,
/// Marker for the runtime
pub _runtime: PhantomData<T>,
}
@@ -99,7 +99,7 @@ pub struct LedgerStore<T: Staking> {
/// Where the reward payment should be made. Keyed by stash.
#[derive(Encode, Copy, Clone, Debug, Hash, PartialEq, Eq, Ord, PartialOrd, Store)]
pub struct PayeeStore<T: Staking> {
#[store(returns = RewardDestination)]
#[store(returns = RewardDestination<T::AccountId>)]
/// Tٗhe stash account
pub stash: T::AccountId,
}
+1 -1
View File
@@ -118,7 +118,7 @@ pub trait System {
}
/// Type used to encode the number of references an account has.
pub type RefCount = u8;
pub type RefCount = u32;
/// Information of an account.
#[derive(Clone, Debug, Eq, PartialEq, Default, Decode, Encode)]
+6 -4
View File
@@ -163,6 +163,7 @@ impl Metadata {
#[derive(Clone, Debug)]
pub struct ModuleMetadata {
index: u8,
name: String,
storage: HashMap<String, StorageMetadata>,
// constants
@@ -482,7 +483,7 @@ impl TryFrom<RuntimeMetadataPrefixed> for Metadata {
return Err(ConversionError::InvalidPrefix.into())
}
let meta = match metadata.1 {
RuntimeMetadata::V11(meta) => meta,
RuntimeMetadata::V12(meta) => meta,
_ => return Err(ConversionError::InvalidVersion.into()),
};
let mut modules = HashMap::new();
@@ -509,6 +510,7 @@ impl TryFrom<RuntimeMetadataPrefixed> for Metadata {
modules.insert(
module_name.clone(),
ModuleMetadata {
index: module.index,
name: module_name.clone(),
storage: storage_map,
},
@@ -523,7 +525,7 @@ impl TryFrom<RuntimeMetadataPrefixed> for Metadata {
modules_with_calls.insert(
module_name.clone(),
ModuleWithCalls {
index: modules_with_calls.len() as u8,
index: module.index,
calls: call_map,
},
);
@@ -536,7 +538,7 @@ impl TryFrom<RuntimeMetadataPrefixed> for Metadata {
modules_with_events.insert(
module_name.clone(),
ModuleWithEvents {
index: modules_with_events.len() as u8,
index: module.index,
name: module_name.clone(),
events: event_map,
},
@@ -549,7 +551,7 @@ impl TryFrom<RuntimeMetadataPrefixed> for Metadata {
modules_with_errors.insert(
module_name.clone(),
ModuleWithErrors {
index: modules_with_errors.len() as u8,
index: module.index,
name: module_name.clone(),
errors: error_map,
},