Skip to content

@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 โ€‹

ParameterType
PPoseidon
leafbigint
pathElementsbigint[][]
pathIndicesnumber[]

Returns โ€‹

bigint

Lelantosno cookies ๐Ÿช ยท no tracking ๐Ÿ‘๏ธ ยท no accounts ๐Ÿ‘คwalletexplorer4536080GitHub