Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Assign DB weights to all runtimes #1011

Merged
merged 4 commits into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ use sp_staking::SessionIndex;
use frame_support::{
parameter_types, construct_runtime, debug,
traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness},
weights::RuntimeDbWeight,
};
use im_online::sr25519::AuthorityId as ImOnlineId;
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
Expand Down Expand Up @@ -84,7 +85,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kusama"),
impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 2,
spec_version: 1060,
spec_version: 1061,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -132,6 +133,13 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}

parameter_types! {
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this determined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a trie benchmark in substrate

cargo run --release -p node-bench -- trie

Those are a values given there are 200k keys in the database

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, seems arbitrary, but better than nothing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, seems arbitrary, but better than nothing

It can be updated with governance if database grows :)

read: 60_000_000,
write: 200_000_000,
};
}

impl system::Trait for Runtime {
type Origin = Origin;
type Call = Call;
Expand All @@ -145,7 +153,7 @@ impl system::Trait for Runtime {
type Event = Event;
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type DbWeight = DbWeight;
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = Version;
Expand Down
10 changes: 9 additions & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ use sp_staking::SessionIndex;
use frame_support::{
parameter_types, construct_runtime, debug,
traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness},
weights::RuntimeDbWeight,
};
use im_online::sr25519::AuthorityId as ImOnlineId;
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
Expand Down Expand Up @@ -138,6 +139,13 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}

parameter_types! {
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
read: 60_000_000,
write: 200_000_000,
};
}

impl system::Trait for Runtime {
type Origin = Origin;
type Call = Call;
Expand All @@ -151,7 +159,7 @@ impl system::Trait for Runtime {
type Event = Event;
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type DbWeight = DbWeight;
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = Version;
Expand Down
10 changes: 9 additions & 1 deletion runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ use sp_staking::SessionIndex;
use frame_support::{
parameter_types, construct_runtime, debug,
traits::{KeyOwnerProofSystem, Randomness},
weights::RuntimeDbWeight,
};
use im_online::sr25519::AuthorityId as ImOnlineId;
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
Expand Down Expand Up @@ -131,6 +132,13 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}

parameter_types! {
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
read: 60_000_000,
write: 200_000_000,
};
}

impl system::Trait for Runtime {
type Origin = Origin;
type Call = Call;
Expand All @@ -144,7 +152,7 @@ impl system::Trait for Runtime {
type Event = Event;
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type DbWeight = DbWeight;
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = Version;
Expand Down