Skip to content

Commit

Permalink
address renaming nit-picks
Browse files Browse the repository at this point in the history
  • Loading branch information
NazariiDenha committed Sep 2, 2024
1 parent b7214d9 commit eb98626
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions encoding/codecv1/codecv1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions encoding/codecv2/codecv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion encoding/codecv2/codecv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions encoding/codecv4/codecv4.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions encoding/da.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eb98626

Please sign in to comment.