diff --git a/encoding/codecv0_test.go b/encoding/codecv0_test.go index 603cc3a..0ea6f06 100644 --- a/encoding/codecv0_test.go +++ b/encoding/codecv0_test.go @@ -120,3 +120,68 @@ func TestCodecV0ChunkEncode(t *testing.T) { encoded = hex.EncodeToString(encodedBytes) assert.Equal(t, "01000000000000001100000000646b6ed0000000000000000000000000000000000000000000000000000000000000000000000000007a120001010101", encoded) } + +func TestCodecV0ChunkHash(t *testing.T) { + codecv0, err := CodecFromVersion(CodecV0) + assert.NoError(t, err) + + // chunk with a single empty block + daBlock := &daBlockV0{} + chunk := &daChunkV0{blocks: []DABlock{daBlock}, transactions: [][]*types.TransactionData{nil}} + hash, err := chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x7cdb9d7f02ea58dfeb797ed6b4f7ea68846e4f2b0e30ed1535fc98b60c4ec809", hash.Hex()) + + // invalid hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.L1MessageTxType, TxHash: "0xg"}) + _, err = chunk.Hash() + assert.Error(t, err) + + block := readBlockFromJSON(t, "testdata/blockTrace_02.json") + originalChunk := &Chunk{Blocks: []*Block{block}} + daChunk, err := codecv0.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xde642c68122634b33fa1e6e4243b17be3bfd0dc6f996f204ef6d7522516bd840", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_03.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv0.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xde29f4371cc396b2e7c536cdc7a7c20ac5c728cbb8af3247074c746ff452632b", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_04.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv0.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x9e643c8a9203df542e39d9bfdcb07c99575b3c3d557791329fef9d83cc4147d0", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_05.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv0.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x854fc3136f47ce482ec85ee3325adfa16a1a1d60126e1c119eaaf0c3a9e90f8e", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_06.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv0.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x2aa220ca7bd1368e59e8053eb3831e30854aa2ec8bd3af65cee350c1c0718ba6", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_07.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv0.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xb65521bea7daff75838de07951c3c055966750fb5a270fead5e0e727c32455c3", hash.Hex()) +} diff --git a/encoding/codecv1_test.go b/encoding/codecv1_test.go index d498868..4ea2065 100644 --- a/encoding/codecv1_test.go +++ b/encoding/codecv1_test.go @@ -143,3 +143,89 @@ func TestCodecV1ChunkEncode(t *testing.T) { encoded = hex.EncodeToString(encodedBytes) assert.Equal(t, "01000000000000001100000000646b6ed0000000000000000000000000000000000000000000000000000000000000000000000000007a120001010101", encoded) } + +func TestCodecV1ChunkHash(t *testing.T) { + codecv1, err := CodecFromVersion(CodecV1) + assert.NoError(t, err) + + // chunk with a single empty block + daBlock := &daBlockV0{} + chunk := &daChunkV1{blocks: []DABlock{daBlock}, transactions: [][]*types.TransactionData{nil}} + hash, err := chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x7cdb9d7f02ea58dfeb797ed6b4f7ea68846e4f2b0e30ed1535fc98b60c4ec809", hash.Hex()) + + // L1 transactions are part of the hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.L1MessageTxType, TxHash: "0x0000000000000000000000000000000000000000000000000000000000000000"}) + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // L2 transactions are not part of the hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.DynamicFeeTxType, TxHash: "0x0000000000000000000000000000000000000000000000000000000000000000"}) + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // numL1Messages are not part of the hash + daBlock = chunk.blocks[0].(*daBlockV0) + daBlock.numL1Messages = 1 + chunk.blocks[0] = daBlock + + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // invalid hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.L1MessageTxType, TxHash: "0xg"}) + _, err = chunk.Hash() + assert.Error(t, err) + + block := readBlockFromJSON(t, "testdata/blockTrace_02.json") + originalChunk := &Chunk{Blocks: []*Block{block}} + daChunk, err := codecv1.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x820f25d806ddea0ccdbfa463ee480da5b6ea3906e8a658417fb5417d0f837f5c", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_03.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv1.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x4620b3900e8454133448b677cbb2054c5dd61d467d7ebf752bfb12cffff90f40", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_04.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv1.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x059c6451e83012b405c7e1a38818369012a4a1c87d7d699366eac946d0410d73", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_05.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv1.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x854fc3136f47ce482ec85ee3325adfa16a1a1d60126e1c119eaaf0c3a9e90f8e", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_06.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv1.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x2aa220ca7bd1368e59e8053eb3831e30854aa2ec8bd3af65cee350c1c0718ba6", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_07.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv1.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xb65521bea7daff75838de07951c3c055966750fb5a270fead5e0e727c32455c3", hash.Hex()) +} diff --git a/encoding/codecv2_test.go b/encoding/codecv2_test.go index e3870e2..1e6357d 100644 --- a/encoding/codecv2_test.go +++ b/encoding/codecv2_test.go @@ -143,3 +143,89 @@ func TestCodecV2ChunkEncode(t *testing.T) { encoded = hex.EncodeToString(encodedBytes) assert.Equal(t, "01000000000000001100000000646b6ed0000000000000000000000000000000000000000000000000000000000000000000000000007a120001010101", encoded) } + +func TestCodecV2ChunkHash(t *testing.T) { + codecv2, err := CodecFromVersion(CodecV2) + assert.NoError(t, err) + + // chunk with a single empty block + daBlock := &daBlockV0{} + chunk := &daChunkV1{blocks: []DABlock{daBlock}, transactions: [][]*types.TransactionData{nil}} + hash, err := chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x7cdb9d7f02ea58dfeb797ed6b4f7ea68846e4f2b0e30ed1535fc98b60c4ec809", hash.Hex()) + + // L1 transactions are part of the hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.L1MessageTxType, TxHash: "0x0000000000000000000000000000000000000000000000000000000000000000"}) + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // L2 transactions are not part of the hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.DynamicFeeTxType, TxHash: "0x0000000000000000000000000000000000000000000000000000000000000000"}) + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // numL1Messages are not part of the hash + daBlock = chunk.blocks[0].(*daBlockV0) + daBlock.numL1Messages = 1 + chunk.blocks[0] = daBlock + + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // invalid hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.L1MessageTxType, TxHash: "0xg"}) + _, err = chunk.Hash() + assert.Error(t, err) + + block := readBlockFromJSON(t, "testdata/blockTrace_02.json") + originalChunk := &Chunk{Blocks: []*Block{block}} + daChunk, err := codecv2.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x820f25d806ddea0ccdbfa463ee480da5b6ea3906e8a658417fb5417d0f837f5c", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_03.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv2.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x4620b3900e8454133448b677cbb2054c5dd61d467d7ebf752bfb12cffff90f40", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_04.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv2.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x059c6451e83012b405c7e1a38818369012a4a1c87d7d699366eac946d0410d73", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_05.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv2.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x854fc3136f47ce482ec85ee3325adfa16a1a1d60126e1c119eaaf0c3a9e90f8e", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_06.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv2.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x2aa220ca7bd1368e59e8053eb3831e30854aa2ec8bd3af65cee350c1c0718ba6", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_07.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv2.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xb65521bea7daff75838de07951c3c055966750fb5a270fead5e0e727c32455c3", hash.Hex()) +} diff --git a/encoding/codecv3_test.go b/encoding/codecv3_test.go index 65cd914..46ac01c 100644 --- a/encoding/codecv3_test.go +++ b/encoding/codecv3_test.go @@ -142,3 +142,89 @@ func TestCodecV3ChunkEncode(t *testing.T) { encoded = hex.EncodeToString(encodedBytes) assert.Equal(t, "01000000000000001100000000646b6ed0000000000000000000000000000000000000000000000000000000000000000000000000007a120001010101", encoded) } + +func TestCodecV3ChunkHash(t *testing.T) { + codecv3, err := CodecFromVersion(CodecV3) + assert.NoError(t, err) + + // chunk with a single empty block + daBlock := &daBlockV0{} + chunk := &daChunkV1{blocks: []DABlock{daBlock}, transactions: [][]*types.TransactionData{nil}} + hash, err := chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x7cdb9d7f02ea58dfeb797ed6b4f7ea68846e4f2b0e30ed1535fc98b60c4ec809", hash.Hex()) + + // L1 transactions are part of the hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.L1MessageTxType, TxHash: "0x0000000000000000000000000000000000000000000000000000000000000000"}) + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // L2 transactions are not part of the hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.DynamicFeeTxType, TxHash: "0x0000000000000000000000000000000000000000000000000000000000000000"}) + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // numL1Messages are not part of the hash + daBlock = chunk.blocks[0].(*daBlockV0) + daBlock.numL1Messages = 1 + chunk.blocks[0] = daBlock + + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // invalid hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.L1MessageTxType, TxHash: "0xg"}) + _, err = chunk.Hash() + assert.Error(t, err) + + block := readBlockFromJSON(t, "testdata/blockTrace_02.json") + originalChunk := &Chunk{Blocks: []*Block{block}} + daChunk, err := codecv3.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x820f25d806ddea0ccdbfa463ee480da5b6ea3906e8a658417fb5417d0f837f5c", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_03.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv3.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x4620b3900e8454133448b677cbb2054c5dd61d467d7ebf752bfb12cffff90f40", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_04.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv3.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x059c6451e83012b405c7e1a38818369012a4a1c87d7d699366eac946d0410d73", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_05.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv3.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x854fc3136f47ce482ec85ee3325adfa16a1a1d60126e1c119eaaf0c3a9e90f8e", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_06.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv3.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x2aa220ca7bd1368e59e8053eb3831e30854aa2ec8bd3af65cee350c1c0718ba6", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_07.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv3.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xb65521bea7daff75838de07951c3c055966750fb5a270fead5e0e727c32455c3", hash.Hex()) +} diff --git a/encoding/codecv4_test.go b/encoding/codecv4_test.go index 6256921..648ef99 100644 --- a/encoding/codecv4_test.go +++ b/encoding/codecv4_test.go @@ -143,3 +143,89 @@ func TestCodecV4ChunkEncode(t *testing.T) { encoded = hex.EncodeToString(encodedBytes) assert.Equal(t, "01000000000000001100000000646b6ed0000000000000000000000000000000000000000000000000000000000000000000000000007a120001010101", encoded) } + +func TestCodecV4ChunkHash(t *testing.T) { + codecv4, err := CodecFromVersion(CodecV4) + assert.NoError(t, err) + + // chunk with a single empty block + daBlock := &daBlockV0{} + chunk := &daChunkV1{blocks: []DABlock{daBlock}, transactions: [][]*types.TransactionData{nil}} + hash, err := chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x7cdb9d7f02ea58dfeb797ed6b4f7ea68846e4f2b0e30ed1535fc98b60c4ec809", hash.Hex()) + + // L1 transactions are part of the hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.L1MessageTxType, TxHash: "0x0000000000000000000000000000000000000000000000000000000000000000"}) + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // L2 transactions are not part of the hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.DynamicFeeTxType, TxHash: "0x0000000000000000000000000000000000000000000000000000000000000000"}) + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // numL1Messages are not part of the hash + daBlock = chunk.blocks[0].(*daBlockV0) + daBlock.numL1Messages = 1 + chunk.blocks[0] = daBlock + + hash, err = chunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xdcb42a70c54293e75a19dd1303d167822182d78b361dd7504758c35e516871b2", hash.Hex()) + + // invalid hash + chunk.transactions[0] = append(chunk.transactions[0], &types.TransactionData{Type: types.L1MessageTxType, TxHash: "0xg"}) + _, err = chunk.Hash() + assert.Error(t, err) + + block := readBlockFromJSON(t, "testdata/blockTrace_02.json") + originalChunk := &Chunk{Blocks: []*Block{block}} + daChunk, err := codecv4.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x820f25d806ddea0ccdbfa463ee480da5b6ea3906e8a658417fb5417d0f837f5c", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_03.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv4.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x4620b3900e8454133448b677cbb2054c5dd61d467d7ebf752bfb12cffff90f40", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_04.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv4.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x059c6451e83012b405c7e1a38818369012a4a1c87d7d699366eac946d0410d73", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_05.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv4.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x854fc3136f47ce482ec85ee3325adfa16a1a1d60126e1c119eaaf0c3a9e90f8e", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_06.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv4.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0x2aa220ca7bd1368e59e8053eb3831e30854aa2ec8bd3af65cee350c1c0718ba6", hash.Hex()) + + block = readBlockFromJSON(t, "testdata/blockTrace_07.json") + originalChunk = &Chunk{Blocks: []*Block{block}} + daChunk, err = codecv4.NewDAChunk(originalChunk, 0) + assert.NoError(t, err) + hash, err = daChunk.Hash() + assert.NoError(t, err) + assert.Equal(t, "0xb65521bea7daff75838de07951c3c055966750fb5a270fead5e0e727c32455c3", hash.Hex()) +}