Menu

Four transactions, eight transfers: an ERC-20 ingestion regression fixture
📰

Four transactions, eight transfers: an ERC-20 ingestion regression fixture

DEV Community: python·BlockVectra·8 days ago
#CtmZvSoW
#devtopython#devto#dev#logs#transaction
Reading 0:00
15s threshold

A transfer table keyed only by transaction hash can lose valid rows while every RPC call succeeds.

Here is a small, real fixture that catches that mistake: eight ERC-20 Transfer logs across four Base transactions . The per-transaction counts are 1, 1, 2 and 4 . Put those logs into a dictionary keyed only by transaction hash and only four rows survive.

Run the check without an RPC key

Download cadd-raw-logs.jsonl from the fixed sample revision . Save the following as verify-sample.py in the same directory and run it with Python 3:

import json from collections import Counter from pathlib import Path

logs = [ json . loads ( line ) for line in Path ( " cadd-raw-logs.jsonl " ). read_text (). splitlines () if line . strip ()]

by_transaction = { log [ " transactionHash " ]. lower (): log for log in logs } event_keys = [( log [ " transactionHash " ].…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.