-
Notifications
You must be signed in to change notification settings - Fork 81
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
fix: eds mutation #134
fix: eds mutation #134
Conversation
Codecov Report
@@ Coverage Diff @@
## master #134 +/- ##
==========================================
+ Coverage 81.76% 81.93% +0.17%
==========================================
Files 8 8
Lines 521 537 +16
==========================================
+ Hits 426 440 +14
- Misses 58 59 +1
- Partials 37 38 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Is this still ready for review @rahulghangas? I recall you said you had an idea about something yesterday |
I thought about how to replace |
This comment was marked as duplicate.
This comment was marked as duplicate.
@musalbas I think I can request only one review, so pinging you here. Do the new changes work? |
If we can't think of a cleaner way it's ok with me. |
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.
LGTM. One question though: would it be too difficult to test the change in bahviour as it only affects internals of the implementation?
The only behaviour that has changed (been corrected) is for the state of the underlying eds when trying to repair from incorrect data. I guess we should add a test for that |
Yes, please do 👍🏼 Ideally, a test that would have failed without this fix specifically. |
@@ -274,9 +274,16 @@ func (eds *ExtendedDataSquare) rebuildShares( | |||
func (eds *ExtendedDataSquare) verifyAgainstRowRoots( | |||
rowRoots [][]byte, | |||
r uint, | |||
shares [][]byte, | |||
oldShares [][]byte, | |||
rebuiltIndex int, |
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.
[code quality, blocking] Honestly I would just make these into new functions, instead of passing in a magic value for branching logic. If rebuiltIndex
is noShareInsertion
, then rebuiltShare
must be nil
, but this isn't enforced by the compiler since it's all one function.
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.
Separating out leads to a lot of code duplication because noShareInsertion
needs to be propagated all the way inside to the last function call. Which is why I included noShareInsertion
in the first place
is this still being worked on? if so what is left? @rahulghangas |
Congrats, your important contribution to this open-source project has earned you a GitPOAP! GitPOAP: 2023 Celestia Contributor: Head to gitpoap.io & connect your GitHub account to mint! Learn more about GitPOAPs here. |
Call to
eds.row
returns a slice to the underlying row/col data. Hence, when rebuilt shares are added to this slice, the underlying data is being mutated before correct validation is done. On the other hand, usingeds.Row
is too expensive, since it makes a copy of the underlying data. This PR fixes the first issue while avoiding expensive copying by passing the rebuilt share and/or index to relevant methods