fix(celestia-node-fiber): report original payload size in BlobEvent#3281
Merged
julienrbrt merged 1 commit intoevstack:julien/fiberfrom Apr 23, 2026
Merged
Conversation
listen.go previously set BlobEvent.DataSize to b.DataLen(), which for a share-version-2 Fibre blob is always the fixed share-data layout (fibre_blob_version + commitment = 36 bytes) — not the original payload length. That diverges from ev-node's fibermock contract and misleads any consumer that uses DataSize to allocate buffers or report progress. The v2 share genuinely doesn't carry the original size, and x/fibre v8 has no chain query to derive it from the commitment. The only accurate path is to Download the blob and measure. Listen now does exactly that before forwarding each event. The cost is one FSP round-trip per v2 blob; can be made opt-out later if it hurts throughput-sensitive use cases. Tests: - Showcase restores the strict DataSize == len(payload) assertion across all 10 blobs. - Unit test TestListen_FiltersFibreOnlyAndEmitsEvent now stubs fakeFibre.Download to return a deterministic payload and asserts DataSize matches its length. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
Follow-up to #3280 (landed a few seconds before this fix was pushed). Corrects the `BlobEvent.DataSize` reported by the adapter's Listen path.
The bug
`listen.go` set `BlobEvent.DataSize` to `b.DataLen()`. For a share-version-2 Fibre blob, `DataLen()` is always the fixed on-chain share layout — `fibre_blob_version (4 bytes) + commitment (32 bytes)` — not the original payload length.
The 10-blob showcase on julien/fiber asserts `DataSize > 0` because of this, but ev-node's `fibermock` contract is `DataSize = len(data)` (original payload length). Any downstream consumer using `DataSize` to pre-allocate buffers, filter by size, or report progress would be silently misled.
Why Download-to-resolve
The v2 share genuinely doesn't carry the original size, and `x/fibre` v8 exposes no query that maps `commitment → PaymentPromise.BlobSize`. Events don't carry size either (`EventPayForFibre` has signer/namespace/commitment/validator_count — no size). So the only accurate path is to Download the blob and measure. Listen now does that per v2 event before forwarding.
Cost: one FSP round-trip per v2 BlobEvent. For the showcase (10 × ~40 bytes) this is noise. For 128 MiB blobs it's non-trivial — we can add an opt-out config switch if that becomes material. Correctness wins for now.
Changes
Test plan
Sample output after the fix
```
upload[00] size=37 → listen[01] data_size=37
upload[01] size=38 → listen[02] data_size=38
...
upload[09] size=46 → listen[10] data_size=46
```
(On julien/fiber pre-fix: all 10 reported `data_size=36`.)
🤖 Generated with Claude Code