Ensuring chronological execution of hooks and checkpointing (#264)

* Subscribe to hooks queue in existing watchers

* Change naming strategy for generated get and save functions

* Push checkpointing job after post-block hook job completed

* Using hooks status to ensure their chronological execution

* Add default indices to IPLDBlock table

* Add kind parameter to getState GQL API

* Add checkpoint CLI

* Add blockHash arg to checkpoint CLI and update codegen docs

* Print out block hash for checkpoint CLI

* Use log from debug for logging

* Filter using contract at start in hierarchical query

* Make kind argument to prepare IPLDBlock required
This commit is contained in:
prathamesh0
2021-12-28 16:08:04 +05:30
committed by nabarun
parent 51b200709b
commit 421e7498d3
28 changed files with 425 additions and 122 deletions
+11 -1
View File
@@ -73,6 +73,8 @@
* Create the databases configured in `environments/local.toml`.
* Update the derived state checkpoint settings in `environments/local.toml`.
### Customize
* Indexing on an event:
@@ -81,6 +83,8 @@
* Edit the custom hook function `handleBlock` (triggered on a block) in `src/hooks.ts` to save `IPLDBlock`s using the `Indexer` object.
* Edit the custom hook function `genesisHook` (triggered on watch-contract) in `src/hooks.ts` to save a genesis checkpoint `IPLDBlock` using the `Indexer` object.
* The existing example hooks in `src/hooks.ts` are for an `ERC20` contract.
### Run
@@ -114,7 +118,13 @@
* To fill a block range:
```bash
yarn fill --startBlock <from-block> --endBlock <to-block>
yarn fill --start-block <from-block> --end-block <to-block>
```
* To create a checkpoint for a contract:
```bash
yarn checkpoint --address <contract-address> --block-hash [block-hash]
```
## Known Issues