func TestBlockSerialization(t *testing.T) {
	block := testutil.ConstructTestBlock(t, 10, 100)
	bb, _, err := serializeBlock(block)
	testutil.AssertNoError(t, err, "")
	deserializedBlock, err := deserializeBlock(bb)
	testutil.AssertNoError(t, err, "")
	testutil.AssertEquals(t, deserializedBlock, block)
}
func TestSerializedBlockInfo(t *testing.T) {
	block := testutil.ConstructTestBlock(t, 10, 100)
	bb, info, err := serializeBlock(block)
	testutil.AssertNoError(t, err, "")
	infoFromBB, err := extractSerializedBlockInfo(bb)
	testutil.AssertNoError(t, err, "")
	testutil.AssertEquals(t, infoFromBB, info)
	testutil.AssertEquals(t, len(info.txOffsets), len(block.Data.Data))
	for txIndex, txEnvBytes := range block.Data.Data {
		txid, err := extractTxID(txEnvBytes)
		testutil.AssertNoError(t, err, "")

		indexInfo := info.txOffsets[txIndex]
		indexTxID := indexInfo.txID
		indexOffset := indexInfo.loc

		testutil.AssertEquals(t, txid, indexTxID)
		b := bb[indexOffset.offset:]
		len, num := proto.DecodeVarint(b)
		txEnvBytesFromBB := b[num : num+int(len)]
		testutil.AssertEquals(t, txEnvBytesFromBB, txEnvBytes)
	}
}