@lelantos-org/sdk / primitives / rootFromPath
Function: rootFromPath()
ts
function rootFromPath(
P,
leaf,
pathElements,
pathIndices
): bigint;Defined in: @lelantos-org/sdk/dist/crypto/path.d.ts:9
Recompute the root a (leaf, path) pair attests to.
The path is relayer-supplied, so it is validated rather than coerced: splice would clamp an out-of-range pathIndices[lvl] to a valid slot and yield a plausible root for a position the path does not name, and a level without exactly three siblings is not a quaternary node.
Parameters
| Parameter | Type |
|---|---|
P | Poseidon |
leaf | bigint |
pathElements | bigint[][] |
pathIndices | number[] |
Returns
bigint