Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
7ac23ed3
Unverified
Commit
7ac23ed3
authored
Oct 06, 2020
by
Andronik Ordian
Committed by
GitHub
Oct 06, 2020
Browse files
collator: fix a typo (#1788)
* collator: fix a typo * collator: fix more typos * collator: fix even more typos
parent
b84f3c03
Pipeline
#109701
passed with stages
in 18 minutes and 13 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
node/network/collator-protocol/src/collator_side.rs
View file @
7ac23ed3
...
...
@@ -50,7 +50,7 @@ pub(super) struct Metrics(Option<MetricsInner>);
impl
Metrics
{
fn
on_advertisment_made
(
&
self
)
{
if
let
Some
(
metrics
)
=
&
self
.0
{
metrics
.advertisments_made
.inc
();
metrics
.advertis
e
ments_made
.inc
();
}
}
...
...
@@ -63,7 +63,7 @@ impl Metrics {
#[derive(Clone)]
struct
MetricsInner
{
advertisments_made
:
prometheus
::
Counter
<
prometheus
::
U64
>
,
advertis
e
ments_made
:
prometheus
::
Counter
<
prometheus
::
U64
>
,
collations_sent
:
prometheus
::
Counter
<
prometheus
::
U64
>
,
}
...
...
@@ -72,10 +72,10 @@ impl metrics::Metrics for Metrics {
->
std
::
result
::
Result
<
Self
,
prometheus
::
PrometheusError
>
{
let
metrics
=
MetricsInner
{
advertisments_made
:
prometheus
::
register
(
advertis
e
ments_made
:
prometheus
::
register
(
prometheus
::
Counter
::
new
(
"parachain_advertisments_made_total"
,
"A number of advertisments sent to validators."
,
"parachain_
collation_
advertis
e
ments_made_total"
,
"A number of
collation
advertis
e
ments sent to validators."
,
)
?
,
registry
,
)
?
,
...
...
node/network/collator-protocol/src/validator_side.rs
View file @
7ac23ed3
...
...
@@ -150,9 +150,9 @@ struct State {
/// Peers that have declared themselves as collators.
known_collators
:
HashMap
<
PeerId
,
CollatorId
>
,
/// Advertisments received from collators. We accept one advertisment
/// Advertis
e
ments received from collators. We accept one advertis
e
ment
/// per collator per source per relay-parent.
advertisments
:
HashMap
<
PeerId
,
HashSet
<
(
ParaId
,
Hash
)
>>
,
advertis
e
ments
:
HashMap
<
PeerId
,
HashSet
<
(
ParaId
,
Hash
)
>>
,
/// Derive RequestIds from this.
next_request_id
:
RequestId
,
...
...
@@ -220,7 +220,7 @@ where
let
mut
relevant_advertiser
=
None
;
// Has the collator in question advertised a relevant collation?
for
(
k
,
v
)
in
state
.advertisments
.iter
()
{
for
(
k
,
v
)
in
state
.advertis
e
ments
.iter
()
{
if
v
.contains
(
&
(
para_id
,
relay_parent
))
{
if
state
.known_collators
.get
(
k
)
==
Some
(
&
collator_id
)
{
relevant_advertiser
=
Some
(
k
.clone
());
...
...
@@ -278,7 +278,7 @@ where
/// A peer's view has changed. A number of things should be done:
/// - Ongoing collation requests have to be cancelled.
/// - Advertisments by this peer that are no longer relevant have to be removed.
/// - Advertis
e
ments by this peer that are no longer relevant have to be removed.
async
fn
handle_peer_view_change
(
state
:
&
mut
State
,
peer_id
:
PeerId
,
...
...
@@ -290,8 +290,8 @@ async fn handle_peer_view_change(
*
current
=
view
;
if
let
Some
(
advertisments
)
=
state
.advertisments
.get_mut
(
&
peer_id
)
{
advertisments
.retain
(|(
_
,
relay_parent
)|
!
removed
.contains
(
relay_parent
));
if
let
Some
(
advertis
e
ments
)
=
state
.advertis
e
ments
.get_mut
(
&
peer_id
)
{
advertis
e
ments
.retain
(|(
_
,
relay_parent
)|
!
removed
.contains
(
relay_parent
));
}
let
mut
requests_to_cancel
=
Vec
::
new
();
...
...
@@ -476,7 +476,7 @@ where
state
.peer_views
.entry
(
origin
)
.or_default
();
}
AdvertiseCollation
(
relay_parent
,
para_id
)
=>
{
state
.advertisments
.entry
(
origin
.clone
())
.or_default
()
.insert
((
para_id
,
relay_parent
));
state
.advertis
e
ments
.entry
(
origin
.clone
())
.or_default
()
.insert
((
para_id
,
relay_parent
));
if
let
Some
(
collator
)
=
state
.known_collators
.get
(
&
origin
)
{
notify_candidate_selection
(
ctx
,
collator
.clone
(),
relay_parent
,
para_id
)
.await
?
;
...
...
@@ -817,9 +817,9 @@ mod tests {
.await
}
// As we receive a relevan advertisment act on it and issue a collation request.
// As we receive a relevan
t
advertis
e
ment act on it and issue a collation request.
#[test]
fn
act_on_advertisment
()
{
fn
act_on_advertis
e
ment
()
{
let
test_state
=
TestState
::
default
();
test_harness
(|
test_harness
|
async
move
{
...
...
@@ -1076,7 +1076,7 @@ mod tests {
// A test scenario that takes the following steps
// - Two collators connect, declare themselves and advertise a collation relevant to
// our view.
// - This results subsystem acting upon these advertisments and issuing two messages to
// - This results subsystem acting upon these advertis
e
ments and issuing two messages to
// the CandidateBacking subsystem.
// - CandidateBacking requests both of the collations.
// - Collation protocol requests these collations.
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment