celestiaorg/celestia-core

Modify hashing function if we choose to go with Compact Blocks

Closed this issue · 2 comments

This serves as more of a reminder. I am not trying to presuppose that we will use compact blocks. However, in the case that we do, it's import that we modify the hash function outlined here:

func (tx Tx) Hash() []byte {
if indexWrapper, isIndexWrapper := UnmarshalIndexWrapper(tx); isIndexWrapper {
return tmhash.Sum(indexWrapper.Tx)
}
if blobTx, isBlobTx := UnmarshalBlobTx(tx); isBlobTx {
return tmhash.Sum(blobTx.Tx)
}
return tmhash.Sum(tx)
}

Or at least modify the hashes used in the cat pool to return the entire hash of the data that is being transmitted. If we don't then someone could modify the contents of a BlobTx and we would not be able to notice that it is a different transaction from the one proposed.

Put another way, the hash over the complete data is needed in compact blocks for the integrity of what is being proposed and eventually committed


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

are we calling checktx on the returned data? if so, are we verifying the blobTx?

and is this only for versions of compact blocks that use the mempool to propogate missing portions of the block in the mempool? ie, in a more breaking version where we change the partsetheader do we have the same issue?

are we calling checktx on the returned data? if so, are we verifying the blobTx?

Yes we are still calling checktx. I wonder the fact that the blob commitments are in the PFB means that someone actually can't modify any of the contents of the blob