()
| 2337 | max_shard_steps, |
| 2338 | largest_block_steps: largest_block, |
| 2339 | infeasible_atomic_floor: infeasible, |
| 2340 | } |
| 2341 | } |
| 2342 | |
| 2343 | /// Collect the leaf shard ids of an [`AggNode`] in left-to-right DFS order. |
| 2344 | fn dfs_leaf_order(node: &AggNode, out: &mut Vec<u32>) { |
| 2345 | match node { |
| 2346 | AggNode::Leaf(id) => out.push(*id), |
| 2347 | AggNode::Internal(l, r) => { |
| 2348 | dfs_leaf_order(l, out); |
| 2349 | dfs_leaf_order(r, out); |
| 2350 | }, |
| 2351 | } |
| 2352 | } |
| 2353 | |
| 2354 | /// A balanced binary [`AggNode`] over the contiguous shard-id range `lo..hi`. |
| 2355 | fn balanced_agg_tree(lo: u32, hi: u32) -> AggNode { |
| 2356 | debug_assert!(hi > lo); |
| 2357 | if hi - lo <= 1 { |
| 2358 | AggNode::Leaf(lo) |
| 2359 | } else { |
| 2360 | let mid = lo + (hi - lo) / 2; |
| 2361 | AggNode::Internal( |
| 2362 | Box::new(balanced_agg_tree(lo, mid)), |
| 2363 | Box::new(balanced_agg_tree(mid, hi)), |
| 2364 | ) |
| 2365 | } |
| 2366 | } |
| 2367 | |
| 2368 | #[cfg(test)] |
nothing calls this directly
no test coverage detected