celestiaorg / celestia-core

A fork of CometBFT
Apache License 2.0
489 stars 269 forks source link

Use square sizes that are always a power of two #257

Closed evan-forbes closed 3 years ago

evan-forbes commented 3 years ago

This issue is encapsulating this TODO https://github.com/lazyledger/lazyledger-core/blob/a77b6791c1eb19506d03cdb79b234076b6b444bf/types/block.go#L1354

as a bonus side quest, we should only use one piece of code to find the next power of two. Currently, there are two different functions that define the similar functionality. https://github.com/lazyledger/lazyledger-core/blob/a77b6791c1eb19506d03cdb79b234076b6b444bf/p2p/ipld/read.go#L73 and https://github.com/lazyledger/lazyledger-core/blob/a77b6791c1eb19506d03cdb79b234076b6b444bf/crypto/merkle/tree.go#L95

evan-forbes commented 3 years ago

This PR should also add robust testing for computing shares from block data, as discussed in this comment