paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.com/
1.89k stars 696 forks source link

Expose types from `sc-service` #5855

Open RomarQ opened 1 month ago

RomarQ commented 1 month ago

Description

At moonbeam we have worked on a lazy-loading feature which is a client mode that forks a live parachain and fetches its state on-demand, we have been able to do this by duplicating some code from sc_service::client. The objective of this PR is to simplify the implementation by making public some types in polkadot-sdk.

In my opinion the advantages of making these types public is greater than keeping them as internals, since it gives more flexibility to devs when building their parachain clients.

Integration

Not applicable, the PR just makes some types public.

Review Notes

The changes included in this PR give more flexibility for client developers by exposing important types.

bkchr commented 1 month ago
  • sc_service::client I do not see a point to only expose this type when test-helpers feature is enabled

This feature should not exist at all...

Could you give some more details on how you implemented this? I mean why do you need to expose these types at all? I would say that you only need to write some Backend that fetches the values on demand (for sure it would not be async and whatever, but we don't support this any way right now).

RomarQ commented 1 month ago
  • sc_service::client I do not see a point to only expose this type when test-helpers feature is enabled

This feature should not exist at all...

Could you give some more details on how you implemented this? I mean why do you need to expose these types at all? I would say that you only need to write some Backend that fetches the values on demand (for sure it would not be async and whatever, but we don't support this any way right now).

We had to change the CallExecutor because of some validation in contextual_call, but there was no way to pass it to a Client instance without the use of test-helpers feature.

bkchr commented 1 month ago

` because of some validation incontextual_call`

Which validation? Could you be more specific?