Skip to content

Commit 4161b51

Browse files
authored
get rid of obsolete weight functions (#1926)
1 parent 9b3b00e commit 4161b51

File tree

15 files changed

+103
-105
lines changed

15 files changed

+103
-105
lines changed

.maintain/millau-weight-template.hbs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,10 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
6969
// Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
7070
// Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
7171
// Minimum execution time: {{underscore benchmark.min_execution_time}} nanoseconds.
72-
{{#if (ne benchmark.base_calculated_proof_size "0")}}
7372
Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})
74-
{{else}}
75-
Weight::from_ref_time({{underscore benchmark.base_weight}})
76-
{{/if}}
7773
{{#each benchmark.component_weight as |cw|}}
7874
// Standard Error: {{underscore cw.error}}
79-
.saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}}.into()))
75+
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
8076
{{/each}}
8177
{{#if (ne benchmark.base_reads "0")}}
8278
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}_u64))
@@ -91,7 +87,7 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
9187
.saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))
9288
{{/each}}
9389
{{#each benchmark.component_calculated_proof_size as |cp|}}
94-
.saturating_add(Weight::from_proof_size({{cp.slope}}).saturating_mul({{cp.name}}.into()))
90+
.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))
9591
{{/each}}
9692
}
9793
{{/each}}
@@ -117,14 +113,10 @@ impl WeightInfo for () {
117113
// Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
118114
// Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
119115
// Minimum execution time: {{underscore benchmark.min_execution_time}} nanoseconds.
120-
{{#if (ne benchmark.base_calculated_proof_size "0")}}
121116
Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})
122-
{{else}}
123-
Weight::from_ref_time({{underscore benchmark.base_weight}})
124-
{{/if}}
125117
{{#each benchmark.component_weight as |cw|}}
126118
// Standard Error: {{underscore cw.error}}
127-
.saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}}.into()))
119+
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
128120
{{/each}}
129121
{{#if (ne benchmark.base_reads "0")}}
130122
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64))
@@ -139,7 +131,7 @@ impl WeightInfo for () {
139131
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))
140132
{{/each}}
141133
{{#each benchmark.component_calculated_proof_size as |cp|}}
142-
.saturating_add(Weight::from_proof_size({{cp.slope}}).saturating_mul({{cp.name}}.into()))
134+
.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))
143135
{{/each}}
144136
}
145137
{{/each}}

