@@ -48,6 +48,44 @@ func TestDecodeAllDeadlock(t *testing.T) {
4848 }
4949}
5050
51+ // TestChunkHashUnique tests that the hashes of any two different chunks are different.
52+ func TestChunkHashUnique (t * testing.T ) {
53+ // construct a chunk with a single, empty block
54+ chunk1 := newDAChunkV7 ([]DABlock {& daBlockV7 {
55+ daBlockV0 : daBlockV0 {
56+ number : 1 ,
57+ timestamp : 0 ,
58+ baseFee : big .NewInt (0 ),
59+ gasLimit : 0 ,
60+ numTransactions : 0 ,
61+ numL1Messages : 0 ,
62+ },
63+ lowestL1MessageQueueIndex : 0 ,
64+ }}, [][]* types.TransactionData {{}})
65+
66+ chunkHash1 , err := chunk1 .Hash ()
67+ require .NoError (t , err )
68+
69+ // construct a 2nd chunk with a single, empty block,
70+ // the only difference is the block number.
71+ chunk2 := newDAChunkV7 ([]DABlock {& daBlockV7 {
72+ daBlockV0 : daBlockV0 {
73+ number : 2 ,
74+ timestamp : 0 ,
75+ baseFee : big .NewInt (0 ),
76+ gasLimit : 0 ,
77+ numTransactions : 0 ,
78+ numL1Messages : 0 ,
79+ },
80+ lowestL1MessageQueueIndex : 0 ,
81+ }}, [][]* types.TransactionData {{}})
82+
83+ chunkHash2 , err := chunk2 .Hash ()
84+ require .NoError (t , err )
85+
86+ require .NotEqual (t , chunkHash1 , chunkHash2 )
87+ }
88+
5189// TestCodecV7DABlockEncodeDecode tests the encoding and decoding of daBlockV7.
5290func TestCodecV7DABlockEncodeDecode (t * testing.T ) {
5391 codecV7 , err := CodecFromVersion (CodecV7 )
0 commit comments