Lower the bisection tree to an arity-bounded fold plan. The binary tree is collapsed* so each agg call folds up to `arity` whole subtrees (never splitting a subtree across calls), keeping the agg-proof count ~`N/(arity-1)` — a strict binary fold would be ~`N` agg proofs, dominating cost. Children of each agg are emitted in shard order so the subject merkle-fold matches the guest's left-associative
(tree: &AggNode, arity: usize)
| 357 | /// leaf proof; `Agg(children)` folds those slots' proofs in one agg call. |
| 358 | #[derive(Clone, Debug, PartialEq, Eq)] |
| 359 | pub enum FoldOp { |
| 360 | Leaf(u32), |
| 361 | Agg(Vec<usize>), |
| 362 | } |
| 363 | |
| 364 | /// Lower the bisection tree to an arity-bounded fold plan. The binary tree is |
| 365 | /// *collapsed* so each agg call folds up to `arity` whole subtrees (never |
| 366 | /// splitting a subtree across calls), keeping the agg-proof count ~`N/(arity-1)` |
| 367 | /// — a strict binary fold would be ~`N` agg proofs, dominating cost. Children of |