diff --git a/pkg/shares/share_splitting_test.go b/pkg/shares/share_splitting_test.go index 2705fa71ac..d5d7fcfbd2 100644 --- a/pkg/shares/share_splitting_test.go +++ b/pkg/shares/share_splitting_test.go @@ -64,7 +64,7 @@ func TestSplitTxs(t *testing.T) { append([]uint8{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, // namespace id 0x0, // info byte - 0x0, // reserved byte + 0xb, // BUG: reserved byte should be zero 0xc, // continuation data of first transaction }, bytes.Repeat([]byte{0x0}, 245)...), // padding }, @@ -85,7 +85,7 @@ func TestSplitTxs(t *testing.T) { append([]uint8{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, // namespace id 0x0, // info byte - 0x0, // reserved byte + 0xd, // BUG: reserved byte should be zero 0xe, 0xe, 0xe, // continuation data of second transaction }, bytes.Repeat([]byte{0x0}, 243)...), // padding }, diff --git a/pkg/shares/split_compact_shares.go b/pkg/shares/split_compact_shares.go index 8fb53ace69..bf55a304a9 100644 --- a/pkg/shares/split_compact_shares.go +++ b/pkg/shares/split_compact_shares.go @@ -145,40 +145,9 @@ func (css *CompactShareSplitter) Export() NamespacedShares { dataLengthVarint := css.dataLengthVarint(bytesOfPadding) css.writeDataLengthVarintToFirstShare(dataLengthVarint) - css.forceLastShareReserveByteToZero() return css.shares } -// forceLastShareReserveByteToZero overwrites the reserve byte of the last share -// with zero. See https://github.com/celestiaorg/celestia-app/issues/779 -func (css *CompactShareSplitter) forceLastShareReserveByteToZero() { - if len(css.shares) == 0 { - return - } - lastShare := css.shares[len(css.shares)-1] - rawLastShare := lastShare.Data() - - for i := 0; i < appconsts.CompactShareReservedBytes; i++ { - // here we force the last share reserved byte to be zero to avoid any - // confusion for light clients parsing these shares, as the rest of the - // data after transaction is padding. See - // https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#share - if len(css.shares) == 1 { - // the reserved byte is after the namespace, info byte, and data length varint - rawLastShare[appconsts.NamespaceSize+appconsts.ShareInfoBytes+appconsts.FirstCompactShareDataLengthBytes+i] = byte(0) - } else { - // the reserved byte is after the namespace, info byte - rawLastShare[appconsts.NamespaceSize+appconsts.ShareInfoBytes+i] = byte(0) - } - } - - newLastShare := NamespacedShare{ - Share: rawLastShare, - ID: lastShare.NamespaceID(), - } - css.shares[len(css.shares)-1] = newLastShare -} - // dataLengthVarint returns a varint of the data length written to this compact // share splitter. func (css *CompactShareSplitter) dataLengthVarint(bytesOfPadding int) []byte {