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

Unfinalized cache #131

Merged
merged 6 commits into from
Nov 19, 2021
Merged

Unfinalized cache #131

merged 6 commits into from
Nov 19, 2021

Conversation

shunjizhan
Copy link
Collaborator

@shunjizhan shunjizhan commented Nov 19, 2021

Change

  • added a UnfinalizedCache which indexes txHashes from unfinalized blocks. It listens to new heads and keep adding/deleting these txHashes. When we call getXXXByTxhash, it will first search for this txHash in cache, if it exist, then it will fetch tx details. We don't need to index all these tx details at first to improve performance.

Test

  • unit tested this class
  • hello world is still able to deploy
  • prev tests all passed locally
  • no integration test since it's hard to reproduce testing environment locally, so I manually tested it by setting up a local node that doesn't produce finalized block (thanks for @zjb0807 's suggestion), so no tx is indexed in subql, and getXXXByTxhash still works (all fetched from cache).

TODO

need more integration test in production env where it produces finalized block dynamically. (probably do this after we have a public testnet)

@shunjizhan shunjizhan marked this pull request as ready for review November 19, 2021 03:37
@shunjizhan shunjizhan merged commit c1962af into master Nov 19, 2021
@shunjizhan shunjizhan deleted the unfinalized-cache branch November 19, 2021 05:21
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

Successfully merging this pull request may close these issues.

None yet

2 participants