Skip to content

feat(client): run Fibre operations locally instead of via bridge#4961

Merged
walldiss merged 2 commits intocelestiaorg:feature/fibrefrom
walldiss:feat/fibre-client-self-sufficient
Apr 23, 2026
Merged

feat(client): run Fibre operations locally instead of via bridge#4961
walldiss merged 2 commits intocelestiaorg:feature/fibrefrom
walldiss:feat/fibre-client-self-sufficient

Conversation

@walldiss
Copy link
Copy Markdown
Member

@walldiss walldiss commented Apr 22, 2026

Summary

  • api/client.Client now builds a local *appfibre.Client + *fibre.Service and replaces c.Fibre with nodebuilder/fibre.NewModule(svc). Fibre.Submit, Upload, Download and all escrow ops run directly against consensus gRPC + FSPs — no bridge hop.
  • Exported nodebuilder/fibre.NewModule so api/client and the bridge share the same Module wrapping logic. module stays unexported; only the constructor moves.
  • Implemented the ADR-013 async submission contract: fibre.Service.Upload now fires the MsgPayForFibre broadcast in a background goroutine with a fresh context.Background() + 2-minute timeout. Errors log; the caller returns as soon as off-chain upload + validator sig aggregation completes.
  • ReadClient.Fibre (JSON-RPC to the bridge) is unchanged — read-only users keep working. Client.Close() stops the local appfibre.Client before tearing down the gRPC conn.

Why

ADR-013 scoped the Fibre read path via blob.Subscribe on the node, but the submit path was routed through the bridge by JSON-RPC even though every Fibre method can execute locally given a keyring and a consensus endpoint — the same setup Blob.Submit already uses via blobSubmitClient. Routing through the bridge adds a hop, a base64-encoded 128 MiB payload on the write path, and a third-party dependency for callers that already hold consensus gRPC + a signer.

Follow-up

  • Add sync.WaitGroup + Service.Stop() to fibre.Service so Client.Close() can wait for in-flight async MsgPayForFibre broadcasts before tearing down the tx client. Keeping this out of this PR to keep the diff focused.

Test plan

  • go build -tags fibre ./...
  • go vet -tags fibre ./...
  • go test -tags fibre -count=1 -run TestFibreEscrow ./api/client/... — new test covering Deposit → QueryEscrowAccount → Withdraw → PendingWithdrawals end-to-end over the locally-wired Fibre module.
  • go test -tags fibre -count=1 -run TestSubmission ./api/client/... — existing Blob.Submit path unaffected.
  • TestFibreEscrow does not cover Upload/Download/Submit because the default testnode validators don't run Fibre servers — Upload fails with "not enough voting power: collected 0". That path is validated at integration level against a fibre-enabled network.

🤖 Generated with Claude Code


Open in Devin Review

@walldiss walldiss requested a review from a team as a code owner April 22, 2026 18:31
@walldiss walldiss requested review from ninabarbakadze and removed request for a team April 22, 2026 18:31
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 30.12048% with 58 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (feature/fibre@2372cfa). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fibre/service.go 0.00% 34 Missing ⚠️
api/client/client.go 52.08% 16 Missing and 7 partials ⚠️
nodebuilder/fibre/module.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##             feature/fibre    #4961   +/-   ##
================================================
  Coverage                 ?   34.22%           
================================================
  Files                    ?      317           
  Lines                    ?    26126           
  Branches                 ?        0           
================================================
  Hits                     ?     8941           
  Misses                   ?    16182           
  Partials                 ?     1003           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

devin-ai-integration[bot]

This comment was marked as resolved.

api/client.Client constructs its own appfibre.Client and wraps the shared
fibre.Service with the local nodebuilder/fibre.Module, so Fibre.Submit,
Upload, Download and escrow ops hit consensus gRPC + FSPs directly. The
bridge hop is only kept for ReadClient (read-only users) and Blob.Subscribe,
matching the pattern used by Blob.Submit today.

Implements the ADR-013 async submission contract on fibre.Service.Upload:
MsgPayForFibre is broadcast in a background goroutine with a fresh context
so callers return as soon as off-chain upload and sig aggregation complete.
Per-goroutine timeout bounds the leak; a follow-up PR will add waitgroup
tracking and Service.Stop() lifecycle.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@walldiss walldiss force-pushed the feat/fibre-client-self-sufficient branch from aff4f3c to 577a71b Compare April 22, 2026 18:51
Comment thread fibre/service.go
Comment thread nodebuilder/fibre/module.go Outdated
- fibre/service.go: default nil TxConfig in Upload so the async
  MsgPayForFibre goroutine doesn't panic on SubmitMessage, and add a
  TODO marking the sync-in-goroutine approach as a stopgap until
  QueuedTxClient lands.
- api/client/client.go: collect shutdown errors with errors.Join so one
  failing Stop doesn't leak the other resources (gRPC conn, blob svc,
  core accessor, tx client, appfibre client).
- nodebuilder/fibre/module.go: drop "full nodes" from the NewModule doc
  — celestia-node has only Bridge and Light.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@walldiss walldiss merged commit b07242f into celestiaorg:feature/fibre Apr 23, 2026
28 of 29 checks passed
julienrbrt pushed a commit to evstack/ev-node that referenced this pull request Apr 23, 2026
Adds tools/celestia-node-fiber, a new Go sub-module that implements the
ev-node fiber.DA interface by delegating Upload, Download and Listen to a
celestia-node api/client.Client.

Upload and Download run locally against a Celestia consensus node (gRPC)
and Fibre Storage Providers (Fibre gRPC) — no bridge-node hop — using
celestia-node's self-sufficient client (celestiaorg/celestia-node#4961).
Listen subscribes to blob.Subscribe on a bridge node and forwards only
share-version-2 blobs, which is how Fibre blobs settle on-chain via
MsgPayForFibre.

The package lives in its own go.mod, parallel to tools/local-fiber, so
ev-node core does not inherit celestia-app / cosmos-sdk replace-directive
soup. A FromModules constructor accepts the Fibre and Blob Module
interfaces directly so callers can inject mocks or share an existing
*api/client.Client.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

3 participants