-
Notifications
You must be signed in to change notification settings - Fork 331
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(pkg/da): ensure DAH.hash is always calculated during ValidateBasic #845
Conversation
This is useful for headers downloaded from the network. Each such header goes through validation during which the hash should be calculated. Otherwise, the hash is calcualated at much later point, which is prone to races. In celestia-node we observed such races when the DAH.Hahs is read from multiple routines, where both end up calculating the hash and setting the it to the cache value making the race detector complain. Such precompute fixes this.
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.
nice find, 👍 👍
is this needed for celestiaorg/celestia-node#1160? |
I observed the described race while playing with the code there and enabling race detector for tests it was disabled before 1.19. Don't think it's needed for #1160, as it's not directly related, but still should be included in the upcoming release. |
Merging based on celestiaorg/celestia-node#1160 |
#845) This is useful for headers downloaded from the network. Each such header goes through validation during which the hash should be calculated. Otherwise, the hash is calcualated at much later point, which is prone to races. In celestia-node we observed such races when the DAH.Hahs is read from multiple routines, where both end up calculating the hash and setting the it to the cache value making the race detector complain. Such precompute fixes this, similar to how Hash is precomputed in the constructor.
celestiaorg#845) This is useful for headers downloaded from the network. Each such header goes through validation during which the hash should be calculated. Otherwise, the hash is calcualated at much later point, which is prone to races. In celestia-node we observed such races when the DAH.Hahs is read from multiple routines, where both end up calculating the hash and setting the it to the cache value making the race detector complain. Such precompute fixes this, similar to how Hash is precomputed in the constructor.
This is useful for headers downloaded from the network. Each such header goes through validation during which the hash should be calculated. Otherwise, the hash is calcualated at much later point, which is prone to races. In celestia-node we observed such races when the DAH.Hahs is read from multiple routines, where both end up calculating the hash and setting the it to the cache value making the race detector complain. Such precompute fixes this, similar to how Hash is precomputed in the constructor.