Open rootulp opened 1 year ago
I didn't see this issue beforehand but 100% agree with refactoring it to this structure.
My personal preference would be to have another package called aggregate
(or combine
. I don't really mind the naming) which implements the "compact" part. Thus you would have:
Celestia []Txs -> aggregator -> Blob -> splitter -> []Shares
I briefly explored this issue and the CompactShareSplitter can't easily be decoupled from share indexes because it is aware of ShareRanges. If we remove the index from PFB txs (CIP-20) then this refactor becomes significantly easier / cleaner.
Separately, we're punting this refactor for now to work on higher priority issues.
Context
https://github.com/celestiaorg/celestia-app/pull/1880
Problem
Currently the
pkg/shares
implementation treats compact and spare shares differently. Instead of describing shares as compact or sparse, one can describe all shares as using the sparse format with the addition that Celestia transaction & PFB transaction shares encode additional metadata in their blobs (in the form of reserved bytes). In this way we could describe a share structure that applies to all shares and a way of encoding blob data (i.e. the current compact share schema) that enables developers to parse shares in the middle of a sequence.Proposal
Refactor
pkg/shares
to treat all shares identically. The high level structure may be:parse(shares)
=> share sequencesgetBlob(shareSequence)
=> blobparseCelestiaTransactions(blob)
=> transactions or PFB transactions