Skip to content

feat(fibre): implement Fibre Module#4892

Open
vgonkivs wants to merge 17 commits intomainfrom
add_fibre_module
Open

feat(fibre): implement Fibre Module#4892
vgonkivs wants to merge 17 commits intomainfrom
add_fibre_module

Conversation

@vgonkivs
Copy link
Copy Markdown
Member

@vgonkivs vgonkivs commented Mar 25, 2026

@vgonkivs vgonkivs self-assigned this Mar 25, 2026
@vgonkivs vgonkivs requested a review from a team as a code owner March 25, 2026 16:59
@vgonkivs vgonkivs requested a review from walldiss March 25, 2026 16:59
devin-ai-integration[bot]

This comment was marked as resolved.

@vgonkivs vgonkivs force-pushed the add_fibre_module branch 3 times, most recently from 53ba2fa to cbe0341 Compare March 25, 2026 17:18
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

There are two competing fibre blob submission paths, and one of them is incomplete

  • modfibre.Upload

The newly introduced API, however, is incomplete as it doesn't send the PFF transactions. The comment mentions that users should use modblob.SubmitFibreBlob to send TXs; however, doing so requires reuploading the entire blob over the API, and modblob.SubmitFibreBlob reuploads it again.

Essentially, there is no way for fibre users of Upload to pay for their uploads

  • modblob.SubmitFibreBlob

The purpose of this method is unclear. It duplicates the entire fibre blob submission on the old blob service, however, the intention was clearly to introduce a new API as seen in the new fibre module, so why duplicate? If the intention was to allow sending PFFs through this module, then it is unclear why blob module would be responsible for that and not fibre.

Too many layers of indirections

With this PR we have:

  • modfibre.Module
  • fibre.Client
  • fibre.client
  • txclient fibre methods
  • appfibre.Client

This is extremely messy and a pure pain to review. We can easily squash a bunch of them with no repercussions into:

  • modfibre.Module
  • fibre.Service
  • appfibre.Client.

Besides, for whatever reason, out of all those layers, the txclient turned out to be responsible for actually uploading. TxClient, Carl! It is supposed to send transactions and not call appfibre.Client.Upload.

Subscriptions

There is no way to subscribe for blobs from fibre in the order they'be landed through consensus.

@vgonkivs
Copy link
Copy Markdown
Member Author

vgonkivs commented Apr 2, 2026

This PR was done in accordance to the ADR, made by @cmwaters.

There are two competing fibre blob submission paths, and one of them is incomplete
modfibre.Upload
The newly introduced API, however, is incomplete as it doesn't send the PFF transactions. The comment mentions that users should use modblob.SubmitFibreBlob to send TXs; however, doing so requires reuploading the entire blob over the API, and modblob.SubmitFibreBlob reuploads it again.

Link1

Link2

Subscriptions
There is no way to subscribe for blobs from fibre in the order they'be landed through consensus.

Auto-fetching full fibre data from FSPs needs design work first. Feel free to open an ADR update with a proposal

@Wondertan
Copy link
Copy Markdown
Member

@vgonkivs, I acknowledge that the PR implements the ADR. However, it does not change the fact that users can't pay for the uploads they make and we should fix this.

Auto-fetching full fibre data from FSPs needs design work first. Feel free to open an ADR update with a proposal

The subscription does not imply listening for data from FSPs, but listening to new fibre-blobs in the square and fetching respective fibre blobs by commitment.

@vgonkivs
Copy link
Copy Markdown
Member Author

vgonkivs commented Apr 2, 2026

Feel free to open an ADR update with a proposal

@vgonkivs
Copy link
Copy Markdown
Member Author

vgonkivs commented Apr 2, 2026

However, it does not change the fact that users can't pay for the uploads they make and we should fix this.

https://github.com/celestiaorg/celestia-node/pull/4892/changes#diff-575205cc93599bc2a9d28e62e576697e9fcf39733970a61aeebfade20493f1dbR50

@Wondertan
Copy link
Copy Markdown
Member

@Wondertan
Copy link
Copy Markdown
Member

Feel free to open an ADR update with a proposal

Nothing is stopping us from modifying the ADR in this PR. That's a normal feedback process where during implementation issues are discovered and spec/adr is updated accordingly.

@vgonkivs vgonkivs requested a review from Wondertan April 3, 2026 14:57
@vgonkivs
Copy link
Copy Markdown
Member Author

vgonkivs commented Apr 3, 2026

There is no final decision yet on the upload, so no changes were made to this part.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@vgonkivs vgonkivs requested a review from Wondertan April 9, 2026 11:31
devin-ai-integration[bot]

