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
This commit is contained in:
David Palm
2020-09-24 11:48:13 +02:00
parent 9f0d358b44
commit a0f430c6ac
5 changed files with 16 additions and 9 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 -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)]
+5 -3
View File
@@ -163,6 +163,7 @@ impl Metadata {
#[derive(Clone, Debug)]
pub struct ModuleMetadata {
index: u8,
name: String,
storage: HashMap<String, StorageMetadata>,
// constants
@@ -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,
},
+8 -3
View File
@@ -169,18 +169,22 @@ pub fn native_version() -> NativeVersion {
}
}
const AVERAGE_ON_INITIALIZE_WEIGHT: Perbill = Perbill::from_percent(10);
parameter_types! {
pub const BlockHashCount: BlockNumber = 2400;
/// We allow for 2 seconds of compute with a 6 second average block time.
pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
/// Assume 10% of weight for average on_initialize calls.
pub MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get()
.saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get();
/// Assume 10% of weight for average on_initialize calls.
pub MaximumExtrinsicWeight: Weight =
AvailableBlockRatio::get().saturating_sub(AVERAGE_ON_INITIALIZE_WEIGHT)
* MaximumBlockWeight::get();
pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;
pub const Version: RuntimeVersion = VERSION;
}
// const_assert!(AvailableBlockRatio::get().deconstruct() >= AVERAGE_ON_INITIALIZE_WEIGHT.deconstruct());
impl frame_system::Trait for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = ();
@@ -234,6 +238,7 @@ impl frame_system::Trait for Runtime {
type AccountData = pallet_balances::AccountData<Balance>;
/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = ();
// type SystemWeightInfo = weights::frame_system::WeightInfo;
/// Provides information about the pallet setup in the runtime.
type PalletInfo = PalletInfo;
}
+1 -1
View File
@@ -101,7 +101,7 @@ pub fn development_config() -> Result<ChainSpec, String> {
// Properties
None,
// Extensions
None,
Default::default(),
))
}