paritytech/subxt

Stabilise the `UnstableBackend`

Closed this issue · 0 comments

jsdw commented

Nowadays, Substrate nodes support the chainHead_v1 RPCs which Subxt's UnstableBackend relies on. Smoldot would need upgrading to 0.18 to support them, which has its own issues (eg #1749), but the lightclient feature is still unstable.

To stabilise the UnstableBackend we should:

  1. Rename it to something like ChainHeadBackend
  2. Add something like ChainHeadBackendBuilder::build_with_background_driver() which uses tokio or the WASM equivalent to spawn the background task which drives the driver.
  3. Use this method instead of building a LegacyBackend in OnlineClient::from_insecure_url etc.
  4. Think about how errors are propagated to the user if this background task is hidden away. Currently, errors are emitted there only. We may need to tweak the FollowStreamDriver etc to pass errors on to the current subscriptions too, so they make it out to users where appropriate.
  5. Update Smoldot to 0.18 (if not already done) so that the light client feature will work with a default Subxt client, now that the default relies on chainHead_v1 APIs which we need 0.18 for.

All of the above should work both in WASM and native builds by default. This being true, we wouldn't need an additional feature flag or whatever I believe.