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
+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,
},