From eb9862657538b4d87441b60478cb79e88ed48106 Mon Sep 17 00:00:00 2001 From: Nazarii Denha Date: Mon, 2 Sep 2024 12:22:43 +0200 Subject: [PATCH] address renaming nit-picks --- encoding/codecv1/codecv1.go | 4 ++-- encoding/codecv2/codecv2.go | 4 ++-- encoding/codecv2/codecv2_test.go | 2 +- encoding/codecv4/codecv4.go | 4 ++-- encoding/da.go | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/encoding/codecv1/codecv1.go b/encoding/codecv1/codecv1.go index e0bb749..25c6798 100644 --- a/encoding/codecv1/codecv1.go +++ b/encoding/codecv1/codecv1.go @@ -360,8 +360,8 @@ func DecodeTxsFromBytes(blobBytes []byte, chunks []*DAChunkRawTx, maxNumChunks i // DecodeTxsFromBlob decodes txs from blob bytes and writes to chunks func DecodeTxsFromBlob(blob *kzg4844.Blob, chunks []*DAChunkRawTx) error { - blobBytes := encoding.BytesFromBlobCanonical(blob) - return DecodeTxsFromBytes(blobBytes[:], chunks, MaxNumChunks) + batchBytes := encoding.BytesFromBlobCanonical(blob) + return DecodeTxsFromBytes(batchBytes[:], chunks, MaxNumChunks) } var errSmallLength error = fmt.Errorf("length of blob bytes is too small") diff --git a/encoding/codecv2/codecv2.go b/encoding/codecv2/codecv2.go index ccfb3e6..dd00dc9 100644 --- a/encoding/codecv2/codecv2.go +++ b/encoding/codecv2/codecv2.go @@ -232,11 +232,11 @@ func DecodeTxsFromBlob(blob *kzg4844.Blob, chunks []*DAChunkRawTx) error { compressedBytes := encoding.BytesFromBlobCanonical(blob) magics := []byte{0x28, 0xb5, 0x2f, 0xfd} - blobBytes, err := encoding.DecompressScrollBatchBytes(append(magics, compressedBytes[:]...)) + batchBytes, err := encoding.DecompressScrollBlobToBatch(append(magics, compressedBytes[:]...)) if err != nil { return err } - return codecv1.DecodeTxsFromBytes(blobBytes, chunks, MaxNumChunks) + return codecv1.DecodeTxsFromBytes(batchBytes, chunks, MaxNumChunks) } // NewDABatchFromBytes decodes the given byte slice into a DABatch. diff --git a/encoding/codecv2/codecv2_test.go b/encoding/codecv2/codecv2_test.go index 5456db4..69713d5 100644 --- a/encoding/codecv2/codecv2_test.go +++ b/encoding/codecv2/codecv2_test.go @@ -413,7 +413,7 @@ func TestCodecV2CompressDecompress(t *testing.T) { magics := []byte{0x28, 0xb5, 0x2f, 0xfd} compressedBytes = append(magics, compressedBytes...) - decompressedBlobBytes, err := encoding.DecompressScrollBatchBytes(compressedBytes) + decompressedBlobBytes, err := encoding.DecompressScrollBlobToBatch(compressedBytes) assert.NoError(t, err) assert.Equal(t, blobBytes, decompressedBlobBytes) diff --git a/encoding/codecv4/codecv4.go b/encoding/codecv4/codecv4.go index 7ad6f99..d1aa48c 100644 --- a/encoding/codecv4/codecv4.go +++ b/encoding/codecv4/codecv4.go @@ -255,11 +255,11 @@ func DecodeTxsFromBlob(blob *kzg4844.Blob, chunks []*DAChunkRawTx) error { // if first byte is 1 - data compressed, 0 - not compressed if rawBytes[0] == 0x1 { magics := []byte{0x28, 0xb5, 0x2f, 0xfd} - blobBytes, err := encoding.DecompressScrollBatchBytes(append(magics, rawBytes[1:]...)) + batchBytes, err := encoding.DecompressScrollBlobToBatch(append(magics, rawBytes[1:]...)) if err != nil { return err } - return codecv1.DecodeTxsFromBytes(blobBytes, chunks, MaxNumChunks) + return codecv1.DecodeTxsFromBytes(batchBytes, chunks, MaxNumChunks) } else { return codecv1.DecodeTxsFromBytes(rawBytes[1:], chunks, MaxNumChunks) } diff --git a/encoding/da.go b/encoding/da.go index 219e254..8ce6c35 100644 --- a/encoding/da.go +++ b/encoding/da.go @@ -366,8 +366,8 @@ func BytesFromBlobCanonical(blob *kzg4844.Blob) [126976]byte { return blobBytes } -// DecompressScrollBatchBytes decompresses the given bytes into scroll batch bytes -func DecompressScrollBatchBytes(compressedBytes []byte) ([]byte, error) { +// DecompressScrollBlobToBatch decompresses the given blob bytes into scroll batch bytes +func DecompressScrollBlobToBatch(compressedBytes []byte) ([]byte, error) { // decompress data in stream and in batches of bytes, because we don't know actual length of compressed data var res []byte readBatchSize := 131072