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

Make the codegen more accessible for running in WASM #1154

Merged
merged 29 commits into from
Sep 20, 2023

Conversation

tadeohepperle
Copy link
Contributor

@tadeohepperle tadeohepperle commented Sep 8, 2023

This PR makes some adjustments in subxt-codegen to make it WASM-compilable.

  • added a fetch_metadata feature flag (enabled by default, when disabled, no jsonrpsee, frame-metadata and tokio are needed as dependencies anymore which makes it easier to compile to WASM)
  • added a utility function value_ty on storage entries, which makes the code more concise in a few places.
  • expose types() function on the RuntimeTypeGenerator to have easier access to the metadata.

@tadeohepperle tadeohepperle marked this pull request as ready for review September 12, 2023 07:45
@tadeohepperle tadeohepperle requested a review from a team as a code owner September 12, 2023 07:45
@@ -395,6 +395,23 @@ pub enum StorageEntryType {
},
}

impl StorageEntryType {
/// returns the type of the value.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit: Could start with uppercase here to be consistent with docs / fn below

@@ -14,7 +14,9 @@ homepage.workspace = true
description = "Command line utilities for checking metadata compatibility between nodes."

[dependencies]
codec = { package = "parity-scale-codec", workspace = true, features = ["derive"] }
codec = { package = "parity-scale-codec", workspace = true, features = [
"derive",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dq: I do like the prior formatting more since I find one-liners easier to follow. Did you find any good formatters for .toml or its just personal preference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I use the Even Better TOML VSCode extension for formatting. Let me revert it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tadeohepperle can you fix this as well?

codegen/Cargo.toml Outdated Show resolved Hide resolved
codegen/src/api/mod.rs Outdated Show resolved Hide resolved
codegen/src/api/storage.rs Outdated Show resolved Hide resolved
dependabot bot and others added 8 commits September 19, 2023 16:46
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.66 to 1.0.67.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](dtolnay/proc-macro2@1.0.66...1.0.67)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.106 to 1.0.107.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@v1.0.106...v1.0.107)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [trybuild](https://github.com/dtolnay/trybuild) from 1.0.84 to 1.0.85.
- [Release notes](https://github.com/dtolnay/trybuild/releases)
- [Commits](dtolnay/trybuild@1.0.84...1.0.85)

---
updated-dependencies:
- dependency-name: trybuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.6.2 to 2.7.0.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](Swatinem/rust-cache@e207df5...a95ba19)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [jsonrpsee](https://github.com/paritytech/jsonrpsee) from 0.20.0 to 0.20.1.
- [Release notes](https://github.com/paritytech/jsonrpsee/releases)
- [Changelog](https://github.com/paritytech/jsonrpsee/blob/v0.20.1/CHANGELOG.md)
- [Commits](paritytech/jsonrpsee@v0.20.0...v0.20.1)

---
updated-dependencies:
- dependency-name: jsonrpsee
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [clap](https://github.com/clap-rs/clap) from 4.4.2 to 4.4.3.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](clap-rs/clap@v4.4.2...v4.4.3)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@tadeohepperle tadeohepperle requested a review from a team as a code owner September 19, 2023 14:48
codegen/Cargo.toml Outdated Show resolved Hide resolved
codegen/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove the getrandom dep entirely now (see comment above) but otherwise looks great!

@tadeohepperle tadeohepperle merged commit 12e3434 into master Sep 20, 2023
9 checks passed
@tadeohepperle tadeohepperle deleted the tadeo-hepperle-example-code-gen branch September 20, 2023 11:16
@jsdw jsdw mentioned this pull request Sep 27, 2023
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

Successfully merging this pull request may close these issues.

4 participants