This comment was marked as resolved.

@vgonkivs vgonkivs requested a review from Wondertan April 10, 2026 09:27
devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

last pass, mostly nits and questions

P.S. I haven't reviewed the AccountClient API from a user perspective to determine whether the added endpoints make sense and cover all use cases. The case with Upload completely disincentivized me from reviewing user flow completeness. While the point was correct, it created more tension than good because of the communication style. I trust you guys can review and communicate such things better.

test-unit:
@echo "--> Running unit tests"
@go test $(VERBOSE) -covermode=atomic -coverprofile=coverage.txt `go list ./... | grep -v nodebuilder/tests` $(LOG_AND_FILTER)
@go test $(VERBOSE) -tags=fibre -covermode=atomic -coverprofile=coverage.txt `go list ./... | grep -v nodebuilder/tests` $(LOG_AND_FILTER)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need this tag so that app picks the fibre app?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

w/o the tag all tests that are using app node will be constantly failing. It's a temp solution.

Comment on lines +27 to +28
type SubmitResult struct {
// BlobID is the Fibre blob identifier for the submitted blob.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just an idea to make SubmitResult embed the UploadResult. This will imply that Submit operation does Upload + some stuff which it is and deduplication.

// It encodes the blob, constructs a payment promise, uploads encoded rows to FSPs,
// and aggregates validator availability signatures. It does NOT submit MsgPayForFibre on-chain.
// Use blob.SubmitFibreBlob for the full submit flow.
Upload(_ context.Context, _ libshare.Namespace, _ []byte, _ *txclient.TxConfig) (*UploadResult, error)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: not sure why they are all underscore, would be helpful to name bytes as data for example

// It encodes the blob, constructs a payment promise, uploads encoded rows to FSPs,
// and aggregates validator availability signatures. It does NOT submit MsgPayForFibre on-chain.
// Use blob.SubmitFibreBlob for the full submit flow.
Upload(_ context.Context, _ libshare.Namespace, _ []byte, _ *txclient.TxConfig) (*UploadResult, error)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If it doesn't send tx, why does it expect txclient? To future proof?

// It encodes the blob, constructs a payment promise, uploads encoded rows to FSPs,
// and aggregates validator availability signatures. It does NOT submit MsgPayForFibre on-chain.
// Use blob.SubmitFibreBlob for the full submit flow.
Upload(_ context.Context, _ libshare.Namespace, _ []byte, _ *txclient.TxConfig) (*UploadResult, error)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would mention that we send v0 fibre blob as we currently do no support specifying which version

Upload(_ context.Context, _ libshare.Namespace, _ []byte, _ *txclient.TxConfig) (*UploadResult, error)
// Get retrieves a Fibre blob from FSPs by blobID.
// It reconstructs the original blob data from the encoded rows stored off-chain.
Get(ctx context.Context, blobID []byte) (*GetBlobResult, error)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not a specific type for blobID?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

to avoid external types where it's possible (even they are type aliases)

if err != nil {
return nil, fmt.Errorf("invalid blob ID: %w", err)
}
log.Debugw("downloading fibre blob", "commitment", blbID.Commitment())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should move to Download

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

will move and then remove it from here

Upload(_ context.Context, _ libshare.Namespace, _ []byte, _ *txclient.TxConfig) (*UploadResult, error)
// Get retrieves a Fibre blob from FSPs by blobID.
// It reconstructs the original blob data from the encoded rows stored off-chain.
Get(ctx context.Context, blobID []byte) (*GetBlobResult, error)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Calling it Download like the client does would be slightly easier for us terminologically. The Get by itself doesn't do anything else but calls Download, so not much value giving it another name. Then if we refer to it as Download we know its equivalent to client's download

ns libshare.Namespace,
data []byte,
_ *txclient.TxConfig,
) (_ *appfibre.SignedPaymentPromise, _ appfibre.BlobID, err error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: you can technically retrieve blobId from PaymentPromise, we could even add a BlobID method to it. BlobID is Comm + BlobVer and both are fields of PP.

For the external api in the module, it is still makes sense to keep BlobID as independent field, but for the intermal service we could deduplicate things amd debloat function signature

}

func (a *AccountClient) QueryEscrowAccount(ctx context.Context, signer string) (_ *EscrowAccount, err error) {
if a == nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

a bit confused how is it possible for AccountClient to be nil but not for the entire service. When grpc address is not supplied? But then we can't still send PFF txs right? Or do you want to keep it for reads? We may want to protect the Upload/Submit with ErrNoClient as well

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's more a guard rather than smth specific. But I agree, that we should keep consistency. Will add the same condition to Upload/Submit

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