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

fix(share/p2p/peers): Prevent making pools for nil DataHash #2761

Merged
merged 9 commits into from
Sep 27, 2023

Conversation

renaynay
Copy link
Member

Not critical, but if nil DataHash is broadcasted, node could create pool for empty datahash and just keep it around until garbage collected. Best to short-circuit instead and reject message.

@renaynay renaynay added the kind:fix Attached to bug-fixing PRs label Sep 25, 2023
@renaynay renaynay self-assigned this Sep 25, 2023
@renaynay renaynay added area:shares Shares and samples area:p2p labels Sep 25, 2023
@renaynay
Copy link
Member Author

Actually this doesn't pass tests so converting to draft til i figure it out, will do tmw

@renaynay renaynay marked this pull request as draft September 25, 2023 15:33
@renaynay renaynay marked this pull request as ready for review September 26, 2023 09:00
@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2023

Codecov Report

Merging #2761 (447908d) into main (8602d6e) will increase coverage by 0.17%.
Report is 1 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2761      +/-   ##
==========================================
+ Coverage   51.73%   51.90%   +0.17%     
==========================================
  Files         161      161              
  Lines       10826    10827       +1     
==========================================
+ Hits         5601     5620      +19     
+ Misses       4731     4713      -18     
  Partials      494      494              
Files Coverage Δ
share/p2p/shrexsub/pubsub.go 44.77% <100.00%> (+20.53%) ⬆️

... and 8 files with indirect coverage changes

@renaynay
Copy link
Member Author

renaynay commented Sep 26, 2023

Actuallyshould move this to outer validate func

ramin
ramin previously approved these changes Sep 26, 2023
Copy link
Contributor

@ramin ramin left a comment

Choose a reason for hiding this comment

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

seems reasonable, only suggestion might be to move the msg.DataHash.Validate() to be the first check so as to skip all the other checks proceeding first?

@renaynay renaynay requested a review from ramin September 26, 2023 10:31
Copy link
Contributor

@ramin ramin left a comment

Choose a reason for hiding this comment

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

:shipit:

@distractedm1nd distractedm1nd merged commit 49e6c24 into celestiaorg:main Sep 27, 2023
13 of 15 checks passed
vgonkivs pushed a commit to vgonkivs/celestia-node that referenced this pull request Oct 5, 2023
…org#2761)

Not critical, but if nil DataHash is broadcasted, node could create pool
for empty datahash and just keep it around until garbage collected. Best
to short-circuit instead and reject message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:p2p area:shares Shares and samples kind:fix Attached to bug-fixing PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants