From ae5775da43071807ca7aee8ac82a87ccb5a22f65 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Mon, 25 Aug 2025 09:21:50 +0800 Subject: [PATCH] fix usage of zstd library --- encoding/codecv7_types.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/encoding/codecv7_types.go b/encoding/codecv7_types.go index 2096040..77a09f7 100644 --- a/encoding/codecv7_types.go +++ b/encoding/codecv7_types.go @@ -1,7 +1,6 @@ package encoding import ( - "bytes" "encoding/binary" "encoding/hex" "encoding/json" @@ -478,17 +477,14 @@ func (c *daChunkV7) Hash() (common.Hash, error) { // decompressV7Bytes decompresses the given blob bytes into the original payload bytes. func decompressV7Bytes(compressedBytes []byte) ([]byte, error) { - var res []byte - compressedBytes = append(zstdMagicNumber, compressedBytes...) - r := bytes.NewReader(compressedBytes) - zr, err := zstd.NewReader(r, zstd.WithDecoderConcurrency(1)) + zr, err := zstd.NewReader(nil, zstd.WithDecoderConcurrency(1)) if err != nil { return nil, fmt.Errorf("failed to create zstd reader: %w", err) } defer zr.Close() - res, err = zr.DecodeAll(compressedBytes, res) + res, err := zr.DecodeAll(compressedBytes, nil) if err != nil { return nil, fmt.Errorf("failed to decompress zstd data: %w", err) }