Skip to content

Commit 4edfb5b

Browse files
authored
MillauWeight -> BridgeWeight (#1593)
1 parent cef591b commit 4edfb5b

File tree

13 files changed

+85
-75
lines changed

13 files changed

+85
-75
lines changed

.maintain/millau-weight-template.hbs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ pub trait WeightInfo {
4646
{{~/each}}
4747
}
4848

49-
/// Weights for `{{pallet}}` using the Millau node and recommended hardware.
50-
pub struct MillauWeight<T>(PhantomData<T>);
51-
impl<T: frame_system::Config> WeightInfo for MillauWeight<T> {
49+
/// Weights for `{{pallet}}` that are generated using one of the Bridge testnets.
50+
///
51+
/// Those weights are test only and must never be used in production.
52+
pub struct BridgeWeight<T>(PhantomData<T>);
53+
impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
5254
{{~#each benchmarks as |benchmark|}}
5355
fn {{benchmark.name~}}
5456
(

bin/millau/runtime/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ impl pallet_bridge_grandpa::Config for Runtime {
432432
type MaxRequests = MaxRequests;
433433
type HeadersToKeep = HeadersToKeep;
434434

435-
type WeightInfo = pallet_bridge_grandpa::weights::MillauWeight<Runtime>;
435+
type WeightInfo = pallet_bridge_grandpa::weights::BridgeWeight<Runtime>;
436436
}
437437

438438
pub type WestendGrandpaInstance = pallet_bridge_grandpa::Instance1;
@@ -441,7 +441,7 @@ impl pallet_bridge_grandpa::Config<WestendGrandpaInstance> for Runtime {
441441
type MaxRequests = MaxRequests;
442442
type HeadersToKeep = HeadersToKeep;
443443

444-
type WeightInfo = pallet_bridge_grandpa::weights::MillauWeight<Runtime>;
444+
type WeightInfo = pallet_bridge_grandpa::weights::BridgeWeight<Runtime>;
445445
}
446446

447447
impl pallet_shift_session_manager::Config for Runtime {}
@@ -465,7 +465,7 @@ pub type WithRialtoMessagesInstance = ();
465465

466466
impl pallet_bridge_messages::Config<WithRialtoMessagesInstance> for Runtime {
467467
type Event = Event;
468-
type WeightInfo = pallet_bridge_messages::weights::MillauWeight<Runtime>;
468+
type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
469469
type Parameter = rialto_messages::MillauToRialtoMessagesParameter;
470470
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
471471
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
@@ -500,7 +500,7 @@ pub type WithRialtoParachainMessagesInstance = pallet_bridge_messages::Instance1
500500

501501
impl pallet_bridge_messages::Config<WithRialtoParachainMessagesInstance> for Runtime {
502502
type Event = Event;
503-
type WeightInfo = pallet_bridge_messages::weights::MillauWeight<Runtime>;
503+
type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
504504
type Parameter = rialto_parachain_messages::MillauToRialtoParachainMessagesParameter;
505505
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
506506
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
@@ -541,7 +541,7 @@ pub type WithRialtoParachainsInstance = ();
541541

542542
impl pallet_bridge_parachains::Config<WithRialtoParachainsInstance> for Runtime {
543543
type Event = Event;
544-
type WeightInfo = pallet_bridge_parachains::weights::MillauWeight<Runtime>;
544+
type WeightInfo = pallet_bridge_parachains::weights::BridgeWeight<Runtime>;
545545
type BridgesGrandpaPalletInstance = RialtoGrandpaInstance;
546546
type ParasPalletName = RialtoParasPalletName;
547547
type TrackedParachains = frame_support::traits::Everything;
@@ -553,7 +553,7 @@ pub type WithWestendParachainsInstance = pallet_bridge_parachains::Instance1;
553553

554554
impl pallet_bridge_parachains::Config<WithWestendParachainsInstance> for Runtime {
555555
type Event = Event;
556-
type WeightInfo = pallet_bridge_parachains::weights::MillauWeight<Runtime>;
556+
type WeightInfo = pallet_bridge_parachains::weights::BridgeWeight<Runtime>;
557557
type BridgesGrandpaPalletInstance = WestendGrandpaInstance;
558558
type ParasPalletName = WestendParasPalletName;
559559
type TrackedParachains = frame_support::traits::Everything;

bin/millau/runtime/src/rialto_messages.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ mod tests {
320320

321321
#[test]
322322
fn ensure_millau_message_lane_weights_are_correct() {
323-
type Weights = pallet_bridge_messages::weights::MillauWeight<Runtime>;
323+
type Weights = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
324324

325325
pallet_bridge_messages::ensure_weights_are_correct::<Weights>(
326326
bp_millau::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT,

bin/rialto-parachain/runtime/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ impl pallet_bridge_grandpa::Config for Runtime {
538538
type BridgedChain = bp_millau::Millau;
539539
type MaxRequests = MaxRequests;
540540
type HeadersToKeep = HeadersToKeep;
541-
type WeightInfo = pallet_bridge_grandpa::weights::MillauWeight<Runtime>;
541+
type WeightInfo = pallet_bridge_grandpa::weights::BridgeWeight<Runtime>;
542542
}
543543

544544
parameter_types! {
@@ -559,7 +559,7 @@ pub type WithMillauMessagesInstance = ();
559559

560560
impl pallet_bridge_messages::Config<WithMillauMessagesInstance> for Runtime {
561561
type Event = Event;
562-
type WeightInfo = pallet_bridge_messages::weights::MillauWeight<Runtime>;
562+
type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
563563
type Parameter = millau_messages::RialtoParachainToMillauMessagesParameter;
564564
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
565565
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;

bin/rialto/runtime/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ impl pallet_bridge_grandpa::Config for Runtime {
424424
type BridgedChain = bp_millau::Millau;
425425
type MaxRequests = MaxRequests;
426426
type HeadersToKeep = HeadersToKeep;
427-
type WeightInfo = pallet_bridge_grandpa::weights::MillauWeight<Runtime>;
427+
type WeightInfo = pallet_bridge_grandpa::weights::BridgeWeight<Runtime>;
428428
}
429429

430430
impl pallet_shift_session_manager::Config for Runtime {}
@@ -447,7 +447,7 @@ pub type WithMillauMessagesInstance = ();
447447

448448
impl pallet_bridge_messages::Config<WithMillauMessagesInstance> for Runtime {
449449
type Event = Event;
450-
type WeightInfo = pallet_bridge_messages::weights::MillauWeight<Runtime>;
450+
type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
451451
type Parameter = millau_messages::RialtoToMillauMessagesParameter;
452452
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
453453
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;

bin/rialto/runtime/src/millau_messages.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ mod tests {
315315

316316
#[test]
317317
fn ensure_rialto_message_lane_weights_are_correct() {
318-
type Weights = pallet_bridge_messages::weights::MillauWeight<Runtime>;
318+
type Weights = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
319319

320320
pallet_bridge_messages::ensure_weights_are_correct::<Weights>(
321321
bp_rialto::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT,

modules/grandpa/src/weights.rs

Lines changed: 12 additions & 10 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: 2022-07-06, STEPS: 50, REPEAT: 20
20+
//! DATE: 2022-10-04, STEPS: 50, REPEAT: 20
2121
//! LOW RANGE: [], HIGH RANGE: []
2222
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled
2323
//! CHAIN: Some("dev"), DB CACHE: 1024
@@ -53,13 +53,15 @@ pub trait WeightInfo {
5353
fn submit_finality_proof(p: u32, v: u32) -> Weight;
5454
}
5555

56-
/// Weights for `pallet_bridge_grandpa` using the Millau node and recommended hardware.
57-
pub struct MillauWeight<T>(PhantomData<T>);
58-
impl<T: frame_system::Config> WeightInfo for MillauWeight<T> {
56+
/// Weights for `pallet_bridge_grandpa` that are generated using one of the Bridge testnets.
57+
///
58+
/// Those weights are test only and must never be used in production.
59+
pub struct BridgeWeight<T>(PhantomData<T>);
60+
impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
5961
fn submit_finality_proof(p: u32, v: u32) -> Weight {
60-
(55_070_000 as Weight)
61-
.saturating_add((39_678_000 as Weight).saturating_mul(p as Weight))
62-
.saturating_add((1_540_000 as Weight).saturating_mul(v as Weight))
62+
(105_417_000 as Weight)
63+
.saturating_add((40_923_000 as Weight).saturating_mul(p as Weight))
64+
.saturating_add((1_691_000 as Weight).saturating_mul(v as Weight))
6365
.saturating_add(T::DbWeight::get().reads(7 as Weight))
6466
.saturating_add(T::DbWeight::get().writes(6 as Weight))
6567
}
@@ -68,9 +70,9 @@ impl<T: frame_system::Config> WeightInfo for MillauWeight<T> {
6870
// For backwards compatibility and tests
6971
impl WeightInfo for () {
7072
fn submit_finality_proof(p: u32, v: u32) -> Weight {
71-
(55_070_000 as Weight)
72-
.saturating_add((39_678_000 as Weight).saturating_mul(p as Weight))
73-
.saturating_add((1_540_000 as Weight).saturating_mul(v as Weight))
73+
(105_417_000 as Weight)
74+
.saturating_add((40_923_000 as Weight).saturating_mul(p as Weight))
75+
.saturating_add((1_691_000 as Weight).saturating_mul(v as Weight))
7476
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
7577
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
7678
}

modules/messages/src/weights.rs

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! Autogenerated weights for `pallet_bridge_messages`
1818
//!
1919
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
20-
//! DATE: 2022-07-20, STEPS: 50, REPEAT: 20
20+
//! DATE: 2022-10-04, STEPS: 50, REPEAT: 20
2121
//! LOW RANGE: [], HIGH RANGE: []
2222
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled
2323
//! CHAIN: Some("dev"), DB CACHE: 1024
@@ -66,26 +66,28 @@ pub trait WeightInfo {
6666
fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight;
6767
}
6868

69-
/// Weights for `pallet_bridge_messages` using the Millau node and recommended hardware.
70-
pub struct MillauWeight<T>(PhantomData<T>);
71-
impl<T: frame_system::Config> WeightInfo for MillauWeight<T> {
69+
/// Weights for `pallet_bridge_messages` that are generated using one of the Bridge testnets.
70+
///
71+
/// Those weights are test only and must never be used in production.
72+
pub struct BridgeWeight<T>(PhantomData<T>);
73+
impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
7274
fn send_minimal_message_worst_case() -> Weight {
73-
(38_822_000 as Weight)
75+
(62_300_000 as Weight)
7476
.saturating_add(T::DbWeight::get().reads(5 as Weight))
7577
.saturating_add(T::DbWeight::get().writes(10 as Weight))
7678
}
7779
fn send_1_kb_message_worst_case() -> Weight {
78-
(39_799_000 as Weight)
80+
(63_176_000 as Weight)
7981
.saturating_add(T::DbWeight::get().reads(5 as Weight))
8082
.saturating_add(T::DbWeight::get().writes(10 as Weight))
8183
}
8284
fn send_16_kb_message_worst_case() -> Weight {
83-
(47_772_000 as Weight)
85+
(73_472_000 as Weight)
8486
.saturating_add(T::DbWeight::get().reads(5 as Weight))
8587
.saturating_add(T::DbWeight::get().writes(10 as Weight))
8688
}
8789
fn maximal_increase_message_fee() -> Weight {
88-
(3_081_804_000 as Weight)
90+
(2_539_209_000 as Weight)
8991
.saturating_add(T::DbWeight::get().reads(3 as Weight))
9092
.saturating_add(T::DbWeight::get().writes(1 as Weight))
9193
}
@@ -96,47 +98,47 @@ impl<T: frame_system::Config> WeightInfo for MillauWeight<T> {
9698
.saturating_add(T::DbWeight::get().writes(1 as Weight))
9799
}
98100
fn receive_single_message_proof() -> Weight {
99-
(26_523_000 as Weight)
101+
(49_205_000 as Weight)
100102
.saturating_add(T::DbWeight::get().reads(4 as Weight))
101103
.saturating_add(T::DbWeight::get().writes(2 as Weight))
102104
}
103105
fn receive_two_messages_proof() -> Weight {
104-
(39_278_000 as Weight)
106+
(62_182_000 as Weight)
105107
.saturating_add(T::DbWeight::get().reads(4 as Weight))
106108
.saturating_add(T::DbWeight::get().writes(2 as Weight))
107109
}
108110
fn receive_single_message_proof_with_outbound_lane_state() -> Weight {
109-
(32_416_000 as Weight)
111+
(55_928_000 as Weight)
110112
.saturating_add(T::DbWeight::get().reads(4 as Weight))
111113
.saturating_add(T::DbWeight::get().writes(2 as Weight))
112114
}
113115
fn receive_single_message_proof_1_kb() -> Weight {
114-
(27_078_000 as Weight)
116+
(47_298_000 as Weight)
115117
.saturating_add(T::DbWeight::get().reads(3 as Weight))
116118
.saturating_add(T::DbWeight::get().writes(1 as Weight))
117119
}
118120
fn receive_single_message_proof_16_kb() -> Weight {
119-
(78_235_000 as Weight)
121+
(105_016_000 as Weight)
120122
.saturating_add(T::DbWeight::get().reads(3 as Weight))
121123
.saturating_add(T::DbWeight::get().writes(1 as Weight))
122124
}
123125
fn receive_single_prepaid_message_proof() -> Weight {
124-
(27_635_000 as Weight)
126+
(49_067_000 as Weight)
125127
.saturating_add(T::DbWeight::get().reads(4 as Weight))
126128
.saturating_add(T::DbWeight::get().writes(2 as Weight))
127129
}
128130
fn receive_delivery_proof_for_single_message() -> Weight {
129-
(34_576_000 as Weight)
131+
(58_520_000 as Weight)
130132
.saturating_add(T::DbWeight::get().reads(5 as Weight))
131133
.saturating_add(T::DbWeight::get().writes(2 as Weight))
132134
}
133135
fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight {
134-
(37_318_000 as Weight)
136+
(61_563_000 as Weight)
135137
.saturating_add(T::DbWeight::get().reads(6 as Weight))
136138
.saturating_add(T::DbWeight::get().writes(2 as Weight))
137139
}
138140
fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight {
139-
(41_245_000 as Weight)
141+
(63_197_000 as Weight)
140142
.saturating_add(T::DbWeight::get().reads(7 as Weight))
141143
.saturating_add(T::DbWeight::get().writes(3 as Weight))
142144
}
@@ -145,22 +147,22 @@ impl<T: frame_system::Config> WeightInfo for MillauWeight<T> {
145147
// For backwards compatibility and tests
146148
impl WeightInfo for () {
147149
fn send_minimal_message_worst_case() -> Weight {
148-
(38_822_000 as Weight)
150+
(62_300_000 as Weight)
149151
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
150152
.saturating_add(RocksDbWeight::get().writes(10 as Weight))
151153
}
152154
fn send_1_kb_message_worst_case() -> Weight {
153-
(39_799_000 as Weight)
155+
(63_176_000 as Weight)
154156
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
155157
.saturating_add(RocksDbWeight::get().writes(10 as Weight))
156158
}
157159
fn send_16_kb_message_worst_case() -> Weight {
158-
(47_772_000 as Weight)
160+
(73_472_000 as Weight)
159161
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
160162
.saturating_add(RocksDbWeight::get().writes(10 as Weight))
161163
}
162164
fn maximal_increase_message_fee() -> Weight {
163-
(3_081_804_000 as Weight)
165+
(2_539_209_000 as Weight)
164166
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
165167
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
166168
}
@@ -171,47 +173,47 @@ impl WeightInfo for () {
171173
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
172174
}
173175
fn receive_single_message_proof() -> Weight {
174-
(26_523_000 as Weight)
176+
(49_205_000 as Weight)
175177
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
176178
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
177179
}
178180
fn receive_two_messages_proof() -> Weight {
179-
(39_278_000 as Weight)
181+
(62_182_000 as Weight)
180182
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
181183
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
182184
}
183185
fn receive_single_message_proof_with_outbound_lane_state() -> Weight {
184-
(32_416_000 as Weight)
186+
(55_928_000 as Weight)
185187
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
186188
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
187189
}
188190
fn receive_single_message_proof_1_kb() -> Weight {
189-
(27_078_000 as Weight)
191+
(47_298_000 as Weight)
190192
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
191193
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
192194
}
193195
fn receive_single_message_proof_16_kb() -> Weight {
194-
(78_235_000 as Weight)
196+
(105_016_000 as Weight)
195197
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
196198
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
197199
}
198200
fn receive_single_prepaid_message_proof() -> Weight {
199-
(27_635_000 as Weight)
201+
(49_067_000 as Weight)
200202
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
201203
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
202204
}
203205
fn receive_delivery_proof_for_single_message() -> Weight {
204-
(34_576_000 as Weight)
206+
(58_520_000 as Weight)
205207
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
206208
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
207209
}
208210
fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight {
209-
(37_318_000 as Weight)
211+
(61_563_000 as Weight)
210212
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
211213
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
212214
}
213215
fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight {
214-
(41_245_000 as Weight)
216+
(63_197_000 as Weight)
215217
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
216218
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
217219
}

modules/messages/src/weights_ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ impl WeightInfoExt for () {
392392
}
393393
}
394394

395-
impl<T: frame_system::Config> WeightInfoExt for crate::weights::MillauWeight<T> {
395+
impl<T: frame_system::Config> WeightInfoExt for crate::weights::BridgeWeight<T> {
396396
fn expected_extra_storage_proof_size() -> u32 {
397397
EXTRA_STORAGE_PROOF_SIZE
398398
}

0 commit comments

Comments
 (0)