-
Notifications
You must be signed in to change notification settings - Fork 9
feat: allow custom bloom production #261
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
Conversation
2f975ec to
34e0e87
Compare
18d29c4 to
5bf0ed3
Compare
ARR4N
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.
To get bloom filters for a block when the header doesn't contain the correct bloom, you need a custom accessor to provide arbitrary bloom.
Because in SAE they correspond to the logs from the blocks being settled, while the RPC expects them to be from the transactions included by the block?
Existing test (do I need more?)
I think so. The existing tests only cover the backwards compatibility (i.e. when !ok). The new ones don't need to be extensive, only enough to demonstrate proper plumbing via an integration test. Basically, create a mini setup of how you plan to use everything you've introduced here and then assert correct behaviour. Additionally, it explains the motivation of the PR.
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.
I think integration test could be something like:
- Implement the
BloomOverriderinterface - Verify that the custom blooms are properly indexed and retrieved
NewBloomIndexerServicelifecycle- creation
- indexing
- querying
- shutdown
- (in that order)
- Verify bloom filtering works correctly with overridden blooms
641bdd0 to
1169461
Compare
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.
I'm going to spend some time trying to refactor BloomIndexerService but wanted to share what I'm thinking thus far.
EDIT: decoupling things is working but I'll need a bit more time.
cd5c723 to
187c128
Compare
alarso16
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.
@ARR4N I hate these tests, they're obstructive and test trivial implementation. Should I:
a. Not test this
b. Recreate rather complicated tests
c. Keep these rather useless tests
d. Any other ideas?
This is where it's important to know the difference between the types of test doubles12, and when it's appropriate to use each one. We could characterise what you've done as a spy or mock in that they expect a call to something. Mocks are almost always the wrong solution because they test implementation, not behaviour. The rule of thumb I use is that they're suited to a state-changing call to an external system (i.e. when the "expect" is the behaviour). All that said: rules are meant to be broken. You could instead use a stub that returns a canned Bloom filter and then test the behaviour from the outside. However the probabilistic nature of Bloom filters makes this imperfect, and the "expect" is actually a good alternative. So, these aren't useless, they're just invasive. That's a very specific Footnotes |
Why this should be merged
See ava-labs/strevm#120. To get bloom filters for a block when the header doesn't contain the correct bloom because of SAE's delayed settlement, you need a custom accessor to provide arbitrary bloom.
How this works
Introduces an optional interface which, if satisfied by
filters.Backendimplementations, is used to override the Bloom filter instead of retrieving it from thetypes.Header.How this was tested
Existing tests unchanged. Integration test demonstrates calling of the override method when present.