hiero-ledger / hiero-ledger/hiero-consensus-node
Anchor RANK_STEP grid at the bottom of the chunk instead of the root
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
`TopToBottomTraversalOrder` sends chunk internals every `RANK_STEP = 3` ranks. The step
grid is currently anchored at the chunk root (`chunkRoot, +3, +6, …` marching down), so
the non-multiple-of-3 remainder of the chunk height lands as a variable gap at the
**bottom**, just above the leaves. The final checked rank therefore sits 1–3 ranks above
the leaves depending on `(leafRank - chunkRootRank) mod 3`.
Because node count doubles per rank, the bottom ranks hold the overwhelming majority of
the tree's nodes. A variable grid phase at the bottom varies how the densest, most
expensive ranks are split into requests — a plausible source of the inconsistent
bottom-level performance observed across reconnects.
### Change
Anchor the step grid at the bottom instead of the root: pin the lowest checked rank
deterministically at `leafRank - k` and march `+3` **upward** from there. `RANK_STEP`
stays at **3** (no step change — anchor change only). This relocates the remainder slack
from the bottom (millions of nodes per rank) to the top (single/double-digit nodes per
rank), where its absolute cost is negligible.
Net effect: same step, same approximate request count and total nodes — only *which*
rank absorbs the non-multiple-of-3 slack moves.
### Hypothesis
Bottom-anchoring reduces **variance** in reconnect performance by fixing the grid phase
against the densest ranks. Variance reduction is valuable on
its own: tightening bottom-level variance may pull marginal reconnects consistently under
the gossip-eligibility threshold, breaking the re-reconnect loop, even if the mean
is unchanged.
### Correctness check
After re-anchoring, the first checked rank is no longer the chunk root. Confirm that
`findOwningChunk` / response routing / teacher drill-down key off the true `chunkRootRank`
for ownership and do **not** assume the topmost checked rank equals the chunk root. If
those concepts are conflated, add a small fix so ownership still resolves to the true
root while the first checked rank is `chunkRootRank + remainder`.
Contributor guide
Assessment
This issue has not been assessed yet.