-
Notifications
You must be signed in to change notification settings - Fork 311
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
feat: support parsing out of context compact shares #1770
feat: support parsing out of context compact shares #1770
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1770 +/- ##
==========================================
+ Coverage 51.60% 51.81% +0.20%
==========================================
Files 107 107
Lines 6647 6680 +33
==========================================
+ Hits 3430 3461 +31
+ Misses 2862 2860 -2
- Partials 355 359 +4
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM! Great work
pkg/shares/compact_shares_test.go
Outdated
@@ -112,6 +112,23 @@ func Test_processCompactShares(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestParseOutOfContextShares(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[optional] in addition to this test, should we consider adding a test case for https://github.com/rootulp/celestia-app/blob/01282c42a8b1d7ea2cfd325c2ed10aed4c317966/pkg/shares/parse.go#L12 that tests out of context shares?
Motivation: parseCompactShares
is private and ParseTxs
is public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SinceParseTxs
uses parseCompactShares
under the hood so instead of adding another test, modified this test using ParseTxs
to make it simpler.
Co-authored-by: Rootul P <rootulp@gmail.com>
Co-authored-by: Rootul P <rootulp@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for adding this @Manav-Aggarwal!!! 🙂
mostly just had a few questions. In future PRs, I think we might be able to test this a bit more thoroughly by incorporating it into some integration tests
ahh nvm, the fact that it was picked up in a square test threw me off, fortunately its not that bad, do we need to check that its a compact share should we perform that check earlier somehow? |
8d6e812
to
1a27120
Compare
Removed the commit that introduced that check for now. I don't think we necessarily need to have that check since the assumption that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for comments after already approving this. On re-review I have a few questions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed in-person. Thanks for adding the comments!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed in-person. Thanks for adding the comments!
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. --> ## Overview Adds logic to handle out of context compact shares and uses it in `parseCompactShares`. Also, adds a corresponding test with different random slices of list of shares to check they are interpretable back into Txs. Closes: celestiaorg#802 <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. --> ## Checklist <!-- Please complete the checklist to ensure that the PR is ready to be reviewed. IMPORTANT: PRs should be left in Draft until the below checklist is completed. --> - [x] New and updated code has appropriate documentation - [x] New and updated code has new and/or updated testing - [x] Required CI checks are passing - [x] Visual proof for any user facing features like CLI or documentation updates - [x] Linked issues closed with keywords --------- Co-authored-by: Rootul P <rootulp@gmail.com> Co-authored-by: Evan Forbes <42654277+evan-forbes@users.noreply.github.com>
Adds ability to: - Convert `TxWithISRs` to Shares - Convert Shares to byte array (that will be posted on celestia) - Convert above byte array back to Shares - Convert Shares back to `TxWithISRs` - Parse Out of Context Shares Adds relevant roundtrip tests Resolves #881 Resolves #934 Resolves #886 Resolves #925 Note: All shares are written and interpreted as compact shares so they contain reserved bytes (see https://celestiaorg.github.io/celestia-app/specs/data_structures.html#compact-share) Related PR in `celestia-app`: celestiaorg/celestia-app#1770
Adds ability to: - Convert `TxWithISRs` to Shares - Convert Shares to byte array (that will be posted on celestia) - Convert above byte array back to Shares - Convert Shares back to `TxWithISRs` - Parse Out of Context Shares Adds relevant roundtrip tests Resolves rollkit#881 Resolves rollkit#934 Resolves rollkit#886 Resolves rollkit#925 Note: All shares are written and interpreted as compact shares so they contain reserved bytes (see https://celestiaorg.github.io/celestia-app/specs/data_structures.html#compact-share) Related PR in `celestia-app`: celestiaorg/celestia-app#1770
Adds ability to: - Convert `TxWithISRs` to Shares - Convert Shares to byte array (that will be posted on celestia) - Convert above byte array back to Shares - Convert Shares back to `TxWithISRs` - Parse Out of Context Shares Adds relevant roundtrip tests Resolves #881 Resolves #934 Resolves #886 Resolves #925 Note: All shares are written and interpreted as compact shares so they contain reserved bytes (see https://celestiaorg.github.io/celestia-app/specs/data_structures.html#compact-share) Related PR in `celestia-app`: celestiaorg/celestia-app#1770
Adds ability to: - Convert `TxWithISRs` to Shares - Convert Shares to byte array (that will be posted on celestia) - Convert above byte array back to Shares - Convert Shares back to `TxWithISRs` - Parse Out of Context Shares Adds relevant roundtrip tests Resolves rollkit#881 Resolves rollkit#934 Resolves rollkit#886 Resolves rollkit#925 Note: All shares are written and interpreted as compact shares so they contain reserved bytes (see https://celestiaorg.github.io/celestia-app/specs/data_structures.html#compact-share) Related PR in `celestia-app`: celestiaorg/celestia-app#1770
Overview
Adds logic to handle out of context compact shares and uses it in
parseCompactShares
. Also, adds a corresponding test with different random slices of list of shares to check they are interpretable back into Txs.Closes: #802
Checklist