This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolve some todos in async backing statement-distribution branch #6482
Resolve some todos in async backing statement-distribution branch #6482
Changes from 3 commits
8e81f2e
cf1a551
5bb7d20
80e49e6
2e26e76
8bb195d
4218ad2
a0c80c8
3940801
6ec6996
ad9c8ed
4b7aa0c
f978c63
42b9a34
2e6adf7
3e5ab31
2aaa46d
ef462c7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Wasn't totally sure about this.
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.
Seems correct, since we would keep around empty
unique_identifiers
sets over time and gradually leak memory.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 think the implementation could be made more efficient with some code like this:
by_priority
, construct aVec<CandidateHash>
orHashSet
of candidates to inspect inunique_identifiers
.self.unique_identifiers.entry(candidate_hash)
, and then in a single branch onEntry::Occupied
a. remove all entries with the
relay_parent
from the candidate identifier setb. if the set is empty, invoke
entry.remove()
c. we can ignore
Entry::Vacant
. I can explain why we can expect to encounter it but only if nodes are misbehaving and we don't use a deduplicating collection, and there are no issues from ignoring it