Uh oh!
There was an error while loading. Please reload this page.
fix(celestia-node-fiber): report original payload size in BlobEvent - #3281
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>
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 |
Uh oh!
There was an error while loading. Please reload this page.
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