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

Unexport fields from gossip.BloomFilter #2547

Merged
merged 2 commits into from
Dec 23, 2023
Merged

Conversation

StephenButtolph
Copy link
Contributor

Why this should be merged

This has been introduced multiple times as a bug. Most of the times it was caught before merging... However, it made it through review in #2490. This PR moves the problematic implementation into the SDK and adds a regression test.

How this works

The Salt field is overwritten during ResetBloomFilterIfNeeded. So, the binary representation of Salt must be copied to be used safely.

How this was tested

  • CI
  • Added regression test

@StephenButtolph StephenButtolph added vm This involves virtual machines networking This involves networking labels Dec 23, 2023
@StephenButtolph StephenButtolph added this to the v1.10.18 milestone Dec 23, 2023
@StephenButtolph StephenButtolph self-assigned this Dec 23, 2023
@StephenButtolph StephenButtolph added the bug Something isn't working label Dec 23, 2023
@@ -152,6 +152,5 @@ func (g *gossipMempool) GetFilter() (bloom []byte, salt []byte, err error) {
g.lock.RLock()
defer g.lock.RUnlock()

bloomBytes, err := g.bloom.Bloom.MarshalBinary()
return bloomBytes, g.bloom.Salt[:], err
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a bug - the salt bytes returned here would be modified by calls to ResetBloomFilterIfNeeded and could result in racy behavior.

@StephenButtolph StephenButtolph merged commit 653c2f1 into dev Dec 23, 2023
17 checks passed
@StephenButtolph StephenButtolph deleted the unexport-bloom-fields branch December 23, 2023 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working networking This involves networking vm This involves virtual machines
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants