Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
d8764450
Commit
d8764450
authored
2 years ago
by
Svyatoslav Nikolsky
Committed by
Bastian Köcher
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
MaxValues for OutboundLanes map (#1871)
parent
89bb368e
Branches
gh-readonly-queue/master/pr-6205-0596928e649dbd7b8ea8f94cf301926555943534
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bridges/modules/messages/src/lib.rs
+25
-2
25 additions, 2 deletions
bridges/modules/messages/src/lib.rs
bridges/modules/messages/src/weights.rs
+50
-50
50 additions, 50 deletions
bridges/modules/messages/src/weights.rs
with
75 additions
and
52 deletions
bridges/modules/messages/src/lib.rs
+
25
−
2
View file @
d8764450
...
...
@@ -583,8 +583,14 @@ pub mod pallet {
/// Map of lane id => outbound lane data.
#[pallet::storage]
pub
type
OutboundLanes
<
T
:
Config
<
I
>
,
I
:
'static
=
()
>
=
StorageMap
<
_
,
Blake2_128Concat
,
LaneId
,
OutboundLaneData
,
ValueQuery
>
;
pub
type
OutboundLanes
<
T
:
Config
<
I
>
,
I
:
'static
=
()
>
=
StorageMap
<
Hasher
=
Blake2_128Concat
,
Key
=
LaneId
,
Value
=
OutboundLaneData
,
QueryKind
=
ValueQuery
,
OnEmpty
=
GetDefault
,
MaxValues
=
MaybeOutboundLanesCount
<
T
,
I
>
,
>
;
/// All queued outbound messages.
#[pallet::storage]
...
...
@@ -648,6 +654,15 @@ pub mod pallet {
InboundLanes
::
<
T
,
I
>
::
get
(
lane
)
.0
}
}
/// Get-parameter that returns number of active outbound lanes that the pallet maintains.
pub
struct
MaybeOutboundLanesCount
<
T
,
I
>
(
PhantomData
<
(
T
,
I
)
>
);
impl
<
T
:
Config
<
I
>
,
I
:
'static
>
Get
<
Option
<
u32
>>
for
MaybeOutboundLanesCount
<
T
,
I
>
{
fn
get
()
->
Option
<
u32
>
{
Some
(
T
::
ActiveOutboundLanes
::
get
()
.len
()
as
u32
)
}
}
}
impl
<
T
,
I
>
bp_messages
::
source_chain
::
MessagesBridge
<
T
::
RuntimeOrigin
,
T
::
OutboundPayload
>
...
...
@@ -1962,4 +1977,12 @@ mod tests {
MessagesOperatingMode
::
Basic
(
BasicOperatingMode
::
Normal
),
MessagesOperatingMode
::
Basic
(
BasicOperatingMode
::
Halted
)
);
#[test]
fn
maybe_outbound_lanes_count_returns_correct_value
()
{
assert_eq!
(
MaybeOutboundLanesCount
::
<
TestRuntime
,
()
>
::
get
(),
Some
(
mock
::
ActiveOutboundLanes
::
get
()
.len
()
as
u32
)
);
}
}
This diff is collapsed.
Click to expand it.
bridges/modules/messages/src/weights.rs
+
50
−
50
View file @
d8764450
...
...
@@ -88,8 +88,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
// Proof Size summary in bytes:
// Measured: `693`
// Estimated: `54703`
// Minimum execution time:
76_449
nanoseconds.
Weight
::
from_parts
(
127_110
_000
,
54703
)
// Minimum execution time:
50_655
nanoseconds.
Weight
::
from_parts
(
60_502
_000
,
54703
)
.saturating_add
(
T
::
DbWeight
::
get
()
.reads
(
4_u64
))
.saturating_add
(
T
::
DbWeight
::
get
()
.writes
(
2_u64
))
}
...
...
@@ -116,8 +116,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
// Proof Size summary in bytes:
// Measured: `693`
// Estimated: `54703`
// Minimum execution time:
102_297
nanoseconds.
Weight
::
from_parts
(
108_619
_000
,
54703
)
// Minimum execution time:
58_861
nanoseconds.
Weight
::
from_parts
(
60_288
_000
,
54703
)
.saturating_add
(
T
::
DbWeight
::
get
()
.reads
(
4_u64
))
.saturating_add
(
T
::
DbWeight
::
get
()
.writes
(
2_u64
))
}
...
...
@@ -144,8 +144,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
// Proof Size summary in bytes:
// Measured: `693`
// Estimated: `54703`
// Minimum execution time:
84_911
nanoseconds.
Weight
::
from_parts
(
87_518
_000
,
54703
)
// Minimum execution time:
53_459
nanoseconds.
Weight
::
from_parts
(
54_577
_000
,
54703
)
.saturating_add
(
T
::
DbWeight
::
get
()
.reads
(
4_u64
))
.saturating_add
(
T
::
DbWeight
::
get
()
.writes
(
2_u64
))
}
...
...
@@ -167,8 +167,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
// Proof Size summary in bytes:
// Measured: `618`
// Estimated: `54200`
// Minimum execution time:
79_805
nanoseconds.
Weight
::
from_parts
(
84_148
_000
,
54200
)
// Minimum execution time:
54_011
nanoseconds.
Weight
::
from_parts
(
55_573
_000
,
54200
)
.saturating_add
(
T
::
DbWeight
::
get
()
.reads
(
3_u64
))
.saturating_add
(
T
::
DbWeight
::
get
()
.writes
(
1_u64
))
}
...
...
@@ -190,8 +190,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
// Proof Size summary in bytes:
// Measured: `618`
// Estimated: `54200`
// Minimum execution time: 1
41_515
nanoseconds.
Weight
::
from_parts
(
1
50_421
_000
,
54200
)
// Minimum execution time: 1
05_856
nanoseconds.
Weight
::
from_parts
(
1
09_112
_000
,
54200
)
.saturating_add
(
T
::
DbWeight
::
get
()
.reads
(
3_u64
))
.saturating_add
(
T
::
DbWeight
::
get
()
.writes
(
1_u64
))
}
...
...
@@ -207,8 +207,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
///
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
///
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
None
, max_size: Some(44), added:
///
251
9, mode: MaxEncodedLen)
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
Some(1)
, max_size: Some(44), added:
///
53
9, mode: MaxEncodedLen)
///
/// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
///
...
...
@@ -217,9 +217,9 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
fn
receive_delivery_proof_for_single_message
()
->
Weight
{
// Proof Size summary in bytes:
// Measured: `579`
// Estimated: `
759
9`
// Minimum execution time:
54_740
nanoseconds.
Weight
::
from_parts
(
56_637
_000
,
759
9
)
// Estimated: `
561
9`
// Minimum execution time:
40_894
nanoseconds.
Weight
::
from_parts
(
41_766
_000
,
561
9
)
.saturating_add
(
T
::
DbWeight
::
get
()
.reads
(
4_u64
))
.saturating_add
(
T
::
DbWeight
::
get
()
.writes
(
2_u64
))
}
...
...
@@ -235,8 +235,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
///
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
///
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
None
, max_size: Some(44), added:
///
251
9, mode: MaxEncodedLen)
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
Some(1)
, max_size: Some(44), added:
///
53
9, mode: MaxEncodedLen)
///
/// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
///
...
...
@@ -245,9 +245,9 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
fn
receive_delivery_proof_for_two_messages_by_single_relayer
()
->
Weight
{
// Proof Size summary in bytes:
// Measured: `596`
// Estimated: `
759
9`
// Minimum execution time:
54_583
nanoseconds.
Weight
::
from_parts
(
56_205
_000
,
759
9
)
// Estimated: `
561
9`
// Minimum execution time:
39_996
nanoseconds.
Weight
::
from_parts
(
41_452
_000
,
561
9
)
.saturating_add
(
T
::
DbWeight
::
get
()
.reads
(
4_u64
))
.saturating_add
(
T
::
DbWeight
::
get
()
.writes
(
2_u64
))
}
...
...
@@ -263,8 +263,8 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
///
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
///
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
None
, max_size: Some(44), added:
///
251
9, mode: MaxEncodedLen)
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
Some(1)
, max_size: Some(44), added:
///
53
9, mode: MaxEncodedLen)
///
/// Storage: BridgeRelayers RelayerRewards (r:2 w:2)
///
...
...
@@ -273,9 +273,9 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
fn
receive_delivery_proof_for_two_messages_by_two_relayers
()
->
Weight
{
// Proof Size summary in bytes:
// Measured: `596`
// Estimated: `
1013
4`
// Minimum execution time:
59_426
nanoseconds.
Weight
::
from_parts
(
61_911
_000
,
1013
4
)
// Estimated: `
815
4`
// Minimum execution time:
42_281
nanoseconds.
Weight
::
from_parts
(
43_593
_000
,
815
4
)
.saturating_add
(
T
::
DbWeight
::
get
()
.reads
(
5_u64
))
.saturating_add
(
T
::
DbWeight
::
get
()
.writes
(
3_u64
))
}
...
...
@@ -306,8 +306,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `693`
// Estimated: `54703`
// Minimum execution time:
76_449
nanoseconds.
Weight
::
from_parts
(
127_110
_000
,
54703
)
// Minimum execution time:
50_655
nanoseconds.
Weight
::
from_parts
(
60_502
_000
,
54703
)
.saturating_add
(
RocksDbWeight
::
get
()
.reads
(
4_u64
))
.saturating_add
(
RocksDbWeight
::
get
()
.writes
(
2_u64
))
}
...
...
@@ -334,8 +334,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `693`
// Estimated: `54703`
// Minimum execution time:
102_297
nanoseconds.
Weight
::
from_parts
(
108_619
_000
,
54703
)
// Minimum execution time:
58_861
nanoseconds.
Weight
::
from_parts
(
60_288
_000
,
54703
)
.saturating_add
(
RocksDbWeight
::
get
()
.reads
(
4_u64
))
.saturating_add
(
RocksDbWeight
::
get
()
.writes
(
2_u64
))
}
...
...
@@ -362,8 +362,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `693`
// Estimated: `54703`
// Minimum execution time:
84_911
nanoseconds.
Weight
::
from_parts
(
87_518
_000
,
54703
)
// Minimum execution time:
53_459
nanoseconds.
Weight
::
from_parts
(
54_577
_000
,
54703
)
.saturating_add
(
RocksDbWeight
::
get
()
.reads
(
4_u64
))
.saturating_add
(
RocksDbWeight
::
get
()
.writes
(
2_u64
))
}
...
...
@@ -385,8 +385,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `618`
// Estimated: `54200`
// Minimum execution time:
79_805
nanoseconds.
Weight
::
from_parts
(
84_148
_000
,
54200
)
// Minimum execution time:
54_011
nanoseconds.
Weight
::
from_parts
(
55_573
_000
,
54200
)
.saturating_add
(
RocksDbWeight
::
get
()
.reads
(
3_u64
))
.saturating_add
(
RocksDbWeight
::
get
()
.writes
(
1_u64
))
}
...
...
@@ -408,8 +408,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `618`
// Estimated: `54200`
// Minimum execution time: 1
41_515
nanoseconds.
Weight
::
from_parts
(
1
50_421
_000
,
54200
)
// Minimum execution time: 1
05_856
nanoseconds.
Weight
::
from_parts
(
1
09_112
_000
,
54200
)
.saturating_add
(
RocksDbWeight
::
get
()
.reads
(
3_u64
))
.saturating_add
(
RocksDbWeight
::
get
()
.writes
(
1_u64
))
}
...
...
@@ -425,8 +425,8 @@ impl WeightInfo for () {
///
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
///
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
None
, max_size: Some(44), added:
///
251
9, mode: MaxEncodedLen)
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
Some(1)
, max_size: Some(44), added:
///
53
9, mode: MaxEncodedLen)
///
/// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
///
...
...
@@ -435,9 +435,9 @@ impl WeightInfo for () {
fn
receive_delivery_proof_for_single_message
()
->
Weight
{
// Proof Size summary in bytes:
// Measured: `579`
// Estimated: `
759
9`
// Minimum execution time:
54_740
nanoseconds.
Weight
::
from_parts
(
56_637
_000
,
759
9
)
// Estimated: `
561
9`
// Minimum execution time:
40_894
nanoseconds.
Weight
::
from_parts
(
41_766
_000
,
561
9
)
.saturating_add
(
RocksDbWeight
::
get
()
.reads
(
4_u64
))
.saturating_add
(
RocksDbWeight
::
get
()
.writes
(
2_u64
))
}
...
...
@@ -453,8 +453,8 @@ impl WeightInfo for () {
///
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
///
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
None
, max_size: Some(44), added:
///
251
9, mode: MaxEncodedLen)
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
Some(1)
, max_size: Some(44), added:
///
53
9, mode: MaxEncodedLen)
///
/// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
///
...
...
@@ -463,9 +463,9 @@ impl WeightInfo for () {
fn
receive_delivery_proof_for_two_messages_by_single_relayer
()
->
Weight
{
// Proof Size summary in bytes:
// Measured: `596`
// Estimated: `
759
9`
// Minimum execution time:
54_583
nanoseconds.
Weight
::
from_parts
(
56_205
_000
,
759
9
)
// Estimated: `
561
9`
// Minimum execution time:
39_996
nanoseconds.
Weight
::
from_parts
(
41_452
_000
,
561
9
)
.saturating_add
(
RocksDbWeight
::
get
()
.reads
(
4_u64
))
.saturating_add
(
RocksDbWeight
::
get
()
.writes
(
2_u64
))
}
...
...
@@ -481,8 +481,8 @@ impl WeightInfo for () {
///
/// Storage: BridgeRialtoMessages OutboundLanes (r:1 w:1)
///
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
None
, max_size: Some(44), added:
///
251
9, mode: MaxEncodedLen)
/// Proof: BridgeRialtoMessages OutboundLanes (max_values:
Some(1)
, max_size: Some(44), added:
///
53
9, mode: MaxEncodedLen)
///
/// Storage: BridgeRelayers RelayerRewards (r:2 w:2)
///
...
...
@@ -491,9 +491,9 @@ impl WeightInfo for () {
fn
receive_delivery_proof_for_two_messages_by_two_relayers
()
->
Weight
{
// Proof Size summary in bytes:
// Measured: `596`
// Estimated: `
1013
4`
// Minimum execution time:
59_426
nanoseconds.
Weight
::
from_parts
(
61_911
_000
,
1013
4
)
// Estimated: `
815
4`
// Minimum execution time:
42_281
nanoseconds.
Weight
::
from_parts
(
43_593
_000
,
815
4
)
.saturating_add
(
RocksDbWeight
::
get
()
.reads
(
5_u64
))
.saturating_add
(
RocksDbWeight
::
get
()
.writes
(
3_u64
))
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment