gballet / multiproof-rs

A rust implementation of Alexey Akhunov's multiproof algorithm
Apache License 2.0
32 stars 8 forks source link

Drop LEAF's operand #19

Open s1na opened 4 years ago

s1na commented 4 years ago

Leaves are sent in the multiproof slightly different than how they are actually stored in the trie. The difference lies in the key. In the multiproof the first part of a leaf is the full path from root to leaf, instead of the partial path from previous node to leaf. The LEAF opcode has an operand digit which specifies how to get this partial path by cutting a prefix of the full path.

This incurs some overhead on the verifier. If the leaf was sent "normally" verifier could simply hash it without any modifications. But now, they have to decode the leaf, decode hex prefix of key, split it, encode via hex prefix, encode RLP and then hash.

My question is what's the trade-off here? what will we lose if we send leaves "normally" and not send the full path as their keys?