Skip to content

Commit 6eff9a0

Browse files
authored
update orml weightinfo (#301)
1 parent 092c9c5 commit 6eff9a0

File tree

15 files changed

+153
-118
lines changed

15 files changed

+153
-118
lines changed

auction/src/default_weight.rs

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
1-
//! Weights for the Auction Module
1+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0
22
3-
use frame_support::weights::{
4-
constants::{RocksDbWeight as DbWeight, WEIGHT_PER_MICROS},
5-
Weight,
6-
};
3+
#![allow(unused_parens)]
4+
#![allow(unused_imports)]
5+
6+
use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight};
77

88
impl crate::WeightInfo for () {
9-
fn bid() -> Weight {
10-
WEIGHT_PER_MICROS
11-
.saturating_mul(300)
12-
.saturating_add(DbWeight::get().reads_writes(14, 14))
9+
fn bid_collateral_auction() -> Weight {
10+
(493_957_000 as Weight)
11+
.saturating_add(DbWeight::get().reads(12 as Weight))
12+
.saturating_add(DbWeight::get().writes(12 as Weight))
1313
}
14-
15-
fn on_finalize(_a: u32) -> Weight {
16-
0
14+
fn bid_surplus_auction() -> Weight {
15+
(257_830_000 as Weight)
16+
.saturating_add(DbWeight::get().reads(6 as Weight))
17+
.saturating_add(DbWeight::get().writes(5 as Weight))
18+
}
19+
fn bid_debit_auction() -> Weight {
20+
(287_271_000 as Weight)
21+
.saturating_add(DbWeight::get().reads(7 as Weight))
22+
.saturating_add(DbWeight::get().writes(8 as Weight))
23+
}
24+
fn on_finalize(c: u32) -> Weight {
25+
(50_992_000 as Weight)
26+
.saturating_add((171_653_000 as Weight).saturating_mul(c as Weight))
27+
.saturating_add(DbWeight::get().reads(3 as Weight))
28+
.saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(c as Weight)))
29+
.saturating_add(DbWeight::get().writes(2 as Weight))
30+
.saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(c as Weight)))
1731
}
1832
}

auction/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ mod mock;
2828
mod tests;
2929

3030
pub trait WeightInfo {
31-
fn bid() -> Weight;
32-
fn on_finalize(a: u32) -> Weight;
31+
fn bid_collateral_auction() -> Weight;
32+
fn bid_surplus_auction() -> Weight;
33+
fn bid_debit_auction() -> Weight;
34+
fn on_finalize(c: u32) -> Weight;
3335
}
3436

