Skip to content

WIP - 2250 - Tx compressor#2382

Draft
Filter94 wants to merge 4 commits intomainfrom
2250/additive-tx-compressor
Draft

WIP - 2250 - Tx compressor#2382
Filter94 wants to merge 4 commits intomainfrom
2250/additive-tx-compressor

Conversation

@Filter94
Copy link
Collaborator

@Filter94 Filter94 commented Feb 13, 2026

This PR implements issue(s) #

Checklist

  • I wrote new tests for my new core changes.
  • I have successfully ran tests, style checker and build against my new changes locally.
  • I have informed the team of any breaking changes if there are any.

Note

Medium Risk
Introduces new native compression logic and cross-language bindings plus CI release artifacts, and relaxes a safety heuristic in blob decoding; mistakes could cause runtime crashes, size-limit miscalculations, or compatibility issues with existing blob compression/decompression.

Overview
Adds a new transaction-level additive compressor (TxCompressor) alongside the existing block/blob compressor, including a Go implementation, C-shared exported API (TxInit/TxWrite/TxCanWrite/etc.), and a new JVM module (jvm-libs:linea:tx-compressor) with JNA bindings and tests.

Updates build/release plumbing to produce and ship tx_compressor native binaries (Makefile target + GitHub Actions workflow for linux/arm64/macos), and loosens the blob v1 block-scan heuristic cap (heuristicMaxNbTxs) to allow substantially more transactions per block.

Written by Cursor Bugbot for commit ccacfe0. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings February 13, 2026 13:03
@Filter94 Filter94 marked this pull request as draft February 13, 2026 13:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements transaction-level compression for sequencer block building. The TxCompressor operates at the individual transaction level rather than block level, maintaining compression context across transactions for improved compression ratios. This allows the sequencer to add transactions one-by-one until the compressed size threshold is reached.

Changes:

  • Added Go-based TxCompressor library with JNA bindings for Kotlin/Java
  • Implemented comprehensive compatibility tests between TxCompressor and BlobMaker
  • Updated CI/CD workflows to build and release tx-compressor native libraries

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tracer/linea-constraints Added subproject commit reference
settings.gradle Added tx-compressor module to build
prover/lib/compressor/libtxcompressor/libtxcompressor.go Core Go implementation of transaction compressor with C exports
prover/lib/compressor/blob/v1/tx_compressor_test.go Comprehensive Go tests including compatibility tests with BlobMaker
prover/lib/compressor/blob/v1/tx_compressor.go Transaction compressor implementation with compression context management
prover/lib/compressor/blob/v1/encode.go Increased heuristic max transactions limit from 1024 to 16384
prover/Makefile Added build target for tx-compressor library
jvm-libs/linea/tx-compressor/src/test/kotlin/linea/blob/TxCompressorBlobMakerCompatibilityTest.kt Kotlin compatibility tests verifying TxCompressor/BlobMaker integration
jvm-libs/linea/tx-compressor/src/test/kotlin/linea/blob/GoBackedTxCompressorTest.kt Kotlin unit tests for TxCompressor functionality
jvm-libs/linea/tx-compressor/src/main/kotlin/linea/blob/TxCompressor.kt Kotlin interface and Go-backed implementation with JNA bindings
jvm-libs/linea/tx-compressor/src/main/kotlin/linea/blob/GoNativeTxCompressor.kt JNA interface definitions and factory for native library loading
jvm-libs/linea/tx-compressor/build.gradle Gradle build configuration for tx-compressor module
constraints Updated subproject commit reference
.github/workflows/prover-native-lib-blob-compressor-release.yml Added tx-compressor to CI build and release workflow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 37 to 39
// TODO: Update URL when tx-compressor native libs are released
// For now, we'll use the same release as blob-compressor since they share the dictionary
fetchLibFromZip("https://github.com/Consensys/linea-monorepo/releases/download/blob-libs-v2.1.0-rc1/linea-blob-libs-v2.1.0-rc1.zip", "tx_compressor", libsZipDownloadOutputDir)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TODO comment indicates the download URL is temporary and uses blob-compressor libs. This should be addressed before the PR is merged to ensure the correct tx-compressor native libraries are fetched.

Suggested change
// TODO: Update URL when tx-compressor native libs are released
// For now, we'll use the same release as blob-compressor since they share the dictionary
fetchLibFromZip("https://github.com/Consensys/linea-monorepo/releases/download/blob-libs-v2.1.0-rc1/linea-blob-libs-v2.1.0-rc1.zip", "tx_compressor", libsZipDownloadOutputDir)
fetchLibFromZip("https://github.com/Consensys/linea-monorepo/releases/download/tx-compressor-libs-v2.1.0-rc1/linea-tx-compressor-libs-v2.1.0-rc1.zip", "tx_compressor", libsZipDownloadOutputDir)

Copilot uses AI. Check for mistakes.
Comment on lines +123 to +131
// TxError returns the last encountered error.
// If no error was encountered, returns nil.
//
//export TxError
func TxError() *C.char {
lock.Lock()
defer lock.Unlock()
if lastError != nil {
// this leaks memory, but since this represents a fatal error, it's probably ok.
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment acknowledges memory leakage in error scenarios. Consider documenting the expected lifecycle and whether callers should be aware of this limitation, or if there's a cleanup mechanism that should be implemented.

Suggested change
// TxError returns the last encountered error.
// If no error was encountered, returns nil.
//
//export TxError
func TxError() *C.char {
lock.Lock()
defer lock.Unlock()
if lastError != nil {
// this leaks memory, but since this represents a fatal error, it's probably ok.
// TxError returns the last encountered error as a newly allocated, NUL-terminated C string.
// If no error was encountered, it returns nil.
// The caller takes ownership of the returned pointer and is responsible for freeing it
// (for example, using free(3) or C.free) when it is no longer needed.
//
//export TxError
func TxError() *C.char {
lock.Lock()
defer lock.Unlock()
if lastError != nil {

Copilot uses AI. Check for mistakes.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

return false, fmt.Errorf("failed to revert after forceReset: %w", err)
}
return true, nil
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CanWrite corrupts compressor state after recompression path

High Severity

When forceReset is true (i.e., CanWrite), and the recompression path is triggered because the initial write exceeds the limit, calling tc.compressor.Revert() at the success label wipes ALL compressor state instead of just reverting the new transaction. After recompression, the entire payload (all previous + new transaction bytes) is written in a single Write call, so Revert() undoes that entire write, leaving the compressor empty. The BlobMaker.Write correctly handles this with a custom revert closure that checks recompressionAttempted and restores via payload[:prevLen], but TxCompressor is missing this logic.

Additional Locations (1)

Fix in Cursor Fix in Web

@codecov-commenter
Copy link

codecov-commenter commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 0% with 63 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.94%. Comparing base (0d5cce9) to head (6c4287e).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...pressor/src/main/kotlin/linea/blob/TxCompressor.kt 0.00% 46 Missing ⚠️
...src/main/kotlin/linea/blob/GoNativeTxCompressor.kt 0.00% 17 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2382      +/-   ##
============================================
- Coverage     61.13%   60.94%   -0.20%     
- Complexity     1626     1627       +1     
============================================
  Files           436      438       +2     
  Lines         17362    17425      +63     
  Branches       1908     1913       +5     
============================================
+ Hits          10615    10620       +5     
- Misses         6088     6146      +58     
  Partials        659      659              
Flag Coverage Δ *Carryforward flag
hardhat 97.89% <ø> (ø)
kotlin 56.67% <0.00%> (-0.20%) ⬇️ Carriedforward from 1caf329

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...src/main/kotlin/linea/blob/GoNativeTxCompressor.kt 0.00% <0.00%> (ø)
...pressor/src/main/kotlin/linea/blob/TxCompressor.kt 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants