celestiaorg / nmt

Namespaced Merkle Tree
Apache License 2.0
117 stars 43 forks source link

Create a rsmt2d.Tree interface wrapper for NamespacedMerkleTree #24

Closed evan-forbes closed 3 years ago

evan-forbes commented 3 years ago

We need a wrapper that fulfills the rsmt2d.Tree interface. That wrapper will need to be able to create nmt roots assuming that the namespaces are included in the data being pushed, but only for the first half of the tree. This means the wrapper should be aware of the square size ahead of time.

realted ll-core issue

liamsi commented 3 years ago

That wrapper doesn't necessarily need to live in this repo, right? It could be in ll-core for instance. edit: NVM, just saw that you've already created a PR where the wrapper is in here 👍🏼 Let's not get blocked on this then. We can rip out the wrapper later then.

This means the wrapper should be aware of the square size ahead of time.

Another way to achieve the same could be to let ll-core prefix everything with namespace ID, even the parity bytes. Then the tree can differentiate between real shares and (second half) parity shares because the latter would carry the max. namespace.

evan-forbes commented 3 years ago

I don't think it will be difficult to move the logic over to lazyledger-core, and it makes a lot of sense to keep all lazyledger-core logic in lazyledger-core, so I'll close this issue along with the PR.