Skip to content

Add FilterSetID to FilteredAddressRecord#4626

Open
MishkaRogachev wants to merge 11 commits intomasterfrom
add-filtersetid-to-filteredaddressrecord
Open

Add FilterSetID to FilteredAddressRecord#4626
MishkaRogachev wants to merge 11 commits intomasterfrom
add-filtersetid-to-filteredaddressrecord

Conversation

@MishkaRogachev
Copy link
Copy Markdown
Contributor

@MishkaRogachev MishkaRogachev commented Apr 10, 2026

Fixes NIT-4780
Waits #4557
Pulls in OffchainLabs/go-ethereum#648

  • Thread FilterSetID through all FilteredAddressRecord construction sites. HashStore.IsRestricted now returns the
    filter set ID atomically with the restriction check.
  • Remove unused _sender parameter from AddressesForFiltering.

@MishkaRogachev MishkaRogachev changed the base branch from master to update-touchaddress-and-hashedaddresscheckerstateisfiltered April 10, 2026 11:27
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 9.52381% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.20%. Comparing base (7a40184) to head (c2faa03).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4626      +/-   ##
==========================================
+ Coverage   33.75%   34.20%   +0.45%     
==========================================
  Files         501      501              
  Lines       60225    60224       -1     
==========================================
+ Hits        20326    20601     +275     
+ Misses      36336    36010     -326     
- Partials     3563     3613      +50     

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 10, 2026

❌ 15 Tests Failed:

Tests completed Failed Passed Skipped
4951 15 4936 0
View the top 3 failed tests by shortest run time
TestRedisProduceComplex/one_producer,_all_consumers_are_active
Stack Traces | 1.280s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
�[36mDEBUG�[0m[04-17|16:32:49.065] consumer: setting result                 �[36mcid�[0m=b1626c2b-5195-4cf9-8cd5-58155b5a1e51 �[36mmsgIdInStream�[0m=1776443567920-4  �[36mresultKeyInRedis�[0m=result-key:stream:f389b189-2b4e-461d-a1e4-020119be9fae.1776443567920-4
�[36mDEBUG�[0m[04-17|16:32:49.058] Redis stream consuming                   �[36mconsumer_id�[0m=b56915b7-bfd0-4c36-84b2-7f63af0df830 �[36mmessage_id�[0m=1776443567920-5
�[36mDEBUG�[0m[04-17|16:32:49.066] consumer: setting result                 �[36mcid�[0m=b56915b7-bfd0-4c36-84b2-7f63af0df830 �[36mmsgIdInStream�[0m=1776443567920-5  �[36mresultKeyInRedis�[0m=result-key:stream:f389b189-2b4e-461d-a1e4-020119be9fae.1776443567920-5
�[36mDEBUG�[0m[04-17|16:32:49.056] redis producer: check responses starting
�[36mDEBUG�[0m[04-17|16:32:49.064] consumer: xdel                           �[36mcid�[0m=20cfc669-57af-4681-ad28-2ed13de3a84e �[36mmessageId�[0m=1776443567919-4
�[36mDEBUG�[0m[04-17|16:32:49.064] consumer: xdel                           �[36mcid�[0m=13f72ad4-83c8-427d-aa94-571fee9407d0 �[36mmessageId�[0m=1776443567919-2
�[36mDEBUG�[0m[04-17|16:32:49.066] trimming                                 �[36mxTrimMinID�[0m=1776443567920-1 �[36mtrimmed�[0m=2 �[36mtrim-err�[0m=<nil>
�[36mDEBUG�[0m[04-17|16:32:49.064] consumer: xack                           �[36mcid�[0m=ae7132f3-471f-4a59-a3c6-fbc7c9015d51 �[36mmessageId�[0m=1776443567920-3
�[36mDEBUG�[0m[04-17|16:32:49.064] consumer: xack                           �[36mcid�[0m=93ea05e2-ce1d-4100-a940-8d0d1d335676 �[36mmessageId�[0m=1776443567920-1
�[36mDEBUG�[0m[04-17|16:32:49.064] consumer: xack                           �[36mcid�[0m=56f9caea-d66e-479d-95a2-236e10affdde �[36mmessageId�[0m=1776443567920-2
�[36mDEBUG�[0m[04-17|16:32:49.066] consumer: xack                           �[36mcid�[0m=b1626c2b-5195-4cf9-8cd5-58155b5a1e51 �[36mmessageId�[0m=1776443567920-4
�[36mDEBUG�[0m[04-17|16:32:49.066] consumer: xack                           �[36mcid�[0m=b56915b7-bfd0-4c36-84b2-7f63af0df830 �[36mmessageId�[0m=1776443567920-5
�[36mDEBUG�[0m[04-17|16:32:49.066] consumer: xdel                           �[36mcid�[0m=b1626c2b-5195-4cf9-8cd5-58155b5a1e51 �[36mmessageId�[0m=1776443567920-4
�[36mDEBUG�[0m[04-17|16:32:49.066] consumer: xdel                           �[36mcid�[0m=93ea05e2-ce1d-4100-a940-8d0d1d335676 �[36mmessageId�[0m=1776443567920-1
�[36mDEBUG�[0m[04-17|16:32:49.066] consumer: xdel                           �[36mcid�[0m=56f9caea-d66e-479d-95a2-236e10affdde �[36mmessageId�[0m=1776443567920-2
�[36mDEBUG�[0m[04-17|16:32:49.066] consumer: xdel                           �[36mcid�[0m=ae7132f3-471f-4a59-a3c6-fbc7c9015d51 �[36mmessageId�[0m=1776443567920-3
�[36mDEBUG�[0m[04-17|16:32:49.066] consumer: xdel                           �[36mcid�[0m=b56915b7-bfd0-4c36-84b2-7f63af0df830 �[36mmessageId�[0m=1776443567920-5
�[36mDEBUG�[0m[04-17|16:32:49.105] checkResponses                           �[36mresponded�[0m=68 �[36merrored�[0m=0 �[36mchecked�[0m=68
�[36mDEBUG�[0m[04-17|16:32:49.160] Error destroying a stream group          �[36merror�[0m="dial tcp 127.0.0.1:39787: connect: connection refused"
--- FAIL: TestRedisProduceComplex/one_producer,_all_consumers_are_active (1.28s)
TestRedisProduceComplex/one_producer,_all_consumers_are_active
Stack Traces | 1.310s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
�[33mWARN �[0m[04-17|16:32:17.399] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536258-15
�[33mWARN �[0m[04-17|16:32:17.400] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536258-17
�[33mWARN �[0m[04-17|16:32:17.400] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536259-0
�[33mWARN �[0m[04-17|16:32:17.400] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536258-19
�[33mWARN �[0m[04-17|16:32:17.400] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536256-10
�[33mWARN �[0m[04-17|16:32:17.401] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536257-1
�[33mWARN �[0m[04-17|16:32:17.401] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536256-9
�[33mWARN �[0m[04-17|16:32:17.401] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536259-1
�[33mWARN �[0m[04-17|16:32:17.401] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536257-0
�[33mWARN �[0m[04-17|16:32:17.401] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536257-2
�[36mDEBUG�[0m[04-17|16:32:17.401] consumer: xdel                           �[36mcid�[0m=8d695235-9869-428b-babe-25afa0008bf2 �[36mmessageId�[0m=1776443536260-0
�[33mWARN �[0m[04-17|16:32:17.412] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536258-18
�[33mWARN �[0m[04-17|16:32:17.412] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536257-5
�[33mWARN �[0m[04-17|16:32:17.412] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536258-6
�[33mWARN �[0m[04-17|16:32:17.413] XClaimJustID returned empty response when indicating heartbeat �[33mmsgID�[0m=1776443536258-16
�[36mDEBUG�[0m[04-17|16:32:17.451] checkResponses                           �[36mresponded�[0m=92 �[36merrored�[0m=0 �[36mchecked�[0m=100
�[36mDEBUG�[0m[04-17|16:32:17.456] redis producer: check responses starting
�[36mDEBUG�[0m[04-17|16:32:17.493] checkResponses                           �[36mresponded�[0m=8  �[36merrored�[0m=0 �[36mchecked�[0m=8
�[36mDEBUG�[0m[04-17|16:32:17.552] Error destroying a stream group          �[36merror�[0m="dial tcp 127.0.0.1:44695: connect: connection refused"
--- FAIL: TestRedisProduceComplex/one_producer,_all_consumers_are_active (1.31s)
TestReorgResequencing
Stack Traces | 4.170s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
    reorg_resequencing_test.go:46: �[31;1m [expected account User1 to have a balance of 1 ether but instead it has 0 wei after empty reorg] �[0;0m
INFO [04-17|16:43:23.302] New Key                                  name=Faucet               Address=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A
INFO [04-17|16:43:23.306] New Key                                  name=RollupOwner          Address=0x57Ff0F473737a1c161bfF9efDF016F7991585088
INFO [04-17|16:43:23.306] New Key                                  name=Sequencer            Address=0xb386a74Dcab67b66F8AC07B4f08365d37495Dd23
INFO [04-17|16:43:23.306] New Key                                  name=Validator            Address=0x83FFCFaCE2Fb0E1286686815503608A16EF41e47
INFO [04-17|16:43:23.306] New Key                                  name=User                 Address=0x7E23C8862920797d81916d62c274dd9217113e28
INFO [04-17|16:43:23.306] Allocated trie memory caches             clean=154.00MiB dirty=256.00MiB
INFO [04-17|16:43:23.306] State schema set to default              scheme=path
INFO [04-17|16:43:23.307] Waiting background transaction indexer to exit
INFO [04-17|16:43:23.307] Writing cached state to disk             block=1   hash=525ac0..7b8279 root=644bc4..7fc062
INFO [04-17|16:43:23.308] Persisted trie from memory database      nodes=23   flushnodes=0 size=3.64KiB   flushsize=0.00B time="271.627µs"  flushtime=0s gcnodes=0 gcsize=0.00B gctime="2.684µs"   livenodes=82   livesize=13.51KiB
INFO [04-17|16:43:23.308] Writing cached state to disk             block=1   hash=525ac0..7b8279 root=644bc4..7fc062
INFO [04-17|16:43:23.308] Persisted trie from memory database      nodes=0    flushnodes=0 size=0.00B     flushsize=0.00B time="1.172µs"    flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s          livenodes=82   livesize=13.51KiB
INFO [04-17|16:43:23.308] Writing snapshot state to disk           root=4ea197..8303c6
INFO [04-17|16:43:23.308] Persisted trie from memory database      nodes=0    flushnodes=0 size=0.00B     flushsize=0.00B time=632ns        flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s          livenodes=82   livesize=13.51KiB
ERROR[04-17|16:43:23.308] Dangling trie nodes after full cleanup
INFO [04-17|16:43:23.308] Blockchain stopped
INFO [04-17|16:43:23.312] Submitted transaction                    hash=0x3ab141ee29961d2714d46e928e2b3590e3d6e5f007a9fe7a701c3d184a7a6922 from=0xb386a74Dcab67b66F8AC07B4f08365d37495Dd23 nonce=100  recipient=0x15105dc809Ca4A94Bb13292eE4144e21C1fb55c8 value=0
ERROR[04-17|16:43:23.317] ExecuteNextMsg failed to get exec engine head message index err="context canceled"
--- FAIL: TestReorgResequencing (4.17s)

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends address-filtering telemetry by adding a FilterSetID to each FilteredAddressRecord, threading it through filtering/touch points, and removing an unused sender parameter from event-based address extraction.

Changes:

  • Update event-filter address extraction to return FilteredAddressWithReason and drop the unused _sender parameter.
  • Extend HashStore.IsRestricted to return (restricted, filterSetID) from a single snapshot and add HashStore.ID().
  • Update address-touch call sites and tests to use FilteredAddressWithReason, and update filtered-tx report JSON expectations to include filterSetId.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
execution/gethexec/sequencer.go Updates event-log filtering touch flow to new AddressesForFiltering signature and TouchAddress argument type.
execution/gethexec/executionengine.go Updates address-touching helpers and event filter application to use FilteredAddressWithReason.
execution/gethexec/eventfilter/eventfilter.go Removes unused sender parameter; returns FilteredAddressWithReason values for matched rules.
execution/gethexec/eventfilter/eventfilter_test.go Adapts tests to updated AddressesForFiltering signature.
execution/gethexec/addressfilter/service_test.go Updates IsRestricted call sites for new (bool, uuid) return.
execution/gethexec/addressfilter/hash_store.go Changes IsRestricted to return filter set ID atomically with the restriction result; adds ID().
execution/gethexec/addressfilter/filter_report_test.go Updates JSON tests to include filterSetId and populates FilterSetID in records.
execution/gethexec/addressfilter/address_checker.go Threads filter set ID into records produced by hashed address checking; changes TouchAddress to take FilteredAddressWithReason.
execution/gethexec/addressfilter/address_checker_test.go Updates checker tests for new touch type and validates recorded FilterSetID.
arbos/tx_processor.go Updates contract/caller touch points to use FilteredAddressWithReason.
changelog/mrogachev-nit-4780.md Adds changelog entry for FilterSetID propagation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 109 to +116
// If the checker is stopped, conservatively mark filtered
if s.checker.Stopped() {
s.report(nil, true)
record := filter.FilteredAddressRecord{
FilterSetID: s.checker.FilterSetID(),
FilteredAddressWithReason: addr,
}
s.report(&record)
s.pending.Done()
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

In the "checker stopped" / "context done" fallback, this now appends a full FilteredAddressRecord even though the address was never checked against the HashStore. Previously this path marked the tx filtered without attributing specific addresses (since the result is unknown). Recording an address+reason here can mislead consumers into thinking the address was definitively restricted, and FilterSetID() may not match the snapshot that would have been used. Consider preserving the old behavior (set filtered=true but do not append a record), or introduce an explicit "unknown/unverified" marker in the record format if you need to surface touched addresses during shutdown.

Copilot uses AI. Check for mistakes.
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 on lines +134 to +139
// report records a filtered address. Must only be called for restricted addresses.
func (s *HashedAddressCheckerState) report(record *filter.FilteredAddressRecord) {
s.mu.Lock()
s.filtered = true
s.filteredAddresses = append(s.filteredAddresses, *record)
s.mu.Unlock()
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The comment on report() says it must only be called for restricted addresses, but TouchAddress() calls report() in shutdown/stopped paths where the address restriction status is unknown. Either adjust the shutdown behavior so report() is only used for confirmed restricted addresses, or update the comment/API to reflect that report() can also record conservative/unknown filtering.

Copilot uses AI. Check for mistakes.
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

@MishkaRogachev MishkaRogachev marked this pull request as ready for review April 13, 2026 14:50
type workItem struct {
record *filter.FilteredAddressRecord
state *HashedAddressCheckerState
addr filter.FilteredAddressWithReason
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.

Suggested change
addr filter.FilteredAddressWithReason
addr *filter.FilteredAddressWithReason

Comment thread execution/gethexec/addressfilter/address_checker_test.go
Comment thread execution/gethexec/addressfilter/address_checker.go Outdated
Comment thread execution/gethexec/addressfilter/hash_store.go Outdated
Comment thread execution/gethexec/addressfilter/service_test.go Outdated
Comment thread execution/gethexec/addressfilter/address_checker.go Outdated
Comment thread execution/gethexec/addressfilter/address_checker.go Outdated
Comment thread execution/gethexec/addressfilter/address_checker.go
diegoximenes
diegoximenes previously approved these changes Apr 15, 2026
@diegoximenes
Copy link
Copy Markdown
Contributor

LGTM, I will keep it assigned to me while the base branch is not merged

Base automatically changed from update-touchaddress-and-hashedaddresscheckerstateisfiltered to master April 16, 2026 15:23
@diegoximenes diegoximenes dismissed their stale review April 16, 2026 15:23

The base branch was changed.

@diegoximenes diegoximenes removed their assignment Apr 17, 2026
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