You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We enter if condition and update known_authorities only if known_authorities (possibly outdated) contains record_key. Therefore known_authorities might never be updated if record_key is in known_authorities.
Possible condition should look like
if !self.known_authorities.contains_key(&record_key) ||
self.authorities_queried_at.map(|authorities_queried_at| authorities_queried_at != best_hash).unwrap_or(true)
, and then this logic is for the situation where a genuine authority sends us a record before we had possibility to update, in that case you want to update only if you haven't already queried it at the current block(best_hash).
With your suggestion you would update it every time someone sends us a record key that we haven't seen before and that's not good because this requests are untrusted, so you don't want to let them control how often you query authorities which is a runtime call.
Is there an existing issue?
Experiencing problems? Have you tried our Stack Exchange first?
Description of bug
I suspect the following code could lead to potential bug of when list of authorities not being updated:
polkadot-sdk/substrate/client/authority-discovery/src/worker.rs
Lines 695 to 717 in 7d8e3a4
We enter if condition and update
known_authorities
only ifknown_authorities
(possibly outdated) containsrecord_key
. Thereforeknown_authorities
might never be updated ifrecord_key
is inknown_authorities
.Possible condition should look like
Or we just do not understand this code properly:)
cc @alexggh @iceseer
Steps to reproduce
Check if
known_authorities
is actually updated after the set of validators changedThe text was updated successfully, but these errors were encountered: