-
Notifications
You must be signed in to change notification settings - Fork 524
txnsync: bloom filter refactoring #2834
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
txnsync: bloom filter refactoring #2834
Conversation
Codecov Report
@@ Coverage Diff @@
## feature/txnsync #2834 +/- ##
===================================================
- Coverage 43.35% 43.34% -0.01%
===================================================
Files 374 374
Lines 84636 84616 -20
===================================================
- Hits 36695 36681 -14
+ Misses 42139 42131 -8
- Partials 5802 5804 +2
Continue to review full report at Codecov.
|
algonautshant
left a comment
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.
Looks great.
A few minor comments.
txnsync/bloomFilter_test.go
Outdated
| testableBf, err := decodeBloomFilter(enc) | ||
| require.NoError(t, err) | ||
| for _, tx := range txnGroups { | ||
| ans := testableBf.test(tx.GroupTransactionID) |
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.
Why is the Modulator variations dropped here?
test checks the modulator value.
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.
good point. I'll add that back. ( i.e. I think that we don't need this for the encoding part.. but we want to verify the testing )
Summary
Refactor the bloom filter implementation to have two "implementations" :
testableBloomFilterandbloomFilter.testableBloomFilteris used exclusively when being received from the network; it does not contain any encodedfields, nor does it include
transactionsRangewhich is used for generating new bloom filters.bloomFilteron the flip side is used only for outgoing bloom filters. It doesn't supporttesting, and it contains only the encoded bloom filter ( and not the underlying bloom filter needed for testing, for instance ).This separation allows us to ensure we don't store bloom filter object beyond the required scope, improving the memory utilization.
Test Plan
This PR does not introduce any new functionality. The existing unit tests were updated to use the updated constructs.