-
Notifications
You must be signed in to change notification settings - Fork 51
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
client: Is there a way to know when GrandpaWarmSync finished? #1305
Comments
First of all, all non-"system"/"meta" interactions with the client should be done with JSON-RPC functions. When it comes to knowing when the Grandpa warp sync is complete, that's just not possible. It is possible for example for smoldot to connect to a full node that is stuck one block ahead it, sync the chain using this full node, then realize that the rest of the chain is 5000 blocks ahead. When that happens, we need to resume warp syncing. Then maybe later we connect to another node which says that it is 10000 blocks ahead, and we start warp syncing, but realize that the node was malicious and lying, so the warp syncing gets cancelled. Another example is if the chain is very close to where the light client is (which is not an uncommon scenario: if someone refresh the tab where smoldot is running, and a database was saved, it will reload and restart syncing exactly where it was), then a warp sync is unnecessarily expensive and it is possible to simply download the few missing blocks. Basically, it's not possible to simplify this to "the warp syncing is finished".
That's not accurate for the new JSON-RPC API. It is the case for some of the old ones, but that's due to design issues with the old ones. As explained in the JSON-RPC API spec, if you call |
Closing since this is a JSON-RPC specification issue anyway. |
I have a simple light_client_parachains.rs example where 2 chains are added to smoldot, then the subxt submits several requests to smoldot to subscribe to new blocks.
While the Grandpa warp sync is in progress, the RPC requests are stored in a pending queue, and their responses will be provided after the warp sync completes.
Is there a way of knowing from the light-client object perspective when the warp sync is completed? (ie initialization completed)
It may be beneficial to distinguish to end-users between the time spent in initialization and the time it took a request to finish.
From this example, it took roughly 10 seconds to sync and provide a response. However, from paritytech/subxt-explorer#8 perspective where sometimes syncing takes 30+ seconds it might be beneficial to display an initialization state to the end user.
The text was updated successfully, but these errors were encountered: