Skip to content

Instantly share code, notes, and snippets.

View Dargon789's full-sized avatar
☘️
Study, learn, experiment, test, develop, keep trying. อีสานเปิดโลก เว็บ3

AU_gdev_19 Dargon789

☘️
Study, learn, experiment, test, develop, keep trying. อีสานเปิดโลก เว็บ3
View GitHub Profile

Log index search implementation overview

The purpose of the log index search mechanism is to return a set of logs that might potentially match a given pattern. The main search function GetPotentialMatches receives the following parameters:

  • block range
  • a set of addresses one of which has to match the log address (an empty set is interpreted as a wild card)
  • a set of topics for each of at most 4 topic positions, one of which has to match the topic at the given position (an empty set is interpreted as a wild card)

GetPotentialMatches constructs a pattern matcher based on the given addresses and topics and translates the block range into log value index range. Then it runs the pattern matcher on the filter maps covering the searched range, running multiple workers in parallel, each processing one epoch at a time. After evaluating the matcher it looks up the actual logs at the resulting potentially matching log value indices. Parallel worker results are collected and returned in chronological order.