-
Notifications
You must be signed in to change notification settings - Fork 741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
collator-protocol: Handle unknown validator heads #5538
Conversation
There is a race condition when a validator sends its heads to the collator, but the collator doesn't yet know these heads. Before it is aware of these heads by importing the block(s), any collation registered on the collator is not announced to the validators. The collations aren't advertised, because the collator doesn't know yet that these heads of the validator are descendants of the collations relay parent. The solution is to store these unknown heads of the validators and to handle them when the collator updates its own view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me and good catch.
Did you catch any scenarios when this make a difference?
Right now we have two paths when we advertise a collation:
- When we create the collation.
- When peer sends its view update.
We can't really have a collation if we don't know about the leaf, so I would have expected we try at least once to advertise the collation.
But, then the scenario you describe can happen at the next relay chain leaf, but we should've already advertised the collation, wouldn't we ? And advertise collation seems to have logic to not advertise a collation more than once to the same peer.
Yes. When I was building this, I was running constantly into this issue. For this to work I was building on an older relay chain block and the collation was most of the time always announced internally in this small window before the collator had imported these new blocks. |
polkadot/node/network/collator-protocol/src/collator_side/tests/prospective_parachains.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM based on my limited knowledge of this area 👍
polkadot/node/network/collator-protocol/src/collator_side/tests/prospective_parachains.rs
Outdated
Show resolved
Hide resolved
polkadot/node/network/collator-protocol/src/collator_side/tests/prospective_parachains.rs
Outdated
Show resolved
Hide resolved
|
||
// Announce relevant collations to these peers. | ||
for (peer_id, peer_version) in &peers { | ||
advertise_collation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the race condition, but I still don't get why the collations are not advertised when calling distribute_collation
adter we built on a known relay parent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite strange for local testing, but in practice it could happen that the collation is not advertised for other reasons. The collator has to be really unlucky.
The CI pipeline was cancelled due to failure one of the required jobs. |
…ocol-view-mismatch'
There is a race condition when a validator sends its heads to the collator, but the collator doesn't yet know these heads. Before it is aware of these heads by importing the block(s), any collation registered on the collator is not announced to the validators. The collations aren't advertised, because the collator doesn't know yet that these heads of the validator are descendants of the collations relay parent. The solution is to store these unknown heads of the validators and to handle them when the collator updates its own view.
There is a race condition when a validator sends its heads to the collator, but the collator doesn't yet know these heads. Before it is aware of these heads by importing the block(s), any collation registered on the collator is not announced to the validators. The collations aren't advertised, because the collator doesn't know yet that these heads of the validator are descendants of the collations relay parent.
The solution is to store these unknown heads of the validators and to handle them when the collator updates its own view.