Storage Layer for All FRAME Extrinsics (#11431)

* add new trait

* implement DispatchableWithStorageLayer

* at least one transactional

* all dispatch is at least transactional

* storage_layer api

* add test

* storage layer tests

* deprecate transactional tag

* i guess no reason to deprecate

* remove transactional from batch_all

* update tests

* extend trait

* cargo run --quiet --profile=production --features runtime-benchmarks --manifest-path bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --output=./frame/balances/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* cargo run --quiet --profile=production --features runtime-benchmarks --manifest-path bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --output=./frame/balances/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* cargo run --quiet --profile=production --features runtime-benchmarks --manifest-path bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* fix copy paste name

* cargo run --quiet --profile=production --features runtime-benchmarks --manifest-path bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_utility --extrinsic=* --execution=wasm --wasm-execution=compiled --output=./frame/utility/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Create run_all_benchmarks.sh

* uncomment build

* update number of steps and repeats

* add skip build

* Update run_all_benchmarks.sh

* Update run_all_benchmarks.sh

* new benchmarks

* Update frame/support/src/traits/dispatch.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/support/src/traits/dispatch.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/support/test/tests/storage_layers.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/support/test/tests/storage_layers.rs

* weights

* Update dispatch.rs

* doc link

* decl_macro support

Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2022-05-26 15:28:32 -04:00
committed by GitHub
parent ea469886f8
commit 8e7adaf283
52 changed files with 1741 additions and 1355 deletions
+63 -63
View File
@@ -18,7 +18,7 @@
//! Autogenerated weights for pallet_collective
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-05-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2022-05-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
@@ -65,12 +65,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council Prime (r:0 w:1)
fn set_members(m: u32, n: u32, p: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 8_000
.saturating_add((10_362_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 8_000
.saturating_add((56_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 8_000
.saturating_add((13_187_000 as Weight).saturating_mul(p as Weight))
// Standard Error: 12_000
.saturating_add((10_280_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 12_000
.saturating_add((126_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 12_000
.saturating_add((13_310_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(p as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
@@ -78,21 +78,21 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
}
// Storage: Council Members (r:1 w:0)
fn execute(b: u32, m: u32, ) -> Weight {
(13_571_000 as Weight)
(16_819_000 as Weight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
// Standard Error: 0
.saturating_add((31_000 as Weight).saturating_mul(m as Weight))
.saturating_add((33_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
}
// Storage: Council Members (r:1 w:0)
// Storage: Council ProposalOf (r:1 w:0)
fn propose_execute(b: u32, m: u32, ) -> Weight {
(15_851_000 as Weight)
(18_849_000 as Weight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
// Standard Error: 0
.saturating_add((53_000 as Weight).saturating_mul(m as Weight))
.saturating_add((56_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
}
// Storage: Council Members (r:1 w:0)
@@ -101,22 +101,22 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council ProposalCount (r:1 w:1)
// Storage: Council Voting (r:0 w:1)
fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight {
(19_593_000 as Weight)
(22_204_000 as Weight)
// Standard Error: 0
.saturating_add((7_000 as Weight).saturating_mul(b as Weight))
.saturating_add((8_000 as Weight).saturating_mul(b as Weight))
// Standard Error: 1_000
.saturating_add((40_000 as Weight).saturating_mul(m as Weight))
.saturating_add((49_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 1_000
.saturating_add((165_000 as Weight).saturating_mul(p as Weight))
.saturating_add((180_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
// Storage: Council Members (r:1 w:0)
// Storage: Council Voting (r:1 w:1)
fn vote(m: u32, ) -> Weight {
(27_221_000 as Weight)
(30_941_000 as Weight)
// Standard Error: 2_000
.saturating_add((82_000 as Weight).saturating_mul(m as Weight))
.saturating_add((77_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -125,11 +125,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council Proposals (r:1 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn close_early_disapproved(m: u32, p: u32, ) -> Weight {
(26_295_000 as Weight)
(32_485_000 as Weight)
// Standard Error: 1_000
.saturating_add((55_000 as Weight).saturating_mul(m as Weight))
.saturating_add((39_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 1_000
.saturating_add((130_000 as Weight).saturating_mul(p as Weight))
.saturating_add((124_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -138,13 +138,13 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council ProposalOf (r:1 w:1)
// Storage: Council Proposals (r:1 w:1)
fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight {
(28_609_000 as Weight)
(33_487_000 as Weight)
// Standard Error: 0
.saturating_add((6_000 as Weight).saturating_mul(b as Weight))
.saturating_add((5_000 as Weight).saturating_mul(b as Weight))
// Standard Error: 1_000
.saturating_add((68_000 as Weight).saturating_mul(m as Weight))
.saturating_add((66_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 1_000
.saturating_add((161_000 as Weight).saturating_mul(p as Weight))
.saturating_add((157_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -154,11 +154,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council Proposals (r:1 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn close_disapproved(m: u32, p: u32, ) -> Weight {
(30_497_000 as Weight)
(33_494_000 as Weight)
// Standard Error: 1_000
.saturating_add((48_000 as Weight).saturating_mul(m as Weight))
.saturating_add((58_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 1_000
.saturating_add((120_000 as Weight).saturating_mul(p as Weight))
.saturating_add((124_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -168,13 +168,13 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council ProposalOf (r:1 w:1)
// Storage: Council Proposals (r:1 w:1)
fn close_approved(b: u32, m: u32, p: u32, ) -> Weight {
(31_402_000 as Weight)
(36_566_000 as Weight)
// Standard Error: 0
.saturating_add((5_000 as Weight).saturating_mul(b as Weight))
// Standard Error: 1_000
.saturating_add((73_000 as Weight).saturating_mul(m as Weight))
.saturating_add((63_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 1_000
.saturating_add((159_000 as Weight).saturating_mul(p as Weight))
.saturating_add((158_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -182,9 +182,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council Voting (r:0 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn disapprove_proposal(p: u32, ) -> Weight {
(16_391_000 as Weight)
(20_159_000 as Weight)
// Standard Error: 1_000
.saturating_add((169_000 as Weight).saturating_mul(p as Weight))
.saturating_add((173_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -198,12 +198,12 @@ impl WeightInfo for () {
// Storage: Council Prime (r:0 w:1)
fn set_members(m: u32, n: u32, p: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 8_000
.saturating_add((10_362_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 8_000
.saturating_add((56_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 8_000
.saturating_add((13_187_000 as Weight).saturating_mul(p as Weight))
// Standard Error: 12_000
.saturating_add((10_280_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 12_000
.saturating_add((126_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 12_000
.saturating_add((13_310_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(p as Weight)))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
@@ -211,21 +211,21 @@ impl WeightInfo for () {
}
// Storage: Council Members (r:1 w:0)
fn execute(b: u32, m: u32, ) -> Weight {
(13_571_000 as Weight)
(16_819_000 as Weight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
// Standard Error: 0
.saturating_add((31_000 as Weight).saturating_mul(m as Weight))
.saturating_add((33_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
}
// Storage: Council Members (r:1 w:0)
// Storage: Council ProposalOf (r:1 w:0)
fn propose_execute(b: u32, m: u32, ) -> Weight {
(15_851_000 as Weight)
(18_849_000 as Weight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
// Standard Error: 0
.saturating_add((53_000 as Weight).saturating_mul(m as Weight))
.saturating_add((56_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
}
// Storage: Council Members (r:1 w:0)
@@ -234,22 +234,22 @@ impl WeightInfo for () {
// Storage: Council ProposalCount (r:1 w:1)
// Storage: Council Voting (r:0 w:1)
fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight {
(19_593_000 as Weight)
(22_204_000 as Weight)
// Standard Error: 0
.saturating_add((7_000 as Weight).saturating_mul(b as Weight))
.saturating_add((8_000 as Weight).saturating_mul(b as Weight))
// Standard Error: 1_000
.saturating_add((40_000 as Weight).saturating_mul(m as Weight))
.saturating_add((49_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 1_000
.saturating_add((165_000 as Weight).saturating_mul(p as Weight))
.saturating_add((180_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
// Storage: Council Members (r:1 w:0)
// Storage: Council Voting (r:1 w:1)
fn vote(m: u32, ) -> Weight {
(27_221_000 as Weight)
(30_941_000 as Weight)
// Standard Error: 2_000
.saturating_add((82_000 as Weight).saturating_mul(m as Weight))
.saturating_add((77_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -258,11 +258,11 @@ impl WeightInfo for () {
// Storage: Council Proposals (r:1 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn close_early_disapproved(m: u32, p: u32, ) -> Weight {
(26_295_000 as Weight)
(32_485_000 as Weight)
// Standard Error: 1_000
.saturating_add((55_000 as Weight).saturating_mul(m as Weight))
.saturating_add((39_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 1_000
.saturating_add((130_000 as Weight).saturating_mul(p as Weight))
.saturating_add((124_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -271,13 +271,13 @@ impl WeightInfo for () {
// Storage: Council ProposalOf (r:1 w:1)
// Storage: Council Proposals (r:1 w:1)
fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight {
(28_609_000 as Weight)
(33_487_000 as Weight)
// Standard Error: 0
.saturating_add((6_000 as Weight).saturating_mul(b as Weight))
.saturating_add((5_000 as Weight).saturating_mul(b as Weight))
// Standard Error: 1_000
.saturating_add((68_000 as Weight).saturating_mul(m as Weight))
.saturating_add((66_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 1_000
.saturating_add((161_000 as Weight).saturating_mul(p as Weight))
.saturating_add((157_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -287,11 +287,11 @@ impl WeightInfo for () {
// Storage: Council Proposals (r:1 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn close_disapproved(m: u32, p: u32, ) -> Weight {
(30_497_000 as Weight)
(33_494_000 as Weight)
// Standard Error: 1_000
.saturating_add((48_000 as Weight).saturating_mul(m as Weight))
.saturating_add((58_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 1_000
.saturating_add((120_000 as Weight).saturating_mul(p as Weight))
.saturating_add((124_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -301,13 +301,13 @@ impl WeightInfo for () {
// Storage: Council ProposalOf (r:1 w:1)
// Storage: Council Proposals (r:1 w:1)
fn close_approved(b: u32, m: u32, p: u32, ) -> Weight {
(31_402_000 as Weight)
(36_566_000 as Weight)
// Standard Error: 0
.saturating_add((5_000 as Weight).saturating_mul(b as Weight))
// Standard Error: 1_000
.saturating_add((73_000 as Weight).saturating_mul(m as Weight))
.saturating_add((63_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 1_000
.saturating_add((159_000 as Weight).saturating_mul(p as Weight))
.saturating_add((158_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -315,9 +315,9 @@ impl WeightInfo for () {
// Storage: Council Voting (r:0 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn disapprove_proposal(p: u32, ) -> Weight {
(16_391_000 as Weight)
(20_159_000 as Weight)
// Standard Error: 1_000
.saturating_add((169_000 as Weight).saturating_mul(p as Weight))
.saturating_add((173_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}