3537
pub trait Trait: frame_system::Trait {
@@ -120,7 +122,7 @@ decl_module! {
120122
/// - best cases: 140.7 µs
121123
/// - worst cases: 142.8 µs
122124
/// # </weight>
123-
#[weight = T::WeightInfo::bid()]
125+
#[weight = T::WeightInfo::bid_collateral_auction()]
124126
pub fn bid(origin, id: T::AuctionId, #[compact] value: T::Balance) {
125127
let from = ensure_signed(origin)?;
126128

authority/src/default_weight.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
//! Weights for the authority Module
1+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0
2+
3+
#![allow(unused_parens)]
4+
#![allow(unused_imports)]
25

36
use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight};
47

58
impl crate::WeightInfo for () {
69
fn dispatch_as() -> Weight {
7-
50750000 as Weight
10+
(43_132_000 as Weight)
11+
}
12+
fn schedule_dispatch_without_delay() -> Weight {
13+
(123_715_000 as Weight)
14+
.saturating_add(DbWeight::get().reads(3 as Weight))
15+
.saturating_add(DbWeight::get().writes(3 as Weight))
816
}
9-
fn schedule_dispatch() -> Weight {
10-
(147800000 as Weight)
17+
fn schedule_dispatch_with_delay() -> Weight {
18+
(116_719_000 as Weight)
1119
.saturating_add(DbWeight::get().reads(3 as Weight))
1220
.saturating_add(DbWeight::get().writes(3 as Weight))
1321
}
1422
fn fast_track_scheduled_dispatch() -> Weight {
15-
// TODO
16-
0 as Weight
23+
(59_055_000 as Weight)
1724
}
1825
fn delay_scheduled_dispatch() -> Weight {
19-
// TODO
20-
0 as Weight
26+
(44_796_000 as Weight)
2127
}
2228
fn cancel_scheduled_dispatch() -> Weight {
23-
(127400000 as Weight)
29+
(140_123_000 as Weight)
2430
.saturating_add(DbWeight::get().reads(2 as Weight))
2531
.saturating_add(DbWeight::get().writes(2 as Weight))
2632
}

authority/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ mod tests;
4242

4343
pub trait WeightInfo {
4444
fn dispatch_as() -> Weight;
45-
fn schedule_dispatch() -> Weight;
45+
fn schedule_dispatch_without_delay() -> Weight;
46+
fn schedule_dispatch_with_delay() -> Weight;
4647
fn fast_track_scheduled_dispatch() -> Weight;
4748
fn delay_scheduled_dispatch() -> Weight;
4849
fn cancel_scheduled_dispatch() -> Weight;
@@ -216,7 +217,7 @@ decl_module! {
216217

217218
/// Schedule a dispatchable to be dispatched at later block.
218219
/// This is the only way to dispatch a call with `DelayedOrigin`.
219-
#[weight = T::WeightInfo::schedule_dispatch()]
220+
#[weight = T::WeightInfo::schedule_dispatch_without_delay()]
220221
pub fn schedule_dispatch(
221222
origin,
222223
when: DispatchTime<T::BlockNumber>,

currencies/src/default_weight.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
//! Weights for the Currencies Module
1+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0
22
3-
use frame_support::weights::{
4-
constants::{RocksDbWeight as DbWeight, WEIGHT_PER_MICROS},
5-
Weight,
6-
};
3+
#![allow(unused_parens)]
4+
#![allow(unused_imports)]
5+
6+
use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight};
77

88
impl crate::WeightInfo for () {
9-
fn transfer() -> Weight {
10-
WEIGHT_PER_MICROS
11-
.saturating_mul(90)
12-
.saturating_add(DbWeight::get().reads_writes(5, 2))
9+
fn transfer_non_native_currency() -> Weight {
10+
(172_011_000 as Weight)
11+
.saturating_add(DbWeight::get().reads(5 as Weight))
12+
.saturating_add(DbWeight::get().writes(2 as Weight))
1313
}
14-
1514
fn transfer_native_currency() -> Weight {
16-
WEIGHT_PER_MICROS
17-
.saturating_mul(70)
18-
.saturating_add(DbWeight::get().reads_writes(2, 2))
15+
(43_023_000 as Weight)
1916
}
20-
21-
fn update_balance() -> Weight {
22-
WEIGHT_PER_MICROS
23-
.saturating_mul(66)
24-
.saturating_add(DbWeight::get().reads_writes(5, 2))
17+
fn update_balance_non_native_currency() -> Weight {
18+
(137_440_000 as Weight)
19+
.saturating_add(DbWeight::get().reads(5 as Weight))
20+
.saturating_add(DbWeight::get().writes(2 as Weight))
21+
}
22+
fn update_balance_native_currency_creating() -> Weight {
23+
(64_432_000 as Weight)
24+
}
25+
fn update_balance_native_currency_killing() -> Weight {
26+
(62_595_000 as Weight)
2527
}
2628
}

currencies/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ mod mock;
6969
mod tests;
7070

7171
pub trait WeightInfo {
72-
fn transfer() -> Weight;
72+
fn transfer_non_native_currency() -> Weight;
7373
fn transfer_native_currency() -> Weight;
74-
fn update_balance() -> Weight;
74+
fn update_balance_non_native_currency() -> Weight;
75+
fn update_balance_native_currency_creating() -> Weight;
76+
fn update_balance_native_currency_killing() -> Weight;
7577
}
7678

7779
type BalanceOf<T> = <<T as Trait>::MultiCurrency as MultiCurrency<<T as frame_system::Trait>::AccountId>>::Balance;
@@ -151,7 +153,7 @@ decl_module! {
151153
/// - non-native currency: 90.23 µs
152154
/// - native currency in worst case: 70 µs
153155
/// # </weight>
154-
#[weight = T::WeightInfo::transfer()]
156+
#[weight = T::WeightInfo::transfer_non_native_currency()]
155157
pub fn transfer(
156158
origin,
157159
dest: <T::Lookup as StaticLookup>::Source,
@@ -209,7 +211,7 @@ decl_module! {
209211
/// - native currency and killing account: 26.33 µs
210212
/// - native currency and create account: 27.39 µs
211213
/// # </weight>
212-
#[weight = T::WeightInfo::transfer_native_currency()]
214+
#[weight = T::WeightInfo::update_balance_non_native_currency()]
213215
pub fn update_balance(
214216
origin,
215217
who: <T::Lookup as StaticLookup>::Source,
Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
1-
//! Weights for the Gradually-update Module
1+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0
2+
3+
#![allow(unused_parens)]
4+
#![allow(unused_imports)]
25

36
use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight};
47

58
impl crate::WeightInfo for () {
69
fn gradually_update() -> Weight {
7-
(82320000 as Weight)
10+
(57_922_000 as Weight)
811
.saturating_add(DbWeight::get().reads(2 as Weight))
912
.saturating_add(DbWeight::get().writes(1 as Weight))
1013
}
1114
fn cancel_gradually_update() -> Weight {
12-
(72950000 as Weight)
15+
(66_687_000 as Weight)
1316
.saturating_add(DbWeight::get().reads(1 as Weight))
1417
.saturating_add(DbWeight::get().writes(1 as Weight))
1518
}
16-
fn on_initialize(need_update: bool, update_len: usize) -> Weight {
17-
if !need_update {
18-
return 0;
19-
}
20-
21-
if update_len == 0 {
22-
(30430000 as Weight)
23-
.saturating_add(DbWeight::get().reads(2 as Weight))
24-
.saturating_add(DbWeight::get().writes(1 as Weight))
25-
} else {
26-
(91390000 + (30000000 * update_len) as Weight)
27-
.saturating_add(DbWeight::get().reads(3 as Weight))
28-
.saturating_add(DbWeight::get().writes(3 as Weight))
29-
}
19+
fn on_finalize(u: u32) -> Weight {
20+
(37_067_000 as Weight)
21+
.saturating_add((20_890_000 as Weight).saturating_mul(u as Weight))
22+
.saturating_add(DbWeight::get().reads(3 as Weight))
23+
.saturating_add(DbWeight::get().writes(3 as Weight))
3024
}
3125
}

gradually-update/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ mod tests;
3838
pub trait WeightInfo {
3939
fn gradually_update() -> Weight;
4040
fn cancel_gradually_update() -> Weight;
41-
fn on_initialize(need_update: bool, update_len: usize) -> Weight;
41+
fn on_finalize(u: u32) -> Weight;
4242
}
4343

4444
type StorageKey = Vec<u8>;
@@ -155,7 +155,11 @@ decl_module! {
155155
/// `on_initialize` to return the weight used in `on_finalize`.
156156
fn on_initialize() -> Weight {
157157
let now = <frame_system::Module<T>>::block_number();
158-
T::WeightInfo::on_initialize(Self::_need_update(now), GraduallyUpdates::get().len())
158+
if Self::_need_update(now) {
159+
T::WeightInfo::on_finalize(GraduallyUpdates::get().len() as u32)
160+
} else {
161+
0
162+
}
159163
}
160164

161165
/// Update gradually_update to adjust numeric parameter.

oracle/src/default_weight.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
//! Weights for the Auction Module
1+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0
2+
3+
#![allow(unused_parens)]
4+
#![allow(unused_imports)]
25

36
use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight};
47

58
impl crate::WeightInfo for () {
6-
fn feed_values(values_len: usize) -> Weight {
7-
(101600000 as Weight)
9+
fn feed_values(c: u32) -> Weight {
10+
(74_792_000 as Weight)
11+
.saturating_add((11_208_000 as Weight).saturating_mul(c as Weight))
812
.saturating_add(DbWeight::get().reads(3 as Weight))
9-
.saturating_add(DbWeight::get().writes((1 + values_len * 2) as Weight))
13+
.saturating_add(DbWeight::get().writes(1 as Weight))
14+
.saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(c as Weight)))
1015
}
11-
12-
fn on_initialize() -> Weight {
13-
(18400000 as Weight).saturating_add(DbWeight::get().writes(1) as Weight)
16+
fn on_finalize() -> Weight {
17+
(15_881_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight))
1418
}
1519
}

oracle/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ mod mock;
2525
mod tests;
2626

2727
pub trait WeightInfo {
28-
fn feed_values(n: usize) -> Weight;
29-
fn on_initialize() -> Weight;
28+
fn feed_values(c: u32) -> Weight;
29+
fn on_finalize() -> Weight;
3030
}
3131

3232
use codec::{Decode, Encode};
@@ -139,7 +139,7 @@ decl_module! {
139139
/// Feed the external value.
140140
///
141141
/// Require unsigned. However a valid signature signed by session key is required along with payload.
142-
#[weight = (T::WeightInfo::feed_values(values.len()), DispatchClass::Operational)]
142+
#[weight = (T::WeightInfo::feed_values(values.len() as u32), DispatchClass::Operational)]
143143
pub fn feed_values(
144144
origin,
145145
values: Vec<(T::OracleKey, T::OracleValue)>,
@@ -151,7 +151,7 @@ decl_module! {
151151

152152
/// `on_initialize` to return the weight used in `on_finalize`.
153153
fn on_initialize() -> Weight {
154-
T::WeightInfo::on_initialize()
154+
T::WeightInfo::on_finalize()
155155
}
156156

157157
fn on_finalize(_n: T::BlockNumber) {

0 commit comments

Comments
 (0)