Skip to content

chore(taiko-client): cleanup the Ontake fork decompression method #19528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func (i *BlocksInserterPacaya) insertPreconfBlockFromExecutionPayload(
}

// Decompress the transactions list.
decompressedTxs, err := utils.DecompressPacaya(executableData.Transactions[0])
decompressedTxs, err := utils.Decompress(executableData.Transactions[0])
if err != nil {
return nil, fmt.Errorf("failed to decompress transactions list bytes: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/taiko-client/driver/preconf_blocks/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ func (s *PreconfBlockAPIServer) ValidateExecutionPayload(payload *eth.ExecutionP
}

var txs types.Transactions
b, err := utils.DecompressPacaya(payload.Transactions[0])
b, err := utils.Decompress(payload.Transactions[0])
if err != nil {
return fmt.Errorf("invalid zlib bytes for transactions: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (v *TxListDecompressor) tryDecompress(
)

// Decompress the transaction list bytes.
if txListBytes, err = utils.DecompressPacaya(txListBytes); err != nil {
if txListBytes, err = utils.Decompress(txListBytes); err != nil {
log.Info("Failed to decompress tx list bytes", "error", err)
return types.Transactions{}
}
Expand Down
5 changes: 0 additions & 5 deletions packages/taiko-client/pkg/utils/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ func TestEncodeDecodeBytes(t *testing.T) {
require.Nil(t, err)

require.Equal(t, b, decompressed)

decompressed, err = utils.DecompressPacaya(compressed)
require.Nil(t, err)

require.Equal(t, b, decompressed)
}

func TestGWeiToWei(t *testing.T) {
Expand Down
20 changes: 1 addition & 19 deletions packages/taiko-client/pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,32 +104,14 @@ func Compress(txList []byte) ([]byte, error) {
return b.Bytes(), nil
}

// Decompress decompresses the given txList bytes using zlib.
// Decompress decompresses the given txList bytes using zlib, it checks the ErrUnexpectedEOF error.
func Decompress(compressedTxList []byte) ([]byte, error) {
r, err := zlib.NewReader(bytes.NewBuffer(compressedTxList))
if err != nil {
return nil, err
}
defer r.Close()

b, err := io.ReadAll(r)
if err != nil {
if !errors.Is(err, io.EOF) && !errors.Is(err, io.ErrUnexpectedEOF) {
return nil, err
}
}

return b, nil
}

// DecompressPacaya decompresses the given txList bytes using zlib, it checks the ErrUnexpectedEOF error.
func DecompressPacaya(compressedTxList []byte) ([]byte, error) {
r, err := zlib.NewReader(bytes.NewBuffer(compressedTxList))
if err != nil {
return nil, err
}
defer r.Close()

b, err := io.ReadAll(r)
if err != nil {
if !errors.Is(err, io.EOF) {
Expand Down