bin/runtime-common/src/refund_relayer_extension.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,9 @@ mod tests {
746746

747747
fn dispatch_info() -> DispatchInfo {
748748
DispatchInfo {
749-
weight: Weight::from_ref_time(
749+
weight: Weight::from_parts(
750750
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND,
751+
0,
751752
),
752753
class: frame_support::dispatch::DispatchClass::Normal,
753754
pays_fee: frame_support::dispatch::Pays::Yes,
@@ -1037,8 +1038,9 @@ mod tests {
10371038
initialize_environment(200, 200, [1u8; 32].into(), 200);
10381039

10391040
let mut dispatch_info = dispatch_info();
1040-
dispatch_info.weight = Weight::from_ref_time(
1041+
dispatch_info.weight = Weight::from_parts(
10411042
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND * 2,
1043+
0,
10421044
);
10431045

10441046
// without any size/weight refund: we expect regular reward

modules/beefy/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub mod pallet {
133133
fn on_initialize(_n: T::BlockNumber) -> frame_support::weights::Weight {
134134
<RequestCount<T, I>>::mutate(|count| *count = count.saturating_sub(1));
135135

136-
Weight::from_ref_time(0)
136+
Weight::from_parts(0, 0)
137137
.saturating_add(T::DbWeight::get().reads(1))
138138
.saturating_add(T::DbWeight::get().writes(1))
139139
}

modules/beefy/src/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ construct_runtime! {
7272
}
7373

7474
parameter_types! {
75-
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
75+
pub const MaximumBlockWeight: Weight = Weight::from_parts(1024, 0);
7676
pub const MaximumBlockLength: u32 = 2 * 1024;
7777
pub const AvailableBlockRatio: Perbill = Perbill::one();
7878
}

modules/grandpa/src/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ construct_runtime! {
5454
}
5555

5656
parameter_types! {
57-
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
57+
pub const MaximumBlockWeight: Weight = Weight::from_parts(1024, 0);
5858
pub const MaximumBlockLength: u32 = 2 * 1024;
5959
pub const AvailableBlockRatio: Perbill = Perbill::one();
6060
}

modules/grandpa/src/weights.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! Autogenerated weights for pallet_bridge_grandpa
1818
//!
1919
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
20-
//! DATE: 2023-03-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
20+
//! DATE: 2023-03-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
2121
//! WORST CASE MAP SIZE: `1000000`
2222
//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz`
2323
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
@@ -100,12 +100,12 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
100100
// Proof Size summary in bytes:
101101
// Measured: `394 + p * (60 ±0)`
102102
// Estimated: `4745`
103-
// Minimum execution time: 221_810 nanoseconds.
104-
Weight::from_parts(33_157_392, 4745)
105-
// Standard Error: 109_045
106-
.saturating_add(Weight::from_ref_time(41_100_656).saturating_mul(p.into()))
107-
// Standard Error: 7_754
108-
.saturating_add(Weight::from_ref_time(1_534_466).saturating_mul(v.into()))
103+
// Minimum execution time: 228_072 nanoseconds.
104+
Weight::from_parts(57_853_228, 4745)
105+
// Standard Error: 149_421
106+
.saturating_add(Weight::from_parts(36_708_702, 0).saturating_mul(p.into()))
107+
// Standard Error: 10_625
108+
.saturating_add(Weight::from_parts(1_469_032, 0).saturating_mul(v.into()))
109109
.saturating_add(T::DbWeight::get().reads(6_u64))
110110
.saturating_add(T::DbWeight::get().writes(6_u64))
111111
}
@@ -155,12 +155,12 @@ impl WeightInfo for () {
155155
// Proof Size summary in bytes:
156156
// Measured: `394 + p * (60 ±0)`
157157
// Estimated: `4745`
158-
// Minimum execution time: 221_810 nanoseconds.
159-
Weight::from_parts(33_157_392, 4745)
160-
// Standard Error: 109_045
161-
.saturating_add(Weight::from_ref_time(41_100_656).saturating_mul(p.into()))
162-
// Standard Error: 7_754
163-
.saturating_add(Weight::from_ref_time(1_534_466).saturating_mul(v.into()))
158+
// Minimum execution time: 228_072 nanoseconds.
159+
Weight::from_parts(57_853_228, 4745)
160+
// Standard Error: 149_421
161+
.saturating_add(Weight::from_parts(36_708_702, 0).saturating_mul(p.into()))
162+
// Standard Error: 10_625
163+
.saturating_add(Weight::from_parts(1_469_032, 0).saturating_mul(v.into()))
164164
.saturating_add(RocksDbWeight::get().reads(6_u64))
165165
.saturating_add(RocksDbWeight::get().writes(6_u64))
166166
}

modules/messages/src/mock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ frame_support::construct_runtime! {
8989

9090
parameter_types! {
9191
pub const BlockHashCount: u64 = 250;
92-
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
92+
pub const MaximumBlockWeight: Weight = Weight::from_parts(1024, 0);
9393
pub const MaximumBlockLength: u32 = 2 * 1024;
9494
pub const AvailableBlockRatio: Perbill = Perbill::one();
9595
}
@@ -410,7 +410,7 @@ pub const fn message_payload(id: u64, declared_weight: u64) -> TestPayload {
410410
TestPayload {
411411
id,
412412
reject_by_lane_verifier: false,
413-
declared_weight: Weight::from_ref_time(declared_weight),
413+
declared_weight: Weight::from_parts(declared_weight, 0),
414414
dispatch_result: dispatch_result(0),
415415
extra: Vec::new(),
416416
}
@@ -421,7 +421,7 @@ pub const fn dispatch_result(
421421
unspent_weight: u64,
422422
) -> MessageDispatchResult<TestDispatchLevelResult> {
423423
MessageDispatchResult {
424-
unspent_weight: Weight::from_ref_time(unspent_weight),
424+
unspent_weight: Weight::from_parts(unspent_weight, 0),
425425
dispatch_level_result: (),
426426
}
427427
}

modules/messages/src/weights.rs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
1616

17-
//! Autogenerated weights for pallet_bridge_messages
17+
//! Autogenerated weights for RialtoMessages
1818
//!
1919
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
20-
//! DATE: 2023-03-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
20+
//! DATE: 2023-03-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
2121
//! WORST CASE MAP SIZE: `1000000`
2222
//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz`
2323
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
@@ -29,7 +29,7 @@
2929
// --chain=dev
3030
// --steps=50
3131
// --repeat=20
32-
// --pallet=pallet_bridge_messages
32+
// --pallet=RialtoMessages
3333
// --extrinsic=*
3434
// --execution=wasm
3535
// --wasm-execution=Compiled
@@ -48,7 +48,7 @@ use frame_support::{
4848
};
4949
use sp_std::marker::PhantomData;
5050

51-
/// Weight functions needed for pallet_bridge_messages.
51+
/// Weight functions needed for RialtoMessages.
5252
pub trait WeightInfo {
5353
fn receive_single_message_proof() -> Weight;
5454
fn receive_two_messages_proof() -> Weight;
@@ -60,7 +60,7 @@ pub trait WeightInfo {
6060
fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight;
6161
}
6262

63-
/// Weights for `pallet_bridge_messages` that are generated using one of the Bridge testnets.
63+
/// Weights for `RialtoMessages` that are generated using one of the Bridge testnets.
6464
///
6565
/// Those weights are test only and must never be used in production.
6666
pub struct BridgeWeight<T>(PhantomData<T>);
@@ -88,8 +88,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
8888
// Proof Size summary in bytes:
8989
// Measured: `693`
9090
// Estimated: `54703`
91-
// Minimum execution time: 48_426 nanoseconds.
92-
Weight::from_parts(50_113_000, 54703)
91+
// Minimum execution time: 48_058 nanoseconds.
92+
Weight::from_parts(50_422_000, 54703)
9393
.saturating_add(T::DbWeight::get().reads(4_u64))
9494
.saturating_add(T::DbWeight::get().writes(2_u64))
9595
}
@@ -116,8 +116,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
116116
// Proof Size summary in bytes:
117117
// Measured: `693`
118118
// Estimated: `54703`
119-
// Minimum execution time: 59_739 nanoseconds.
120-
Weight::from_parts(61_704_000, 54703)
119+
// Minimum execution time: 59_371 nanoseconds.
120+
Weight::from_parts(61_726_000, 54703)
121121
.saturating_add(T::DbWeight::get().reads(4_u64))
122122
.saturating_add(T::DbWeight::get().writes(2_u64))
123123
}
@@ -144,8 +144,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
144144
// Proof Size summary in bytes:
145145
// Measured: `693`
146146
// Estimated: `54703`
147-
// Minimum execution time: 53_760 nanoseconds.
148-
Weight::from_parts(55_645_000, 54703)
147+
// Minimum execution time: 53_398 nanoseconds.
148+
Weight::from_parts(54_351_000, 54703)
149149
.saturating_add(T::DbWeight::get().reads(4_u64))
150150
.saturating_add(T::DbWeight::get().writes(2_u64))
151151
}
@@ -167,8 +167,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
167167
// Proof Size summary in bytes:
168168
// Measured: `618`
169169
// Estimated: `54200`
170-
// Minimum execution time: 49_582 nanoseconds.
171-
Weight::from_parts(51_250_000, 54200)
170+
// Minimum execution time: 50_064 nanoseconds.
171+
Weight::from_parts(51_306_000, 54200)
172172
.saturating_add(T::DbWeight::get().reads(3_u64))
173173
.saturating_add(T::DbWeight::get().writes(1_u64))
174174
}
@@ -190,8 +190,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
190190
// Proof Size summary in bytes:
191191
// Measured: `618`
192192
// Estimated: `54200`
193-
// Minimum execution time: 76_418 nanoseconds.
194-
Weight::from_parts(77_877_000, 54200)
193+
// Minimum execution time: 75_403 nanoseconds.
194+
Weight::from_parts(77_006_000, 54200)
195195
.saturating_add(T::DbWeight::get().reads(3_u64))
196196
.saturating_add(T::DbWeight::get().writes(1_u64))
197197
}
@@ -218,8 +218,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
218218
// Proof Size summary in bytes:
219219
// Measured: `579`
220220
// Estimated: `5624`
221-
// Minimum execution time: 41_795 nanoseconds.
222-
Weight::from_parts(43_683_000, 5624)
221+
// Minimum execution time: 41_670 nanoseconds.
222+
Weight::from_parts(42_863_000, 5624)
223223
.saturating_add(T::DbWeight::get().reads(4_u64))
224224
.saturating_add(T::DbWeight::get().writes(2_u64))
225225
}
@@ -246,8 +246,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
246246
// Proof Size summary in bytes:
247247
// Measured: `596`
248248
// Estimated: `5624`
249-
// Minimum execution time: 39_946 nanoseconds.
250-
Weight::from_parts(41_509_000, 5624)
249+
// Minimum execution time: 40_928 nanoseconds.
250+
Weight::from_parts(42_165_000, 5624)
251251
.saturating_add(T::DbWeight::get().reads(4_u64))
252252
.saturating_add(T::DbWeight::get().writes(2_u64))
253253
}
@@ -274,8 +274,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
274274
// Proof Size summary in bytes:
275275
// Measured: `596`
276276
// Estimated: `8164`
277-
// Minimum execution time: 42_882 nanoseconds.
278-
Weight::from_parts(44_367_000, 8164)
277+
// Minimum execution time: 44_022 nanoseconds.
278+
Weight::from_parts(44_657_000, 8164)
279279
.saturating_add(T::DbWeight::get().reads(5_u64))
280280
.saturating_add(T::DbWeight::get().writes(3_u64))
281281
}
@@ -306,8 +306,8 @@ impl WeightInfo for () {
306306
// Proof Size summary in bytes:
307307
// Measured: `693`
308308
// Estimated: `54703`
309-
// Minimum execution time: 48_426 nanoseconds.
310-
Weight::from_parts(50_113_000, 54703)
309+
// Minimum execution time: 48_058 nanoseconds.
310+
Weight::from_parts(50_422_000, 54703)
311311
.saturating_add(RocksDbWeight::get().reads(4_u64))
312312
.saturating_add(RocksDbWeight::get().writes(2_u64))
313313
}
@@ -334,8 +334,8 @@ impl WeightInfo for () {
334334
// Proof Size summary in bytes:
335335
// Measured: `693`
336336
// Estimated: `54703`
337-
// Minimum execution time: 59_739 nanoseconds.
338-
Weight::from_parts(61_704_000, 54703)
337+
// Minimum execution time: 59_371 nanoseconds.
338+
Weight::from_parts(61_726_000, 54703)
339339
.saturating_add(RocksDbWeight::get().reads(4_u64))
340340
.saturating_add(RocksDbWeight::get().writes(2_u64))
341341
}
@@ -362,8 +362,8 @@ impl WeightInfo for () {
362362
// Proof Size summary in bytes:
363363
// Measured: `693`
364364
// Estimated: `54703`
365-
// Minimum execution time: 53_760 nanoseconds.
366-
Weight::from_parts(55_645_000, 54703)
365+
// Minimum execution time: 53_398 nanoseconds.
366+
Weight::from_parts(54_351_000, 54703)
367367
.saturating_add(RocksDbWeight::get().reads(4_u64))
368368
.saturating_add(RocksDbWeight::get().writes(2_u64))
369369
}
@@ -385,8 +385,8 @@ impl WeightInfo for () {
385385
// Proof Size summary in bytes:
386386
// Measured: `618`
387387
// Estimated: `54200`
388-
// Minimum execution time: 49_582 nanoseconds.
389-
Weight::from_parts(51_250_000, 54200)
388+
// Minimum execution time: 50_064 nanoseconds.
389+
Weight::from_parts(51_306_000, 54200)
390390
.saturating_add(RocksDbWeight::get().reads(3_u64))
391391
.saturating_add(RocksDbWeight::get().writes(1_u64))
392392
}
@@ -408,8 +408,8 @@ impl WeightInfo for () {
408408
// Proof Size summary in bytes:
409409
// Measured: `618`
410410
// Estimated: `54200`
411-
// Minimum execution time: 76_418 nanoseconds.
412-
Weight::from_parts(77_877_000, 54200)
411+
// Minimum execution time: 75_403 nanoseconds.
412+
Weight::from_parts(77_006_000, 54200)
413413
.saturating_add(RocksDbWeight::get().reads(3_u64))
414414
.saturating_add(RocksDbWeight::get().writes(1_u64))
415415
}
@@ -436,8 +436,8 @@ impl WeightInfo for () {
436436
// Proof Size summary in bytes:
437437
// Measured: `579`
438438
// Estimated: `5624`
439-
// Minimum execution time: 41_795 nanoseconds.
440-
Weight::from_parts(43_683_000, 5624)
439+
// Minimum execution time: 41_670 nanoseconds.
440+
Weight::from_parts(42_863_000, 5624)
441441
.saturating_add(RocksDbWeight::get().reads(4_u64))
442442
.saturating_add(RocksDbWeight::get().writes(2_u64))
443443
}
@@ -464,8 +464,8 @@ impl WeightInfo for () {
464464
// Proof Size summary in bytes:
465465
// Measured: `596`
466466
// Estimated: `5624`
467-
// Minimum execution time: 39_946 nanoseconds.
468-
Weight::from_parts(41_509_000, 5624)
467+
// Minimum execution time: 40_928 nanoseconds.
468+
Weight::from_parts(42_165_000, 5624)
469469
.saturating_add(RocksDbWeight::get().reads(4_u64))
470470
.saturating_add(RocksDbWeight::get().writes(2_u64))
471471
}
@@ -492,8 +492,8 @@ impl WeightInfo for () {
492492
// Proof Size summary in bytes:
493493
// Measured: `596`
494494
// Estimated: `8164`
495-
// Minimum execution time: 42_882 nanoseconds.
496-
Weight::from_parts(44_367_000, 8164)
495+
// Minimum execution time: 44_022 nanoseconds.
496+
Weight::from_parts(44_657_000, 8164)
497497
.saturating_add(RocksDbWeight::get().reads(5_u64))
498498
.saturating_add(RocksDbWeight::get().writes(3_u64))
499499
}

modules/parachains/src/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ construct_runtime! {
158158

159159
parameter_types! {
160160
pub const BlockHashCount: TestNumber = 250;
161-
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
161+
pub const MaximumBlockWeight: Weight = Weight::from_parts(1024, 0);
162162
pub const MaximumBlockLength: u32 = 2 * 1024;
163163
pub const AvailableBlockRatio: Perbill = Perbill::one();
164164
}

0 commit comments

Comments
 (0)