import { Field } from 'o1js';
/**
 * Compute next power of two >= n
 */
export declare function nextPowerOfTwo(n: number): number;
/**
 * Compute depth and padded size for Merkle tree
 */
export declare function computeMerkleTreeDepthAndSize(nLeaves: number): {
    depth: number;
    paddedSize: number;
};
/**
 * Generate zero hashes array of length depth + 1
 */
export declare function getMerkleZeros(depth: number): Field[];
/**
 * Build full Merkle tree layers (root at index 0, leaves at index depth)
 * @param merkleLeaves Unpadded leaves as Field[]
 * @param paddedSize number, power of two >= merkleLeaves.length
 * @param depth number, log2(paddedSize)
 * @param zeros precomputed zero hashes per level (length depth + 1)
 * @returns Field[][], each element a layer of the tree, from root (0) to leaves (depth)
 */ /**
* Build the full Merkle tree from leaves, padding and folding with zeros cache.
* @param merkleLeaves Field[] initial leaves (unpadded)
* @param paddedSize number padded size (power of two)
* @param depth number tree depth
* @param zeros Field[] array of zero hashes for each level
* @returns Field[][] full Merkle tree, root at index 0, leaves at depth index
*/
export declare function buildMerkleTree(merkleLeaves: Field[], paddedSize: number, depth: number, zeros: Field[]): Field[][];
/**
 * Fold Merkle tree bottom-up to get root; modifies leaves in-place.
 * @param leaves Field[], initial leaves (unpadded), will be padded in-place
 * @param paddedSize number, total size padded to power of two
 * @param depth number, tree depth
 * @param zeros Field[] array of zero hashes per level
 * @returns Field root hash
 */
export declare function foldMerkleLeft(leaves: Field[], paddedSize: number, depth: number, zeros: Field[]): Field;
/**
 * Compute the Merkle path (sibling nodes) for a given leaf index from
 * a list of leaves.
 *
 * This function mutates and extends the provided `merkleLeaves` array
 * by padding it to `paddedSize` with zeros, then folds the tree upwards,
 * storing intermediate hashes back into the same array.
 *
 * It returns the vector of sibling hashes from the leaf level up to the root.
 *
 * @param merkleLeaves Mutable array of leaf node hashes (Field elements)
 * @param paddedSize Size to which leaves should be padded (power of two)
 * @param depth Depth of the Merkle tree
 * @param index Leaf index for which to compute the Merkle path
 * @param zeros Array of zero hashes per level for dummy nodes (length >= depth + 1)
 * @returns Array of sibling hashes (Field[]) forming the Merkle path
 */
export declare function getMerklePathFromLeaves(merkleLeaves: Field[], paddedSize: number, depth: number, index: number, zeros: Field[]): Field[];
/**
 * Compute the Merkle path (sibling nodes) for a leaf index from a fully built Merkle tree.
 *
 * Assumes the Merkle tree is represented as an array of levels,
 * where `merkleTree[0]` is the root level (1 node),
 * and `merkleTree[depth]` is the leaf level.
 *
 * @param merkleTree Array of tree levels, each a Field[] array of nodes
 * @param index Leaf index for which to compute the Merkle path
 * @returns Array of sibling hashes (Field[]) forming the Merkle path
 */
export declare function getMerklePathFromTree(merkleTree: Field[][], index: number): Field[];
/**
 * Compute Merkle root from leaf hash, leaf index, and Merkle path
 * @param leafHash Field
 * @param index number leaf index
 * @param path Field[] sibling nodes
 * @returns Field root hash
 */
export declare function computeMerkleRootFromPath(leafHash: Field, index: number, path: Field[]): Field;
