Skip to content

Conversation

@alarso16
Copy link

@alarso16 alarso16 commented Jan 29, 2026

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.Backend implementations, is used to override the Bloom filter instead of retrieving it from the types.Header.

How this was tested

Existing tests unchanged. Integration test demonstrates calling of the override method when present.

@alarso16 alarso16 force-pushed the alarso16/check-bloom-backend branch from 2f975ec to 34e0e87 Compare January 29, 2026 22:23
@alarso16 alarso16 marked this pull request as ready for review January 29, 2026 22:24
@alarso16 alarso16 force-pushed the alarso16/check-bloom-backend branch from 18d29c4 to 5bf0ed3 Compare January 30, 2026 15:11
Copy link
Collaborator

@ARR4N ARR4N left a 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.

Copy link
Member

@JonathanOppenheimer JonathanOppenheimer left a 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 BloomOverrider interface
  • Verify that the custom blooms are properly indexed and retrieved
    • NewBloomIndexerService lifecycle
      • creation
      • indexing
      • querying
      • shutdown
      • (in that order)
  • Verify bloom filtering works correctly with overridden blooms

@alarso16 alarso16 force-pushed the alarso16/check-bloom-backend branch from 641bdd0 to 1169461 Compare February 5, 2026 18:30
Copy link
Collaborator

@ARR4N ARR4N left a 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.

@alarso16 alarso16 force-pushed the alarso16/check-bloom-backend branch from cd5c723 to 187c128 Compare February 10, 2026 16:50
@ava-labs ava-labs deleted a comment from ARR4N Feb 10, 2026
Copy link
Author

@alarso16 alarso16 left a 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?

@ARR4N
Copy link
Collaborator

ARR4N commented Feb 12, 2026

@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 libevm problem (hence the extensive lesson) and in any other scenario wouldn't be an issue. I'll explore a bit more and see if we can find a balance.

Footnotes

  1. https://testing.googleblog.com/2013/07/testing-on-toilet-know-your-test-doubles.html

  2. https://martinfowler.com/bliki/TestDouble.html

@ARR4N ARR4N changed the title feat: Allow custom bloom production feat: allow custom bloom production Feb 12, 2026
@alarso16 alarso16 merged commit 62502c6 into main Feb 12, 2026
12 checks passed
@alarso16 alarso16 deleted the alarso16/check-bloom-backend branch February 12, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants