Skip to content

Comments

Process head_chains in descending order of number of peers#8859

Merged
mergify[bot] merged 2 commits intosigp:release-v8.1from
pawanjay176:smol-sync-fix
Feb 19, 2026
Merged

Process head_chains in descending order of number of peers#8859
mergify[bot] merged 2 commits intosigp:release-v8.1from
pawanjay176:smol-sync-fix

Conversation

@pawanjay176
Copy link
Member

Issue Addressed

N/A

Proposed Changes

Another find by @gitToki. Sort the preferred_ids in descending order as originally intended from the comment in the function.

@pawanjay176 pawanjay176 requested a review from jxs as a code owner February 18, 2026 20:37
@pawanjay176 pawanjay176 requested a review from dapplion February 18, 2026 20:37
@pawanjay176 pawanjay176 added ready-for-review The code is ready for review v8.1.1 Hotfix for v8.1.0 labels Feb 18, 2026
@mergify
Copy link

mergify bot commented Feb 18, 2026

Some required checks have failed. Could you please take a look @pawanjay176? 🙏

@mergify mergify bot added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Feb 18, 2026
.collect::<Vec<_>>();
preferred_ids.sort_unstable();
// Sort in descending order
preferred_ids.sort_unstable_by(|a, b| b.cmp(a));
Copy link
Member

@michaelsproul michaelsproul Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm satisfied that this works for the !chain.is_syncing() part too, as the not-syncing chains will have true, which sorts higher than false (syncing).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree. Based on the comment, I think the intention was always to construct preferred_ids such that the descending sort works, but we sorted ascending by mistake.


let mut syncing_chains = SmallVec::<[Id; PARALLEL_HEAD_CHAINS]>::new();
for (_, _, id) in preferred_ids {
let chain = self.head_chains.get_mut(&id).expect("known chain");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spicy little expect here 😱

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably fine, could change it to a crit! in some other PR

@michaelsproul michaelsproul added ready-for-review The code is ready for review ready-for-merge This PR is ready to merge. and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. ready-for-review The code is ready for review labels Feb 18, 2026
@mergify mergify bot added the queued label Feb 19, 2026
@mergify
Copy link

mergify bot commented Feb 19, 2026

Merge Queue Status

Rule: default


This pull request spent 31 minutes 25 seconds in the queue, including 29 minutes 39 seconds running CI.

Required conditions to merge
  • check-success=local-testnet-success
  • check-success=test-suite-success

mergify bot added a commit that referenced this pull request Feb 19, 2026
@mergify mergify bot merged commit 561898f into sigp:release-v8.1 Feb 19, 2026
57 of 58 checks passed
@mergify mergify bot removed the queued label Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge This PR is ready to merge. v8.1.1 Hotfix for v8.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants