feat(db): compress Receipts rows with zstd#465
Merged
Conversation
Receipts rows with zstd
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #465 +/- ##
==========================================
- Coverage 73.32% 68.71% -4.62%
==========================================
Files 209 280 +71
Lines 23132 34143 +11011
==========================================
+ Hits 16961 23460 +6499
- Misses 6171 10683 +4512 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8c779e4 to
b76ca30
Compare
Member
Author
|
Preliminary test done on a database filled with mainnet data of about ~3M blocks, we're able to reduce the |
kariy
added a commit
that referenced
this pull request
Mar 12, 2026
Extracts the envelope logic introduced in #465 for `ReceiptEnvelope` into a generic `Envelope<T>` parameterized by an `EnvelopePayload` trait, then applies the same zstd compression to the `Transactions` table via a new `TxEnvelope` type alias. Each payload type supplies a 4-byte magic (`KRCP` for receipts, `KTXN` for transactions), a human-readable name for error messages, and a `from_legacy_bytes` function for backward-compatible deserialization of pre-envelope rows. The shared `Compress`/`Decompress` impls handle the header, zstd encode/decode, version/encoding validation, and legacy fallback. The `Transactions` table value type changes from `VersionedTx` to `TxEnvelope`. Existing uncompressed rows are transparently decoded via the legacy fallback in `VersionedTx::from_legacy_bytes`, so no migration is needed. However, any code that reads directly from the `Transactions` table outside of the provider (eg. custom tooling) will need to update to handle `TxEnvelope` instead of bare `VersionedTx`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Receiptsrows as an explicit envelope pluszstd(postcard(receipt))while keeping reads compatible with legacy raw-postcard rows.Receiptstable round-trip tests, and document the mixed-format receipt storage indocs/database.md.Compatibility
db.versionbump in this phase.