auradefi 0.1.2
PyPI GitHub

scan_logs

auradefi.sources.evm.logs · source

Typed logs for the INCLUSIVE range, scanned one chunk at a time.

Each chunk is one eth_getLogs through eth_get_logs, carrying a filter object built here:

address=None and topics=() omit their key. An empty SEQUENCE is a different argument, goes out as written, and WIDENS the query instead of emptying it: address=[] sends "address": [], which a node reads as no address filter at all, and topics=([],) sends "topics": [[]], whose empty rule set go-ethereum treats as the wildcard null means, so an empty OR slot and a None slot are one query once decoded. Either spelling scans every log in the range, and rewriting one to an omitted key would hide the caller's mistake behind a request that means the same thing.

Returns: The rows of every chunk, concatenated in received order. An empty chunk contributes nothing and does not end the scan.

Raises: ValidationError: before any HTTP, on from_block > to_block, a negative from_block, chunk_blocks <= 0, a topic entry that is not a str, a str list or tuple, or None, and an address that is not a 0x-prefixed 40-hex string. A wrong TYPE for any of the three block arguments is refused here too. Each guard below is a comparison against an int literal, so a str or None would otherwise pass straight through the promise it is named in and die at hex() with a builtin's message. SourceError: on a row that is not an object, a missing or non-hex blockNumber or logIndex, a topics that is not a list, a topic that is not a 66-character 0x hex string, a non-hex data, and a missing address or transactionHash.

Parameters

rpcrequired, EvmRpc

The node to ask.

from_blockrequired, int

First block of the INCLUSIVE range.

to_blockrequired, int

Last block of the inclusive range.

addressoptional, str | Sequence[str] | None, default None

One address, several, or None for no address filter.

topicsoptional, Sequence[object], default ()

Topic slots: a string, a list for an OR, None for a wildcard. Empty omits the key.

chunk_blocksoptional, int, default 2000

Blocks per eth_getLogs. Nodes cap the range, and this is how you stay under the cap.

Raises

SourceError, ValidationError

Returns

list[LogRecord]