Quadratic-Labs / VerkleTries_Besu

MIT License
14 stars 16 forks source link

ENH: implement commit_sparse in nativelib #31

Open thomas-quadratic opened 12 months ago

thomas-quadratic commented 12 months ago

Implement a function commit_sparse that computes commitment on a few values. Its inputs should correspond to 2 parallel arrays, values: Bytes32[], indices: int[]. It returns the commitment of the given values at the positions given by indices.

Rationale: when dealing with LeafNode extensions, we need to split a value into lower and upper parts and commit thus two values. Currently, we would need to left pad with zeroes to be able to use commit, which is not optimal. The commit_sparse is inspired by a similar functionality in rust-verkle library.