Skip to content

Commit 4cf37a7

Browse files
committed
feat: Add conditional indexing to filter Safes by initiator/recipient address (#2703)
Implement selective Safe indexing on L2 networks to reduce database size and improve indexing speed by filtering out Safes created by specific initiators. Changes: - Add ETH_EVENTS_IGNORED_INITIATORS setting to define blocklisted initiators - Add ETH_EVENTS_IGNORED_TO setting to define blocklisted recipients - Override process_elements in SafeEventsIndexer to filter by tx._from or tx.to before storing EthereumTx records - Optimize RPC calls: fetch transactions first, filter, then fetch receipts only for allowed transactions - Add comprehensive tests for conditional indexing Closes #2703
1 parent a4428ab commit 4cf37a7

File tree

4 files changed

+707
-9
lines changed

4 files changed

+707
-9
lines changed

config/settings/base.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,15 @@
609609
ETH_ERC20_LOAD_ADDRESSES_CHUNK_SIZE = env.int(
610610
"ETH_ERC20_LOAD_ADDRESSES_CHUNK_SIZE", default=500_000
611611
) # Load Safe addresses for the ERC20 indexer with a database iterator with the defined `chunk_size`
612+
ETH_EVENTS_IGNORED_INITIATORS: set[ChecksumAddress] = {
613+
ChecksumAddress(HexAddress(HexStr(address)))
614+
for address in env.list("ETH_EVENTS_IGNORED_INITIATORS", default=[])
615+
} # Initiator addresses whose created Safes should be ignored during L2 indexing
616+
ETH_EVENTS_IGNORED_TO: set[ChecksumAddress] = {
617+
ChecksumAddress(HexAddress(HexStr(address)))
618+
for address in env.list("ETH_EVENTS_IGNORED_TO", default=[])
619+
} # Transaction 'to' addresses to ignore during L2 indexing
620+
612621

613622
# ENABLE/DISABLE COLLECTIBLES DOWNLOAD METADATA, enable=True, disabled by default
614623
COLLECTIBLES_ENABLE_DOWNLOAD_METADATA = env.bool(

0 commit comments

Comments
 (0)