Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support share proofs for multiple blobs #1315

Open
evan-forbes opened this issue Jan 30, 2023 · 0 comments
Open

Support share proofs for multiple blobs #1315

evan-forbes opened this issue Jan 30, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers warn:api breaking item will be break an API and require a major bump

Comments

@evan-forbes
Copy link
Member

Currently, when we create share proofs, we only create a proof for the first blob. We should also support creating inclusion proofs to all of the blobs paid for by a PFB, along with only specific blobs. This would likely involve modifying

// BlobShareRange returns the start and end positions for the shares
// where a given blob, referenced by its wrapped PFB transaction, was published at.
// Note: only supports transactions containing a single blob.
func BlobShareRange(tx types.Tx) (beginShare uint64, endShare uint64, err error) {
indexWrappedTx, isIndexWrapped := types.UnmarshalIndexWrapper(tx)
if !isIndexWrapped {
return beginShare, endShare, fmt.Errorf("not an index wrapped tx")
}
encCfg := encoding.MakeConfig(blobmodule.AppModuleBasic{})
decodedTx, err := encCfg.TxConfig.TxDecoder()(indexWrappedTx.Tx)
if err != nil {
return beginShare, endShare, err
}
if len(decodedTx.GetMsgs()) == 0 {
return beginShare, endShare, fmt.Errorf("PayForBlobs contains no messages")
}
if len(decodedTx.GetMsgs()) > 1 {
return beginShare, endShare, fmt.Errorf("PayForBlobs contains multiple messages and this is not currently supported")
}
if sdk.MsgTypeURL(decodedTx.GetMsgs()[0]) != blobtypes.URLMsgPayForBlobs {
return beginShare, endShare, fmt.Errorf("msg is not a MsgPayForBlobs")
}
pfb, ok := decodedTx.GetMsgs()[0].(*blobtypes.MsgPayForBlobs)
if !ok {
return beginShare, endShare, fmt.Errorf("unable to decode PayForBlob")
}
if err = pfb.ValidateBasic(); err != nil {
return beginShare, endShare, err
}
beginShare = uint64(indexWrappedTx.ShareIndexes[0])
sharesUsed := shares.SparseSharesNeeded(pfb.BlobSizes[0])
return beginShare, beginShare + uint64(sharesUsed) - 1, nil
}

to support this

@evan-forbes evan-forbes added enhancement New feature or request warn:api breaking item will be break an API and require a major bump labels Jan 31, 2023
@rootulp rootulp changed the title Prove specific blobs Support share proofs for multiple blobs Feb 8, 2023
@evan-forbes evan-forbes removed this from the Incentivized Testnet Stretch milestone Apr 2, 2023
@evan-forbes evan-forbes added the good first issue Good for newcomers label Apr 2, 2023
@evan-forbes evan-forbes added the needs:discussion item needs to be discussed as a group in the next sync. if marking an item, pls be prepped to talk label Feb 21, 2024
@evan-forbes evan-forbes removed the needs:discussion item needs to be discussed as a group in the next sync. if marking an item, pls be prepped to talk label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers warn:api breaking item will be break an API and require a major bump
Projects
None yet
Development

No branches or pull requests

1 participant