Skip to content

Configurable event filterer#4271

Merged
tsahee merged 10 commits intomasterfrom
transaction-address-collection-filter-events
Jan 31, 2026
Merged

Configurable event filterer#4271
tsahee merged 10 commits intomasterfrom
transaction-address-collection-filter-events

Conversation

@MishkaRogachev
Copy link
Copy Markdown
Contributor

@MishkaRogachev MishkaRogachev commented Jan 22, 2026

Fixes NIT-4250 and NIT-4251

In this PR:

  • Added event filter module with filter rules engine\
  • Configuration for event filter rules
  • Event filter invoked in sequencer's postTxFilter and

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 6.89655% with 135 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.66%. Comparing base (8eae2ea) to head (5955abe).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4271      +/-   ##
==========================================
- Coverage   32.76%   32.66%   -0.11%     
==========================================
  Files         482      483       +1     
  Lines       57036    57181     +145     
==========================================
- Hits        18688    18678      -10     
- Misses      35077    35230     +153     
- Partials     3271     3273       +2     

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 22, 2026

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
4102 5 4097 0
View the top 3 failed tests by shortest run time
TestRedisProduceComplex/one_producer,_all_consumers_are_active
Stack Traces | 1.260s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
�[36mDEBUG�[0m[01-30|18:50:44.770] consumer: xack                           �[36mcid�[0m=1a3bfa6e-d3a6-409a-ac87-5fe81c33596f �[36mmessageId�[0m=1769799043645-9
�[36mDEBUG�[0m[01-30|18:50:44.770] consumer: xdel                           �[36mcid�[0m=1cd063dc-7fb0-430d-ab53-1cf4a1b00979 �[36mmessageId�[0m=1769799043645-5
�[36mDEBUG�[0m[01-30|18:50:44.770] consumer: xdel                           �[36mcid�[0m=bd53fd3f-a49e-43b3-8ff5-2e112bcd2702 �[36mmessageId�[0m=1769799043645-8
�[36mDEBUG�[0m[01-30|18:50:44.771] consumer: xack                           �[36mcid�[0m=a89ce4fe-31af-4c91-9c98-fba40b437870 �[36mmessageId�[0m=1769799043645-10
�[36mDEBUG�[0m[01-30|18:50:44.771] consumer: xdel                           �[36mcid�[0m=ffcc0ffe-f8ee-4859-84be-4cfb60082fa1 �[36mmessageId�[0m=1769799043645-7
�[36mDEBUG�[0m[01-30|18:50:44.771] Redis stream consuming                   �[36mconsumer_id�[0m=4b2b23ca-fbd8-4189-b1c2-87a686e3d44f �[36mmessage_id�[0m=1769799043645-11
�[36mDEBUG�[0m[01-30|18:50:44.771] consumer: setting result                 �[36mcid�[0m=4b2b23ca-fbd8-4189-b1c2-87a686e3d44f �[36mmsgIdInStream�[0m=1769799043645-11 �[36mresultKeyInRedis�[0m=result-key:stream:7949adb9-d46e-471b-83a1-13eda524952e.1769799043645-11
�[36mDEBUG�[0m[01-30|18:50:44.771] consumer: xdel                           �[36mcid�[0m=1a3bfa6e-d3a6-409a-ac87-5fe81c33596f �[36mmessageId�[0m=1769799043645-9
�[36mDEBUG�[0m[01-30|18:50:44.771] Redis stream consuming                   �[36mconsumer_id�[0m=18bc7c01-fe99-49be-91ba-94b1fc6be818 �[36mmessage_id�[0m=1769799043645-12
�[36mDEBUG�[0m[01-30|18:50:44.771] consumer: setting result                 �[36mcid�[0m=18bc7c01-fe99-49be-91ba-94b1fc6be818 �[36mmsgIdInStream�[0m=1769799043645-12 �[36mresultKeyInRedis�[0m=result-key:stream:7949adb9-d46e-471b-83a1-13eda524952e.1769799043645-12
�[36mDEBUG�[0m[01-30|18:50:44.771] consumer: xdel                           �[36mcid�[0m=a89ce4fe-31af-4c91-9c98-fba40b437870 �[36mmessageId�[0m=1769799043645-10
�[36mDEBUG�[0m[01-30|18:50:44.771] consumer: xack                           �[36mcid�[0m=18bc7c01-fe99-49be-91ba-94b1fc6be818 �[36mmessageId�[0m=1769799043645-12
�[36mDEBUG�[0m[01-30|18:50:44.771] consumer: xack                           �[36mcid�[0m=4b2b23ca-fbd8-4189-b1c2-87a686e3d44f �[36mmessageId�[0m=1769799043645-11
�[36mDEBUG�[0m[01-30|18:50:44.771] consumer: xdel                           �[36mcid�[0m=18bc7c01-fe99-49be-91ba-94b1fc6be818 �[36mmessageId�[0m=1769799043645-12
�[36mDEBUG�[0m[01-30|18:50:44.771] consumer: xdel                           �[36mcid�[0m=4b2b23ca-fbd8-4189-b1c2-87a686e3d44f �[36mmessageId�[0m=1769799043645-11
�[33mWARN �[0m[01-30|18:50:44.774] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1769799043643-9
�[36mDEBUG�[0m[01-30|18:50:44.775] redis producer: check responses starting
�[36mDEBUG�[0m[01-30|18:50:44.822] checkResponses                           �[36mresponded�[0m=87 �[36merrored�[0m=0 �[36mchecked�[0m=87
�[36mDEBUG�[0m[01-30|18:50:44.882] Error destroying a stream group          �[36merror�[0m="dial tcp 127.0.0.1:40367: connect: connection refused"
--- FAIL: TestRedisProduceComplex/one_producer,_all_consumers_are_active (1.26s)
TestVersion40
Stack Traces | 6.650s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [01-30|19:02:36.782] Starting work on payload                 id=0x035ed478fffa98d0
INFO [01-30|19:02:36.783] Imported new potential chain segment     number=17  hash=13f40e..0c060c blocks=1   txs=0   mgas=0.000  elapsed=14.764ms     mgasps=0.000    triediffs=60.82KiB  triedirty=0.00B
INFO [01-30|19:02:36.783] Chain head was updated                   number=17  hash=13f40e..0c060c root=531004..9c8de7 elapsed="56.486µs"
INFO [01-30|19:02:36.783] Updated payload                          id=0x035ed478fffa98d0 number=22  hash=0af00d..6e5977 txs=0   withdrawals=0 gas=0          fees=0              root=4e2366..81fab2 elapsed="547.722µs"
INFO [01-30|19:02:36.784] Stopping work on payload                 id=0x035ed478fffa98d0 reason=delivery
INFO [01-30|19:02:36.784] Imported new potential chain segment     number=22  hash=0af00d..6e5977 blocks=1   txs=0   mgas=0.000  elapsed="871.487µs"  mgasps=0.000    triediffs=78.37KiB  triedirty=0.00B
INFO [01-30|19:02:36.785] Chain head was updated                   number=22  hash=0af00d..6e5977 root=4e2366..81fab2 elapsed="57.247µs"
INFO [01-30|19:02:36.785] Writing cached state to disk             block=1   hash=64dc56..c927cc root=d45d64..4e7811
INFO [01-30|19:02:36.785] Persisted trie from memory database      nodes=23  flushnodes=0 size=3.61KiB   flushsize=0.00B time="121.938µs" flushtime=0s gcnodes=0 gcsize=0.00B gctime="1.263µs"   livenodes=0    livesize=0.00B
INFO [01-30|19:02:36.785] Writing cached state to disk             block=1   hash=64dc56..c927cc root=d45d64..4e7811
INFO [01-30|19:02:36.785] Persisted trie from memory database      nodes=0   flushnodes=0 size=0.00B     flushsize=0.00B time="1.092µs"   flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s          livenodes=0    livesize=0.00B
INFO [01-30|19:02:36.785] Writing snapshot state to disk           root=28fb26..40a768
INFO [01-30|19:02:36.785] Persisted trie from memory database      nodes=0   flushnodes=0 size=0.00B     flushsize=0.00B time=901ns       flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s          livenodes=0    livesize=0.00B
INFO [01-30|19:02:36.785] Blockchain stopped
INFO [01-30|19:02:36.786] Submitted transaction                    hash=0x68565284266fd647238c1fc32aca470257ba31a7fdfa32540ec5ef05668dfdef from=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A nonce=811 recipient=0x0C709F340F0BB2e361229e345B7e26999d0969Ab value=1
INFO [01-30|19:02:36.786] Writing cached state to disk             block=1   hash=7d1a99..6c4537 root=8448b4..050cee
INFO [01-30|19:02:36.787] Persisted trie from memory database      nodes=20  flushnodes=0 size=3.26KiB   flushsize=0.00B time="172.201µs" flushtime=0s gcnodes=0 gcsize=0.00B gctime=972ns       livenodes=0    livesize=0.00B
INFO [01-30|19:02:36.787] Writing cached state to disk             block=1   hash=7d1a99..6c4537 root=8448b4..050cee
--- FAIL: TestVersion40 (6.65s)
INFO [01-30|19:02:36.787] Persisted trie from memory database      nodes=0   flushnodes=0 size=0.00B     flushsize=0.00B time="1.894µs"   flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s          livenodes=0    livesize=0.00B
TestRedisProduceComplex
Stack Traces | 20.680s run time
=== RUN   TestRedisProduceComplex
=== PAUSE TestRedisProduceComplex
=== CONT  TestRedisProduceComplex
--- FAIL: TestRedisProduceComplex (20.68s)

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

@MishkaRogachev MishkaRogachev force-pushed the transaction-address-collection-filter-events branch from c30dcd7 to 4bb6f91 Compare January 22, 2026 18:11
@MishkaRogachev MishkaRogachev force-pushed the transaction-address-collection-filter-events branch from 4bb6f91 to 84f9e1e Compare January 23, 2026 10:42
Comment thread arbos/eventfilter/filterevents.go Outdated
Comment thread execution/gethexec/eventfilter/eventfilter.go
Comment thread execution/gethexec/sequencer.go
Comment thread arbos/eventfilter/filterevents.go Outdated
Comment thread arbos/eventfilter/filterevents.go Outdated
@MishkaRogachev MishkaRogachev changed the title Simplified event filter in TxProcessor Configurable event filterer Jan 28, 2026
@MishkaRogachev MishkaRogachev marked this pull request as ready for review January 28, 2026 14:16
Tristan-Wilson
Tristan-Wilson previously approved these changes Jan 29, 2026
Copy link
Copy Markdown
Member

@Tristan-Wilson Tristan-Wilson left a comment

Choose a reason for hiding this comment

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

Great work!

Copy link
Copy Markdown
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

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

overall this is looking great. Very small comments

Comment thread arbos/eventfilter/filterevents.go Outdated
return NewEventFilter(config.Rules)
}

func NewEventFilterFromFile(path string) (*EventFilter, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seems like this and the one above it would be better off returning just rules instead of filter and then you only create a filter once.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment thread execution/gethexec/eventfilter/eventfilter.go
Comment thread arbos/eventfilter/filterevents.go Outdated
}

// ExtractAddresses returns all addresses referenced by this event rule verbatim.
func (f *EventFilter) ExtractAddresses(topics []common.Hash, _data []byte, _emitter common.Address, _sender common.Address) []common.Address {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(not a must) to me the name sounds like mid-step, not suggesting that bypass is also taken into account.. maybe call it something like FilteredAddresses? .. not sure at all about that one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed to AddressesForFiltering

Comment thread arbos/eventfilter/filterevents.go Outdated
}

// Helper function to compute selector from event signature, used for test purposes only.
func Selector4(sig string) [eventSelectorSize]byte {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you use the full behavior here, which is currently implemented as part of ParseSelector? (and also use this function from parseSelector)
The extra time parsing, computing canonical etc. is not a problem for tests, and I'd rather have just one correct implementation rather then risk someone calling this function later for production code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed + removed duplication from Validate()

@tsahee tsahee assigned MishkaRogachev and unassigned tsahee Jan 30, 2026
@MishkaRogachev MishkaRogachev requested a review from tsahee January 30, 2026 12:51
Copy link
Copy Markdown
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

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

LGTM

return &EventFilter{rules: m}, nil
}

func NewEventFilterFromConfig(cfg EventFilterConfig) (*EventFilter, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should take pointer

@tsahee tsahee added this pull request to the merge queue Jan 31, 2026
Merged via the queue into master with commit 00ce4ac Jan 31, 2026
26 of 27 checks passed
@tsahee tsahee deleted the transaction-address-collection-filter-events branch January 31, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants