@lelantos-org/sdk / sync / rootFromPath
Function: rootFromPath() โ
ts
function rootFromPath(
P,
leaf,
pathElements,
pathIndices
): bigint;Defined in: @lelantos-org/sdk/dist/crypto/path.d.ts:12
Recompute the root a (leaf, path) pair attests to.
The path is validated rather than coerced. This is public API reached with relayer-supplied data by design, and an out-of-range pathIndices[lvl] used to mean the k === slot branch never fired: the running hash was dropped entirely and the level hashed from siblings alone, returning a plausible-looking root for a leaf that was never in the tree. A short sibling array was zero-padded to the same effect.
Parameters โ
| Parameter | Type |
|---|---|
P | Poseidon |
leaf | bigint |
pathElements | bigint[][] |
pathIndices | number[] |
Returns โ
bigint