Commit Graph

602 Commits

Author SHA1 Message Date
33e4455f92
Fix pruning of canonical block if null block is encountered (#499) 2023-12-28 15:07:12 +05:30
a6deed9c27
Fix block processing during chain reorg (#498)
* Fix block processing during chain reorg

* Add new method in test dummy indexer

* Add missing semicolon
2023-12-28 15:06:47 +05:30
prathamesh0
78e43bc088
Export metrics for watcher config and upstream and external chain heads (#497)
* Add a cli to export chain head block numbers

* Use ETH RPC endpoint and allow env overrides

* Use ethers provider

* Export upstream chain head block number in watcher metrics

* Remove unnecessary exports

* Upgrade package versions

* Fix defaults usage

* Export watcher config in metrics

* Add metric for watcher sync mode

* Remove cache flag from watcher config metrics

* Update watcher config field names
2023-12-19 15:23:25 +05:30
prathamesh0
37732d1b1e
Upgrade package versions (#496) 2023-12-05 18:27:09 +05:30
prathamesh0
304b116c6d
Add a CLI for running a proxy server (#495) 2023-12-05 18:17:27 +05:30
ceb0a3de23
Add CLI tool to compare watcher GQL responses (#494)
* Integrate gql response compare tool

* Add README for compare-gql tool

* Update readme

* Update CLI output logs

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2023-11-28 09:51:26 +05:30
dab2d6d3e7
Publish events for GQL subscription in historical processing (#492)
* Add realtime block complete event

* Use realtime block complete event for realtime processing

* Refactor realtimeBlockComplete event interface
2023-11-27 14:13:02 +05:30
220f3ddf24
Fix events processing error check in historical processing (#491)
* Fix events queue error check in historical processing

* Upgrade package version
2023-11-26 12:42:43 +05:30
3fa3cc7068
Upgrade package versions to 0.2.76 (#490) 2023-11-24 12:04:11 +05:30
9ee423f38e
Fix update in sync status (#489) 2023-11-24 11:54:45 +05:30
6decf61d4c
Update subgraph watcher demo readme (#480)
* Update subgraph watcher demo readme

* Pass extra block data required in subgraph block handler (#486)

* Use codegen config directory name instead of file path

* Get block data from extra event data

* Add extra event data in processBlockAfterEvents

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>

* Update example subgraph mapping code for graph-cli upgrade

* Return 0 value for block size in ipld-eth-client

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2023-11-24 11:13:40 +05:30
937aed139f
Fix sync status update in historical processing job (#488)
* Fill watcher start block only in active mode

* Fix sync status update in historical processing

* Upgrade package versions

* Upgrade package versions in codegen template

* Fix graph-node test indexer
2023-11-23 20:25:39 +05:30
prathamesh0
ffd1d267d8
Implement remaining json host APIs (#487)
* Instantiate a new wasm string to convert JSON value to BigInt

* Implement remaining json host APIs

* Upgrade graph-ts and graph-cli in test example subgraph

* Handle null context for dataSource context host API

* Use JSONBig for parsing JSON strings
2023-11-22 18:03:21 +05:30
729d862aac
Fix fetching blocks near chain head in job-runner (#485)
* Fix null blocks check in job-runner when fetching near chain head

* Upgrade package versions
2023-11-21 17:44:54 +05:30
prathamesh0
e6b957e921
Mark entities as removed on store remove host API call (#484) 2023-11-21 16:00:26 +05:30
8c44fbbe6d
Add gqlPath in config for GQL server URL (#483) 2023-11-21 15:21:10 +05:30
4a88ff76e0
Remove check for blocks count in eventsInRange query and check sync status instead (#482)
* Add check for from and to block in eventsInRange query

* Update sync status query for more fields

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2023-11-21 14:14:36 +05:30
prathamesh0
d0aca37a74
Skip meta query generation for non-subgraph watchers (#481)
* Skip generating meta query if non subgraph watcher

* Fix linting errors in generated watcher

* Add space for meta query

* Add meta query types after adding block height type

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2023-11-21 11:44:30 +05:30
7b19d383ec
Run block fill for watcher automatically (#479)
* Find minimum start block number

* Perform fill if db is empty

* Make getStartBlock method public in GraphWatcher

* Use dataSources property

* Update server template to fill block on start

* Avoid passing graphWatcher from generated watcher

* Ensure block filling for non-subgraph watchers as well

* Remove getStartBlock method from GraphWatcher

* Remove graphWatcher property from ServerCmd

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2023-11-20 17:13:49 +05:30
07c0827a2a
Automate steps in codegen to build subgraph (#478)
* Use shelljs to run graph-cli codegen command

* Replace graph-cli and graph-ts with cerc-io forks

* Add steps to build subgraph

* Add config packageManager for different subgraph repo setup

* Copy over the subgraph build to generated watcher

* Remove TODO

* Change subgraph path in generated watcher config
2023-11-20 17:09:51 +05:30
prathamesh0
2faf905d99
Implement remaining graph-node host APIs for templates (#475)
* Implement createWithContext graph-node dataSource host API

* Parse individual context entries

* Implement graph-node dataSource context host API

* Handle array type fields and refactor code

* Resolve all values when parsing an array field

* Fix wasm entity creation with array type fields

* Required codegen changes
2023-11-20 15:02:08 +05:30
c2070a80cb
Handle null block error in rpc-eth-client (#477)
* Remove block-size-cache util methods as full block with size fetched already

* Handle null block error in rpc-eth-client

* Upgrade package versions
2023-11-17 11:58:43 +05:30
e54f4c9276
Implement host API for big decimal equals (#476)
* Implement host api for big decimal equals

* Add test cases for big decimal equals

* Use boolean type conversion

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2023-11-17 10:26:03 +05:30
7c8f84b1dc
Remove prefetchBlocksInMem flag along with functionality (#474)
* Remove prefetchBlocksInMem flag

* Remove Indexer method fetchEventsAndSaveBlocks

* Throw error if pruning not safe

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2023-11-16 19:03:13 +05:30
3e898914ba
Add GQL where filter and nested order by params based on entity fields (#472)
* Add where filter equals fields based on entity fields

* Add different where filter operations for entity fields

* Add nested where filter for relation fields and filter params or & and

* Remove filters not required for derived fields

* Add nested order by params in schema

* Throw error on trying to sort by array or derived type fields

* Handle array fields while generating order by and where clauses

* Upgrade package versions

---------

Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2023-11-16 12:38:47 +05:30
5b95335fde
Filter logs by events specified in subgraph config (#473)
* Use topic hash of events from config file

* Add eventSignaturesMap field in IndexerInterface

* Add eventSignaturesMap property in Indexer class

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2023-11-16 11:54:49 +05:30
8e9d5092fc
Fix generated watcher GQL query name and add _change_block filter (#471)
* Add lower case method for camel case entity names

* Add BlockChangedFilter required in where filter

* Use lower camel case in resolvers and fix lower case transformation
2023-11-15 10:14:14 +05:30
7c4f9fb797
Fix events queue job retry by resetting watcher in job-runner (#470)
* Reset watcher after events job retry in job-runner

* Push next historical job from job-runner instead of event-watcher
2023-11-14 18:43:17 +05:30
6ce8d4746d
Upgrade package versions before release (#469) 2023-11-14 15:01:52 +05:30
803f7c3b3d
Fix retry on error for events processing job with exponential backoff (#468)
* Throw error in job-runner events processing queue for retry

* Restart block processing after completion of retried events queue job

* Check events queue size in retry state from active historical processing job

* Clear watched contracts from memory map on reset

* Update sync status with zero hash during historical processing

* Update codegen for changes

* Add clearProcessedBlockData in graph-node test dummy indexer
2023-11-14 14:53:23 +05:30
7b5fbf3d13
Implement new graph-node host API for BigDecimal exponentiation (#467)
* Implement host API for BigDecimal pow

* Handle FEVM future block error in rpc-eth-client getFullBlocks

* Handle future block error in rpc-eth-client getBlockWithTransactions

* Upgrade package versions
2023-11-13 12:22:23 +05:30
66d613767e
Upgrade version to 0.2.69 (#466) 2023-11-10 19:36:21 +05:30
c01c1d07db
Fix switch from historical to realtime processing when template create block exists near head (#465)
* Fix duplicate historical processing jobs created on template create

* Fix switch from historical to realtime processing when template create block is near head
2023-11-10 19:13:17 +05:30
prathamesh0
be24166ea7
Update package versions (#463) 2023-11-10 14:48:35 +05:30
edf72c1dd6
Update indexer template in codegen for block optimization changes (#464)
* Update indexer template for block optimization

* Trim address strings in graph-node host API
2023-11-10 12:14:38 +05:30
prathamesh0
32d5cd10d0
Prioritize block hash over number in singular time travel queries (#462)
* Keep return value for singular subgraph entity queries nullable

* Prioritize block hash over number in time travel queries

* Throw error when block with given hash doesn't exist in db
2023-11-10 09:39:58 +05:30
695723955f
Prefetch block and txs in historical processing instead of fetching them in events processing (#460)
* Set gzip true in ethersjs provider

* Add timer logs and use StaticJsonRpcProvider

* Fetch block data in historical processing and cache in map

* Fetch txs required for event logs in historical processing

* Process events with prefetched block and txs data in realtime processing

* Clear old TODOs
2023-11-09 18:42:37 +05:30
prathamesh0
c7bcd4c276
Generate resolvers for plural subgraph GQL queries (#461) 2023-11-09 16:33:35 +05:30
prathamesh0
6860f1a26f
Handle tsvector type columns when forming the db query (#459)
* Support full text search queries

* Handle text search for all query types
2023-11-09 14:15:31 +05:30
prathamesh0
483a73fc3e
Load schema file path from subgraph config (#458)
* Get subgraph schema from config file

* Use default value if schema not given

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2023-11-09 12:17:09 +05:30
5aa98326cb
Send transaction data directly in rpc-eth-client instead of serialization (#457)
* Fix tx serialization using ethers v6

* Send tx data directly in rpc-eth-client instead of serializing it
2023-11-08 17:32:26 +05:30
f2c5f67777
Handle restarts during historical processing in watcher (#455)
* Reset to latest processed block on restarting job-runner

* Update sync status during historical processing in job-runner

* Codegen changes

* Use sync status latest processed block for subgraph _meta GQL query

* Set job per interval for subscribing events queue to 1

* Fix events processing skipped for blocks after template create
2023-11-08 14:28:53 +05:30
prathamesh0
97bd4014d6
Support nested entity sorting in plural GQL queries (#456)
* Move method to apply block filter to base database

* Handle nested entity sorting

* Handle nested entity sorting for distinct on type queries

* Handle nested entity sorting for all query types
2023-11-08 12:20:32 +05:30
prathamesh0
5efab298a3
Add support for meta query in watcher GQL API (#453)
* Add a method to get meta data for watcher indexing status

* Add a flag indicating indexing error to sync status

* Codegen changes

* Clear indexing error on job-runner startup

* Fix lint errors
2023-11-07 14:37:05 +05:30
8547876764
Add isFEVM flag in config to avoid filtering event logs by topics (#454)
* Pass upstream config to indexer instance

* Add isFEVM flag and refactor watcher config fields

* Codegen changes for indexer

* Add missing getter in dummy indexer for graph-node tests
2023-11-07 12:07:49 +05:30
dd92b4feb2
Fix bigint and decimal transformers not added for null type entity field in codegen (#451) 2023-11-06 15:01:48 +05:30
prathamesh0
d5c92aa150
Add BigInt and BigDecimal GraphQL scalars (#452) 2023-11-06 15:00:24 +05:30
8a720ef175
Wait for events processing to complete before continuing historical blocks processing (#450)
* Wait for events queue to be empty before continuing historical processing

* Make historicalLogsBlockRange and historicalMaxFetchAhead configurable

* Perform single RPC request for multiple addresses
2023-11-06 11:34:48 +05:30
prathamesh0
546af92638
Support logical filter operations in plural GQL queries (#449)
* Handle logical operators in where input

* Handle logical filter operators while building the database query

* Refactor code to build where clause for database query
2023-11-06 11:17:54 +05:30
0d7e3ddc8b
Handle subgraph template create when filterLogsByAddresses set to true (#447)
* Handle subgraph template create when filterLogsByAddresses set to true

* Fix historical processing stopping after running for multiple batches

* Add new method in graph-node test dummy indexer
2023-11-03 14:08:55 +05:30