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

feat: NewExtendedDataSquare with chunkSize param #236

Merged
merged 2 commits into from
Jul 7, 2023

Conversation

rootulp
Copy link
Collaborator

@rootulp rootulp commented Jul 6, 2023

Closes #231

This PR adds a new constructor called NewExtendedDataSquare that allows @celestia-node to explicitly set the chunkSize on an empty EDS. I choose to not drop the existing ImportExtendedDataSquare as proposed in #85 because that would be public API breaking.

cc: @Wondertan @walldiss

@rootulp rootulp self-assigned this Jul 6, 2023
@rootulp rootulp marked this pull request as ready for review July 6, 2023 21:21
@@ -96,6 +96,49 @@ func TestMarshalJSON(t *testing.T) {
}
}

func TestNewExtendedDataSquare(t *testing.T) {
Copy link
Collaborator Author

@rootulp rootulp Jul 6, 2023

Choose a reason for hiding this comment

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

[note for reviewers] I tend to prefer table driven tests but I found it difficult to write a singular table driven test for all the test cases I wanted to cover because the scenarios that cause errors are different.

If reviewers don't like this style of tests, I can try to refactor to something else.

Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

nice makes sense to me, but will defer to celestia-node

extendeddatasquare_test.go Show resolved Hide resolved
Copy link
Member

@walldiss walldiss left a comment

Choose a reason for hiding this comment

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

LGTM!
Optionally there could be a test that replicates scenario that is currently broken:

  1. Create test chunks
  2. Create eds with empty data
  3. Populate eds by 1/4 of chunks using SetCell
  4. Repair eds
  5. Check that GetCell returns valid data (were 0 size chunks before)

@rootulp
Copy link
Collaborator Author

rootulp commented Jul 7, 2023

Thanks @walldiss for the suggestion! Created #238 b/c pushing a new commit to this PR will dismiss existing approvals.

Copy link
Contributor

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

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

LGTM, added some clarifying questions.

extendeddatasquare.go Show resolved Hide resolved
extendeddatasquare.go Show resolved Hide resolved
@rootulp rootulp merged commit 658af68 into celestiaorg:main Jul 7, 2023
3 checks passed
@rootulp rootulp mentioned this pull request Jul 10, 2023
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.

bug: Allow to set chunkSize to be set in dataSquare
4 participants