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

refactor: use deepCopy for eds.Flattened() #315

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

walldiss
Copy link
Member

Protect returned shares by Flattened() with deepcopy similar to other exported methods

@walldiss walldiss self-assigned this Apr 10, 2024
Copy link

codecov bot commented Apr 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.24%. Comparing base (d6c118c) to head (5db05b0).
Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #315      +/-   ##
==========================================
+ Coverage   80.89%   82.24%   +1.34%     
==========================================
  Files           8        7       -1     
  Lines         869      614     -255     
==========================================
- Hits          703      505     -198     
+ Misses        119       66      -53     
+ Partials       47       43       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@walldiss walldiss requested a review from staheri14 April 10, 2024 13:42
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!

@@ -335,7 +335,7 @@ func (ds *dataSquare) SetCell(x uint, y uint, newShare []byte) error {

// Flattened returns the concatenated rows of the data square.
func (ds *dataSquare) Flattened() [][]byte {
flattened := [][]byte(nil)
flattened := make([][]byte, 0, ds.width*ds.width)
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] For better readability, this portion of the code i.e., ds.width*ds.width could be converted to a func that calculates the number of shares in a flattened data square.

@rootulp rootulp changed the title Use deepcopy for eds.Flattened() refactor: use deepCopy for eds.Flattened() Apr 10, 2024
@rootulp rootulp merged commit e4b52cf into celestiaorg:main Apr 10, 2024
5 checks passed
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.

4 participants