-
Notifications
You must be signed in to change notification settings - Fork 783
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
[eth-indexer] subscribe to finalize blocks instead of best blocks #7260
Conversation
/cmd prdoc --audience runtime_dev --bump minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense. Otherwise we would probably need to deal with rolling back blocks.
@@ -324,7 +336,7 @@ impl Client { | |||
let client = self.clone(); | |||
spawn_handle.spawn("subscribe-blocks", None, async move { | |||
let res = client | |||
.subscribe_new_blocks(|block| async { | |||
.subscribe_new_blocks(SubscriptionType::BestBlocks, |block| async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we not using finalized here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that for the "in memory" cache maintained by the eth-rpc. In Ethereum you don't wait for the block to be finalized when you call the RPC, so I am not waiting for finalized blocks here. We could decide to wait for the finalized block but that would also impact the user's experience, you will see MM spinning for much longer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay no its fine then. It wasn't apparent from the function names.
…ritytech#7260) For eth-indexer, it's probably safer to use `subscribe_finalized` and index these blocks into the DB rather than `subscribe_best` --------- Co-authored-by: command-bot <>
…ritytech#7260) For eth-indexer, it's probably safer to use `subscribe_finalized` and index these blocks into the DB rather than `subscribe_best` --------- Co-authored-by: command-bot <>
For eth-indexer, it's probably safer to use
subscribe_finalized
and index these blocks into the DB rather thansubscribe_best