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: extends error handling to detect byzantine data and unordered shares in tree construction #242

Merged
merged 47 commits into from
Jul 12, 2023

Conversation

staheri14
Copy link
Contributor

@staheri14 staheri14 commented Jul 7, 2023

Overview

Closes #191

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

rootulp
rootulp previously approved these changes Jul 7, 2023
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

No blocking feedback. Question about the copied file nmtwrapper.go: is it only needed for tests? If yes, is it possible to use the _test.go suffix?

extendeddatacrossword_test.go Outdated Show resolved Hide resolved
extendeddatacrossword_test.go Outdated Show resolved Hide resolved
values [][]byte
wantErr bool
corruptedAxis Axis
corruptedInd uint
Copy link
Collaborator

Choose a reason for hiding this comment

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

[nit] it wasn't immediately obvious what Ind meant but it appears short for index. This suggestion can't be applied directly b/c it implies renaming the variable in this scope

Suggested change
corruptedInd uint
corruptedIndex uint

Copy link
Contributor Author

@staheri14 staheri14 Jul 10, 2023

Choose a reason for hiding this comment

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

This suggestion can't be applied directly b/c it implies renaming the variable in this scope

Can you please expand on this second part of your comment? Nevertheless, I applied the first part of your feedback in 2dcfb41

},
}

for codecName, codec := range codecs {
Copy link
Collaborator

Choose a reason for hiding this comment

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

[optional] there's only one codec so we can remove a layer of nesting from this test case

See: #216

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for mentioning that! I totally agree with eliminating that nested loop. But to keep our PRs more focused and organized, I'd suggest saving this change for a separate PR. Especially since we will have an upcoming PR specifically targeting that issue.

extendeddatacrossword_test.go Outdated Show resolved Hide resolved
extendeddatacrossword_test.go Outdated Show resolved Hide resolved
nmtwrapper.go Outdated Show resolved Hide resolved
evan-forbes
evan-forbes previously approved these changes Jul 8, 2023
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.

LGTM 👍

nmtwrapper.go Outdated
@@ -0,0 +1,142 @@
package rsmt2d

// The contents of this file have been adapted from the source file available at https://github.com/celestiaorg/celestia-app/blob/main/pkg/wrapper/nmt_wrapper.go,
Copy link
Member

Choose a reason for hiding this comment

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

the only thing the wrapper imports is the consts, so maybe it makes sense to accept those consts as args, then move the entire wrapper here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, here is the tracking issue #248.

Copy link
Contributor Author

@staheri14 staheri14 Jul 10, 2023

Choose a reason for hiding this comment

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

That also makes sense to me, cannot see any immediate issue for doing so, however, since it requires some refactoring in the code, I'd say it merits a separate PR.

nmtwrapper.go Outdated
@@ -0,0 +1,142 @@
package rsmt2d

// The contents of this file have been adapted from the source file available at https://github.com/celestiaorg/celestia-app/blob/main/pkg/wrapper/nmt_wrapper.go,
Copy link
Member

Choose a reason for hiding this comment

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

Why copy and why not have these tests next to the wrapper?

Copy link
Member

Choose a reason for hiding this comment

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

Or why not move the wrapper here completely then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or why not move the wrapper here completely then?

That also makes sense to me, cannot see any immediate issue for doing so, however, since it requires some refactoring in the code, I'd say it merits a separate PR. Please see the tracking issue #248.

@staheri14 staheri14 dismissed stale reviews from evan-forbes and rootulp via 2dcfb41 July 10, 2023 20:13
@staheri14
Copy link
Contributor Author

No blocking feedback. Question about the copied file nmtwrapper.go: is it only needed for tests? If yes, is it possible to use the _test.go suffix

Indeed, it serves solely for testing purposes, and I have implemented your suggestion by adding the _test suffix. Please see 799ee73.

rootulp
rootulp previously approved these changes Jul 11, 2023
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

Still LGTM

nmtwrapper_test.go Outdated Show resolved Hide resolved
@staheri14 staheri14 changed the title feat: handles unordered shares feat: extends error handling to detect byzantine data and unordered shares in tree construction Jul 12, 2023
@staheri14 staheri14 merged commit b97517c into main Jul 12, 2023
@staheri14 staheri14 deleted the sanaz/BEFP-unordered-shares-mocked-wrapper branch July 12, 2023 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle out of order shares in the data square
4 participants