Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Substreams Block Filtering to substreams.yaml and protobuf #410

Closed
3 tasks done
sduchesneau opened this issue Mar 1, 2024 · 1 comment
Closed
3 tasks done
Assignees

Comments

@sduchesneau
Copy link
Contributor

sduchesneau commented Mar 1, 2024

  • Add the following substreams.yaml schema:
  1. A new module type, blockIndex that will be used to create the index used by the filter (extracting labels from transactions, etc.) (this type will have a special handler)
modules:
- name: my_cool_index
  type: blockIndex
  output:
    type: proto:sf.substreams.index.v1.Keys

A module of this type does not have params in its input, initialBlock. The output type is forced to be sf.substreams.index.1.Keys (we can still move this around if need be, but it's a core construct of the engine, it could also be renamed Labels as @sduchesneau put it.).

message Keys {
  repeated string keys = 1;
}
  1. A new block inside module definitions, called blockFilter, which contains module (the reference to a blockIndex type of module) and query (a string that will be used to evaluate the blocks against the filter, see Specify and implement/choose a language parser for substreams Block Filtering #409)
modules:
- name: my_cool_map
  blockFilter:
    module: eth_sieve:contracts_and_events
    query: (addr:USDC || addr:PANCAKE) && (evsig:Transfer || evsig:TransferFrom)
  1. A new top-level attribute, called blockFilters, which allows an override for "params":
blockFilters:
  myModuleName: (addr:123123 || addr:234234) && (evsig:123123 || evsig:0x345)

(this will be done client-side)

  • Add the necessary fields in the Protobuf definition of the sf.substreams.v1.Module:
  • new module kind in the kind enum
  • new field "block_filter", of a new type of message "BlockFilter", which contains the module and query strings.
  • Implement the transformation from substreams.yaml to that protobuf definition, including the replacement of blockFilters within modules.
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

No branches or pull requests

3 participants