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

Implement scale_type_resolver::TypeResolver trait #221

Open
jsdw opened this issue Feb 26, 2025 · 0 comments
Open

Implement scale_type_resolver::TypeResolver trait #221

jsdw opened this issue Feb 26, 2025 · 0 comments

Comments

@jsdw
Copy link
Contributor

jsdw commented Feb 26, 2025

The library scale-type-resolver exists and defines a TypeResolver trait that can be imeplemented by anything capable of resolving some "id" to SCALE type information.

This library is used throughout the Rust crates (scale-encode, scale-decode, scale-value etc) such that they are all generic over how type information is provided, rather than depending explicitly on scale-info. One reason to be generic like this is that we want all crates requiring type information to be able to accept either scale-info (for V14+ types) or scale-info-legacy (for pre-V14 types) as a provider of this information.

Currently, scale-type-resolver has a feature flag to depend on scale-info and implement the trait for it. In other words, right now we have this:

Image

I'd like to swap this around and have scale-info depend on scale-type-resolver and implement it. This way, all updates to scale-info implement scale_type_resolver::TypeResolver and are usable in conjunction with the other Rust crates which rely on it without them needing to be updated. In other words, I want us to have this:

Image

Steps to achieve this:

  1. Publish scale-type-resolver 1.0.0 to signify that it is stable and provides the necessary type information (this has been battle tested with our modern and historic decoding crates). In this release, remove the import of scale-info and implementation of it.
  2. Have scale-info import scale-type-resolver and implement it (ie move the impl to scale-info). Put it behind a scale-type-resolver feature flag to make this optional.
  3. New minor release of scale-info to publish this change.
  4. Update rust crates to depend on scale-type-resolver 1.0.0 and pull in the appropriate version of scale-info where needed (ie in Subxt).
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

No branches or pull requests

1 participant