-
Notifications
You must be signed in to change notification settings - Fork 795
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
Make range sync chain Id sequential #6868
Conversation
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.
If this helps debugging moving away from a hash-based identification, then i'm all for it.
The changes here seem fine to me.
|
||
match collection | ||
.iter_mut() | ||
.find(|(_, chain)| chain.has_same_target(target_head_slot, target_head_root)) |
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.
If we have multiple chains with the same target, this will return the first one.
But this isn't possible I think because we only create a new chain when we cannot find one matching the same target (the None
case), so I think this is fine.
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
Issue Addressed
Currently, we set the
chain_id
of range sync chains tou64(hash(target_root, target_slot))
, which results in a long integer.Proposed Changes
Instead, we can use
network_context.next_id()
as we do for all other sync items and get a unique sequential (not too big) integer as id.Also, if a specific chain for the same target is retried later, it won't get the same ID so we can more clearly differentiate the logs associated with each attempt.