Commit Graph

60 Commits

Author SHA1 Message Date
Niklas Adolfsson 793da7e29d disable cargo doc for subxt-cli (#1486)
* rename subxt to subxt-cli

* disable doc for subxt-cli
2024-03-18 14:41:58 +00:00
Tadeo Hepperle 4408a8c587 CLI: Return error on wrongly specified type paths (#1397)
* add user errors and test cases

* Update cli/src/commands/codegen.rs

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

---------

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2024-01-26 12:27:15 +01:00
Tadeo Hepperle 05ced83f74 CLI Tool Explore Command: Runtime APIs, Events, Colorized outputs, scale-typegen integration (#1290)
* restructure cli commands

* config: Add `SkipCheckIfFeeless` signed extension (#1264)

* config: Add `SkipCheckIfFeeless` signed extension

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* config: Add extra extension to the default params

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Adjust signed extension example

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* config: Extend SkipCheckIfFeeless with inner signed extension

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* config: Configure SkipCheck with inner signed extension params

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* config: Implement Deafult for SkipCheckIfFeelessParams with Option

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Fix example with proper extension

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* config: Extend <T as Config>::AssetId with EncodeAsType and Clone

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* config: Add SkipCheck with AssetTx

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* config: Encode as type from metadata the inner signed extensions

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust examples

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Use `SkipCheckIfFeeless` for decoding the tip of extensions

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* config: Decode `SkipCheckIfFeeless` with `Self`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Adjust testing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* config: Descriptive errors for building `SkipCheckIfFeeless`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* config: Add docs for extra error types

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Add extra derives to signed extensions

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* config: Use `Default::default` to simplify type init

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Replace removed lint (#1270)

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Add support for multi-chain usecase (#1238)

* lightclient: Make `smoldot::chainID` part of the RPC requests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Make `BackgroundTask` generic over `PlatformRef` and chain

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Construct from raw smoldot and target different chains

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Update cargo lock for wasm tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Reuse `new_from_client` method and removed unused imports

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Reexport smoldot client and RPC objects used in pub
interface

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Adjust `new_from_client` interface

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Extend background to poll over multiple RPC objects

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Build light client from raw and target different chains

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* artifacts: Add demo chain specs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* artifacts: Move artifacts to dedicated folder

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Use SelectAll to drive all streams

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Fetch initial data from the target chain

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Reexport other smoldot objects

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Target chain with potentially different config

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt/rpc: Log chainID for debugging

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt/examples: Add smoldot client with parachain example

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Propagate chain ID together with rpc responses object

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Multiplex responses by request ID and chain ID

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Add raw light client builder

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Add cargo feature flag for parachains example

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Derive default for internal structure

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Guard reexports by std feature flag

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update subxt/src/client/light_client/mod.rs

Co-authored-by: James Wilson <james@jsdw.me>

* lightclient: Update the builder pattern and chain targetting

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Fix documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Provide more insightful docs wrt native/wasm panics

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Adjust comment location

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Refactor UniqueChainId into the background task

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update lightclient/src/background.rs

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Update subxt/src/client/light_client/builder.rs

Co-authored-by: James Wilson <james@jsdw.me>

* lightclient: Update docs wrt panics

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Update docs wrt to smoldot instance -> client

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Use IntoIter instead of Iterator

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Adjsut docs wrt [`Self::new_from_client`]

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Remove RawRpc from LightClient in favor of chainID

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Reexport everything under smoldot module

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* artifacts: Use stateRootHash instead of genesis.raw

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Bump futures from 0.3.28 to 0.3.29 (#1272)

Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.28 to 0.3.29.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.28...0.3.29)

---
updated-dependencies:
- dependency-name: futures
  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>

* Bump zeroize from 1.6.0 to 1.7.0 (#1274)

Bumps [zeroize](https://github.com/RustCrypto/utils) from 1.6.0 to 1.7.0.
- [Commits](https://github.com/RustCrypto/utils/commits)

---
updated-dependencies:
- dependency-name: zeroize
  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>

* Bump tracing-subscriber from 0.3.17 to 0.3.18 (#1275)

Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.3.17 to 0.3.18.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.3.17...tracing-subscriber-0.3.18)

---
updated-dependencies:
- dependency-name: tracing-subscriber
  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>

* Bump tracing-subscriber from 0.3.17 to 0.3.18 (#1275)

Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.3.17 to 0.3.18.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.3.17...tracing-subscriber-0.3.18)

---
updated-dependencies:
- dependency-name: tracing-subscriber
  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>

* Bump getrandom from 0.2.10 to 0.2.11 (#1273)

Bumps [getrandom](https://github.com/rust-random/getrandom) from 0.2.10 to 0.2.11.
- [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/getrandom/compare/v0.2.10...v0.2.11)

---
updated-dependencies:
- dependency-name: getrandom
  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>

* impl RpcClientT for Arc<T> and Box<T> (#1277)

* impl RpcClientT for Arc<WsClient>

* fix grumbles: impl for Box<T> and Arc<T>

* grumbles: move RpcClientT impls

* first iteration of using scale_typegen

* introduce indoc for formatting

* calls, constants and home are cleaner now

* added event subcommand

* show runtime apis working

* add better code formatting

* fix style

* adjust tests, use owo_colorize to not add extra dependency

* fmt

* adjust docs

* move scale-typegen-description dependency to workspace

* improve `substrate-compat` (#1265)

* improve `substrate-compat`

* From => Into

---------

Co-authored-by: James Wilson <james@jsdw.me>

* Bump proc-macro2 from 1.0.69 to 1.0.70 (#1292)

Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.69 to 1.0.70.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.69...1.0.70)

---
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>

* Bump serde from 1.0.192 to 1.0.193 (#1291)

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.192 to 1.0.193.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.192...v1.0.193)

---
updated-dependencies:
- dependency-name: serde
  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>

* lightclient: Fix wasm socket closure called after being dropped (#1289)

* lightclient: Close wasm socket while dropping from connecting state

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Construct one time only closures

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Enable console logs for lightclient WASM testing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Separate wakes and check connectivity on poll_read

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Close the socket depending on internal state

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Revert "lightclient: Separate wakes and check connectivity on poll_read"

This reverts commit 866094001d4c0b119a80ed681a74b323f74eae1b.

* lightclient: Return pending if socket is opening from poll_read

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Close the socket on `poll_close`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Reset closures on Drop to avoid recursive invokation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Close the socket if not already closing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* workflows: Install rustup component for building substrate (#1295)

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Command to fetch chainSpec and optimise its size (#1278)

* cli: Add chainSpec command

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli/chainSpec: Move to dedicated module

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Compute the state root hash

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Remove code substitutes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* artifacts: Update polkadot.json

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* scripts: Generate the chain spec

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Remove testing artifacts

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Apply rustfmt

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Introduce feature flag for smoldot dependency

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Rename chain-spec to chain-spec-pruning

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* scripts: Update chain-spec command

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* update to new scale-typegen interfaces

* use released version of scale-typegen

* Merge branch 'master' into tadeohepperle/cli-support-runtime-apis

* remove unused debug file

* resolve merge errors

* adjustments

* constants file adjustment

* method renaming

* fix issue with encoding runtime api params

* Add logging to submit_transaction and unstable driver, and ensure unpin evs complete

* panic if None returned from subscription too, also with stats

* change panic to Err just to be on the safe side

* clippy

* make long tests run only after clippy + fmt pass

* megre in light client test change pr

* chore(subxt/src): typo fix (#1370)

* rpcmethods

* followstr

* mod and else

* Weekly Cronjob fetching artifacts and generating polkadot.rs file. (#1352)

* github CI action cronjob

* add commit message

* fix the CI yml files

* binary crate for CI script with substrate-runner

* update the CI script

* correct the artifacts script

* remove bash script

* lightclient(fix): Ensure lightclient chainSpec is at least one block old (#1372)

* testing(fix): Ensure lightclient chainSpec is at least one block old

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Revert "testing(fix): Ensure lightclient chainSpec is at least one block old"

This reverts commit 0eafcb2ca59d1f1cd2cef86b770f5a0401cce59f.

* lightclient(fix): Ensure lightclient chainSpec is at least one block old

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Link smoldot issue

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Use tokio under lightclient feature flag

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Do not sleep on errors to fetch the chainSpec

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* artifacts: Remove test file

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Subscribe to two finalized blocks

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Revert cargo toml

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Reduce the light client timeout to 15 minutes (#1373)

* ci: Reduce the light client timpeut to 15 seconds

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Use ubuntu-latest for light-client tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* actually only wait for machete+fmt, clippy can be much slower

* update CI file from Alex PR

* resolve clippy err

* Try a few RPC nodes in case one of them is not working

* fix submit_transaction debug logging of message

* Improve Signed Extension and Block Decoding Examples/Book (#1357)

* asset hub example and book adjustment

* formatting

* recursive derives

* polkadot monitor example and book adjustments

* formatting

* adjust docs and examples, add dynamic example

* james suggestions

* fmt

* chore(subxt/src): typo fix (#1370)

* rpcmethods

* followstr

* mod and else

* Weekly Cronjob fetching artifacts and generating polkadot.rs file. (#1352)

* github CI action cronjob

* add commit message

* fix the CI yml files

* binary crate for CI script with substrate-runner

* update the CI script

* correct the artifacts script

* remove bash script

---------

Co-authored-by: James Wilson <james@jsdw.me>
Co-authored-by: Pan chao <152830401+Pan-chao@users.noreply.github.com>

* fix formatting of returned sections

* make storage use execute flag as well

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
Co-authored-by: James Wilson <james@jsdw.me>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: yjh <yjh465402634@gmail.com>
Co-authored-by: Pan chao <152830401+Pan-chao@users.noreply.github.com>
2024-01-19 17:57:16 +01:00
Alexandru Vasile 14b71279ba cargo: Switch to workspace lints (#1299)
* subxt: Remove unstable lints that cause compile warnings

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cargo: Switch to workspace lints

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cargo: Fix codec package at root level

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cargo: Move profiles to the root level

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Fix lightclient and metadata crates

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Revert "cargo: Fix codec package at root level"

This reverts commit cdf9e1628d708a972673eb3a9e967b6896edbd73.

* Fix complexity clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cargo: Remove lints to be replaced by `cargo machete`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cargo: Remove unused dependencies (detected by machete)

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Add machete step

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cargo: Bump rust version

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Rename machete step

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Rename cargo machete step

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2023-12-04 13:07:23 +02:00
Alexandru Vasile 06cfb211a9 cli: Command to fetch chainSpec and optimise its size (#1278)
* cli: Add chainSpec command

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli/chainSpec: Move to dedicated module

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Compute the state root hash

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Remove code substitutes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* artifacts: Update polkadot.json

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* scripts: Generate the chain spec

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Remove testing artifacts

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Apply rustfmt

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Introduce feature flag for smoldot dependency

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Rename chain-spec to chain-spec-pruning

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* scripts: Update chain-spec command

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2023-11-29 14:38:19 +02:00
James Wilson 2b21f8dc8c Tidy subxt-codegen crate interface (#1225)
* first pass tidying codegen crate interface

* fix a codegen test

* macro: keep error spans

* clippy

* fix doc example

* removecommented-out code
2023-10-27 16:35:18 +01:00
Niklas Adolfsson 8b4fea0b07 refactor(rpc): support default port in URL (#1122)
* refactor: support default port in URL

Update jsonrpsee to v0.20 to support the default port number in URLs.

* fix nit, revert web feature

* fix lightclient code
2023-08-15 09:53:26 +01:00
Alexandru Vasile 4bda673847 Add light client platform WASM compatible (#1026)
* Cargo update in prep for wasm build

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Add light client test

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Implement low level socket

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Add native platform primitives

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Add wasm platform primitives

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Implement smoldot platform

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust code to use custom platform

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust feature flags

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Adjust wasm endpoint to accept ws for p2p

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust wasm socket

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Book mention of wasm

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Propagate env variable properly

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Revert to native feature flags

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Use tokio rt-multi-thread feature

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Add tokio feature flags for native platform

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* wasm: Use polkadot live for wasm testing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* wasm: Add support for DNS p2p addresses

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* wasm: Disable logs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* wasm: Run wasm test for firefox driver

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* wasm: Reenable chrome driver

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Move lightclient RPC to dedicated crate for better feature flags and modularity

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Use subxt-lightclient low level RPC crate

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Apply cargo fmt

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Enable default:native feature for cargo check

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Extra step for subxt-lightclient similar to signer crate

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Remove native platform code and use smoldot instead

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Enable tokio/multi-threads

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* lightclient: Refactor modules

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust testing crates

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Run light-client WASM tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* wasm-rpc: Remove light-client imports

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Update wasm cargo.lock files

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ci: Spawn substrate node with deterministic p2p address for WASM tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* wasm_socket: Use rc and refcell

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* wasm_socket: Switch back to Arc<Mutex<>>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Add comments

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2023-07-18 14:27:16 +03:00
James Wilson b4eb406ee5 Add subxt_signer crate for native & WASM compatible signing (#1016)
* Add and use subxt-signer crate for WASM compatible signing

* cargo fmt

* dev keypairs already references

* WIP fix various breakages

* re-jig features to be simpler and various test fixes etc

* doc and web fix

* fix various bits and pieces

* fix a test I broke

* dev-deps can't be linked to in docs, hrmph

* cargo fmt

* another doc link

* document the subxt_signer crate more thoroughly

* move feature flag for consistency

* more docs, no default subxt feature flag on signer, update release instrs

* Add missing license header

* unwrap_inner => into_inner

* extend a test a little to better check derive junctions

* note more clearly that the crypto bits come from sp_core::crypto
2023-06-20 11:32:12 +01:00
Tadeo Hepperle f344d0dd4d CLI subxt explore commands (#950)
* add cli command to explore metadata

* fmt and clippy

* Bump serde from 1.0.160 to 1.0.162 (#948)

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.160 to 1.0.162.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.160...1.0.162)

---
updated-dependencies:
- dependency-name: serde
  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>

* extrinsics: Decode extrinsics from blocks (#929)

* Update polkadot.scale

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* extrinsics: Add extrinsics client

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* extrinsics: Decode extrinsics

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Add extrinsic error

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Expose extrinsics

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Fetch and decode block extrinsics

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* extrinsics: Fetch pallet and variant index

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Move extrinsics on the subxt::blocks

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* example: Adjust example

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Collect ExtrinsicMetadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Implement StaticExtrinsic for the calls

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust examples

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Add root level Call enum

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust testing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Add new decode interface

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Merge ExtrinsicError with BlockError

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Find first extrinsic

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Move code to extrinsic_types

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Add Extrinsic struct

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust examples

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* test: Decode extinsics

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* extrinsics/test: Add fake metadata for static decoding

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* extrinsics/test: Decode from insufficient bytes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* extrinsics/test: Check unsupported versions

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* extrinsics/test: Statically decode to root and pallet enums

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* extrinsics/tests: Remove clones

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Fetch block body inline

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Rename ExtrinsicIds to ExtrinsicPartTypeIds

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* extrinsics/test: Check decode as_extrinsic

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Remove InsufficientData error

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Return error from extrinsic_metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* extrinsics: Postpone decoding of call bytes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata_type: Rename variables

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust calls path for example and tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Remove traces

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* book: Add extrinsics documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* book: Improve extrinsics docs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>

* change doc comments

* add constants exploration

* add storage access interface but not done yet

* add storage exploration

* formatting

* remove dbg

* some small tweaks

* fix formatting and scale value for storage

* split up files, sort entries, change formatting

* fmt and clippy fix

* fix minor formatting issue

* implement suggestions

* implement other suggestion, fix bug

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
Co-authored-by: James Wilson <james@jsdw.me>
2023-05-23 13:33:07 +02:00
James Wilson 464b4432cf Move all deps to workspace toml (#932)
* Move all deps to workspace toml

* cargo fmt and codec 3.4, removing now unneeded 'full' feature

* add wasm-tests to workspace and fix subxt inheritng

* cargo fmt

* wasm-test thing can't be in workspace so revert that

* remove unwanted target dir from wasm-tests
2023-04-26 10:31:59 +01:00
dependabot[bot] ef804de4ce Bump clap from 4.2.2 to 4.2.4 (#924)
Bumps [clap](https://github.com/clap-rs/clap) from 4.2.2 to 4.2.4.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.2.2...v4.2.4)

---
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>
2023-04-24 09:52:58 +01:00
Alexandru Vasile 59d195d4ad metadata: Use v15 internally (#912)
* Update frame-metadata to v15.1.0

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Enable V15 unstable metadata in frame-metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Move validation hashing to dedicated file

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Use sp-metadata-ir from substrate to work with metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Revert using sp-metadata-ir in favor of conversion to v15

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Convert v14 to v15

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Use v15 for validation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Use v15 for codegen

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/bench: Use v15

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust to v15 metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust testing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Improve documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* force CI

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Address feedback

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Use HASH_LEN

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadta: Remove `LatestRuntimeMetadata` type alias

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Remove `metadata_to_latest` to avoid pancis

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2023-04-20 17:59:28 +03:00
dependabot[bot] aec1cc52c1 Bump clap from 4.2.1 to 4.2.2 (#915)
Bumps [clap](https://github.com/clap-rs/clap) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.2.1...v4.2.2)

---
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>
2023-04-17 12:38:53 +03:00
dependabot[bot] 62dce16efa Bump serde_json from 1.0.95 to 1.0.96 (#914)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.95 to 1.0.96.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.95...v1.0.96)

---
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>
2023-04-17 12:38:46 +03:00
James Wilson 2a4da618a0 Release 0.28 (#906)
* wip changelog

* Bump versions and write changelog for 0.28

* typo and wee tweaks
2023-04-12 09:34:59 +01:00
dependabot[bot] 34f0521fd2 Bump serde from 1.0.158 to 1.0.159 (#891)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.158 to 1.0.159.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.158...v1.0.159)

---
updated-dependencies:
- dependency-name: serde
  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>
2023-04-03 11:54:51 +01:00
dependabot[bot] 9d40391261 Bump tokio from 1.26.0 to 1.27.0 (#893)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.26.0 to 1.27.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.26.0...tokio-1.27.0)

---
updated-dependencies:
- dependency-name: tokio
  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>
2023-04-03 11:00:16 +01:00
dependabot[bot] 851ce208ed Bump serde_json from 1.0.94 to 1.0.95 (#895)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.94 to 1.0.95.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.94...v1.0.95)

---
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>
2023-04-03 10:53:04 +01:00
dependabot[bot] 44970891de Bump clap from 4.1.8 to 4.1.11 (#869)
Bumps [clap](https://github.com/clap-rs/clap) from 4.1.8 to 4.1.11.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.1.8...v4.1.11)

---
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>
Co-authored-by: James Wilson <james@jsdw.me>
2023-03-21 13:14:30 +00:00
dependabot[bot] 184f85fb26 Bump serde from 1.0.152 to 1.0.155 (#857)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.152 to 1.0.155.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.152...v1.0.155)

---
updated-dependencies:
- dependency-name: serde
  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>
Co-authored-by: James Wilson <james@jsdw.me>
2023-03-13 13:38:03 +01:00
dependabot[bot] f2595df507 Bump serde_json from 1.0.93 to 1.0.94 (#846)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.93 to 1.0.94.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.93...v1.0.94)

---
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>
2023-03-06 12:48:24 +02:00
dependabot[bot] 9ed042812f Bump tokio from 1.25.0 to 1.26.0 (#847)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.25.0 to 1.26.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.25.0...tokio-1.26.0)

---
updated-dependencies:
- dependency-name: tokio
  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>
2023-03-06 12:48:08 +02:00
dependabot[bot] 159e1be10b Bump clap from 4.1.7 to 4.1.8 (#848)
Bumps [clap](https://github.com/clap-rs/clap) from 4.1.7 to 4.1.8.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.1.7...v4.1.8)

---
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>
2023-03-06 12:47:47 +02:00
dependabot[bot] 61457ea873 Bump syn from 1.0.107 to 1.0.109 (#838)
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.107 to 1.0.109.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.107...1.0.109)

---
updated-dependencies:
- dependency-name: syn
  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>
2023-02-27 10:55:56 +01:00
Qinxuan Chen af00f68962 chore: use workspace inheritance for package info (#832)
* chore: use workspace inheritance for package info

* add rust-version field into workspace package

* .workspace = true

---------

Co-authored-by: James Wilson <james@jsdw.me>
2023-02-21 11:53:32 +00:00
dependabot[bot] 7a2df22312 Bump clap from 4.1.4 to 4.1.6 (#830)
Bumps [clap](https://github.com/clap-rs/clap) from 4.1.4 to 4.1.6.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.1.4...v4.1.6)

---
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>
2023-02-21 11:23:52 +00:00
Léa Narzis 6d3c377c16 bump version 0.27.1 (#827) 2023-02-15 17:45:47 +00:00
James Wilson 7b0e06cf8a Release v0.27.0 (#824)
* Bump substrate deps

* Bump to 0.27.0

* update changelog

* Clone and Debug on TxPayload types

* move item to Changed

* remove chore entirely
2023-02-13 16:13:17 +00:00
dependabot[bot] 0fd3b9afb4 Bump serde_json from 1.0.92 to 1.0.93 (#822)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.92 to 1.0.93.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.92...v1.0.93)

---
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>
2023-02-13 11:48:03 +00:00
dependabot[bot] 45bfe6866d Bump serde_json from 1.0.91 to 1.0.92 (#813)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.91 to 1.0.92.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.91...v1.0.92)

---
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>
2023-02-06 11:11:36 +00:00
dependabot[bot] d7ad96aec7 Bump clap from 4.1.3 to 4.1.4 (#809)
Bumps [clap](https://github.com/clap-rs/clap) from 4.1.3 to 4.1.4.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.1.3...v4.1.4)

---
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>
2023-01-30 10:21:18 +00:00
dependabot[bot] d820ab81f5 Bump tokio from 1.24.2 to 1.25.0 (#808)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.24.2 to 1.25.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/commits/tokio-1.25.0)

---
updated-dependencies:
- dependency-name: tokio
  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>
2023-01-30 10:21:06 +00:00
James Wilson d92352ad73 Prep for releasing 0.26.0 (#802)
* Prep for releasing 0.26.0

* link to new RPC spec
2023-01-24 16:55:27 +00:00
James Wilson 08d6640a6c Expose version info in CLI tool with build-time obtained git hash (#787)
* version info with built-time obtained git hash

* clippy

* rerun-if-changed properly and handle git command failing

* cargo fmt
2023-01-17 17:29:12 +00:00
Igor Matuszewski 523534464f Add and adapt a publish.sh utility script from jsonrpsee (#723)
* refactor: Explicitly indicate which crates should be published

* chore: Add a convenience publish.sh script

* Update scripts/publish.sh

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Update scripts/publish.sh

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* fix: Don't use unsupported -P flag in BSD grep in publish.sh

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2022-11-23 12:30:13 +01:00
Niklas Adolfsson 428bc35ed8 chore: prep release v0.25 (#717)
* bump versions 0.25

* update changelog

* adjust RELEASE.md

* fix weird formatting

* rephrase bad english

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md
2022-11-16 16:10:31 +01:00
Niklas Adolfsson 14e8e6f6b6 add wasm support (#700)
* get started

* make it work again

* make it compile again

* Use async-wasm-feature of jsonrpsee from the master branch

* Ensure we enable JS feature of getrandom for the wasm target

* Update subxt/src/lib.rs

* update jsonrpsee

* fix CI

* cargo fmt

* fix wasm test

* fix grumbles

* exclude wasm-tests from workspace

To avoid leaking `jsonrpsee-web` feature into the workspace

Co-authored-by: Igor Matuszewski <xanewok@gmail.com>
2022-11-14 11:45:21 +00:00
Andrew Jones 6cfd3bb511 Upgrade clap to v4 (#678) 2022-10-03 18:40:06 +01:00
James Wilson 4722028ce7 Refactor CLI tool to give room for growth (#667)
* refactor CLI commands for easier expansion

* add license headers

* cargo fmt
2022-09-27 12:29:34 +01:00
James Wilson 75e383dfcf Prep for 0.24 release (#663)
* Bump versions and update changelog

* tweak text

* merge a couple of related changelog entries
2022-09-22 17:16:04 +01:00
James Wilson a3ea12663e Update version, tweak docs, and write up changelog (#616) 2022-08-11 15:04:50 +01:00
dependabot[bot] 6a2aabc2a6 Update jsonrpsee requirement from 0.14.0 to 0.15.1 (#603)
Updates the requirements on [jsonrpsee](https://github.com/paritytech/jsonrpsee) to permit the latest version.
- [Release notes](https://github.com/paritytech/jsonrpsee/releases)
- [Changelog](https://github.com/paritytech/jsonrpsee/blob/master/CHANGELOG.md)
- [Commits](https://github.com/paritytech/jsonrpsee/compare/v0.14.0...v0.15.1)

---
updated-dependencies:
- dependency-name: jsonrpsee
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-01 10:31:18 +01:00
James Wilson c55b7ba3e3 dual license (#590) 2022-06-28 14:09:41 +01:00
Alexandru Vasile f97b8963f5 Add support for ws in subxt-cli (#579)
* cli: Support ws or wss connection via jsonrpsee

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Handle `http` connections via `ureq`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Use Jsonrpsee HTTP client

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Remove `node.to_string()` calls

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2022-06-24 15:50:27 +03:00
Alexandru Vasile c07b9e4be8 Release v0.22.0 (#574)
* Bump versions to `v0.22.0`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Add missing crates for releasing chore

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update changelog

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update changelog message & remove non-user facing PRs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update CHANGELOG.md

Co-authored-by: James Wilson <james@jsdw.me>

* Update CHANGELOG.md

Co-authored-by: James Wilson <james@jsdw.me>

Co-authored-by: James Wilson <james@jsdw.me>
2022-06-20 17:07:38 +03:00
Andrew Jones ec23283d75 Deny unused crate dependencies (#549)
* subxt unused crate deps

* Deny unused dependencies
2022-05-26 14:12:21 +01:00
dependabot[bot] 2b2f82edf8 Update color-eyre requirement from 0.5.11 to 0.6.1 (#540)
Updates the requirements on [color-eyre](https://github.com/yaahc/color-eyre) to permit the latest version.
- [Release notes](https://github.com/yaahc/color-eyre/releases)
- [Changelog](https://github.com/yaahc/color-eyre/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yaahc/color-eyre/compare/v0.5.11...v0.6.1)

---
updated-dependencies:
- dependency-name: color-eyre
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-16 11:56:45 +03:00
Alexandru Vasile 6d73172560 Release v0.21.0 (#525)
* Bump versions to v0.21.0

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update releasing steps

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Add changelog

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* releasing: Add categories for changelog

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update CHANGELOG.md

Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>

* Update CHANGELOG.md

Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>

Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>
2022-05-02 18:54:19 +03:00
Alexandru Vasile 1fd1eee72a Static Metadata Validation (#478)
* metadata: Implement MetadataHashable for deterministic hashing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Hash `scale_info::Field`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Hash `scale_info::Variant`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Hash `scale_info::TypeDef`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Hash pallet metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Avoid data representation collision via unique identifiers

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Finalize hashing on recursive types

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Cache recursive calls

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Move `MetadataHashable` to codegen to avoid cyclic dependency

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Add pallet unique hash

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Wrap metadata as owned

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Use MetadataHashable wrapper for clients

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Generate runtime pallet uid from metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Validate metadata compatibility at the pallet level

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update polkadot.rs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Modify examples and tests for the new API

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Implement metadata uid

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update polkadot with TryFrom implementation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* client: Change `to_runtime_api` to reflect TryFrom changes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* client: Skip full metadata validation option

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Add option to skip pallet validation for TransactionApi

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Add option to skip pallet validation for StorageApi

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update polkadot.rs with ability to skip pallet validation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Change `MetadataHashable` to per function implementation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Use metadata hashes functions

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Use metadata hashes functions

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Make `get_type_uid` private

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen, subxt: Rename metadata functions `*_uid` to `*_hash`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Update `get_field_hash` to use `codec::Encode`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Update polkadot.rs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen, subxt: Move metadata check from client to subxt::Metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen, subxt: Rename metadata check functions to follow `*_hash` naming

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Update polkadot.rs to reflect naming changes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Use `encode_to` for metadata generation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Update polkadot.rs to reflect `encode_to` changes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Specific name for visited set

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Provide cache to hashing functions

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Compute metadata hash by sorted pallets

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Get extrinsic hash

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Extend metadata hash with extrinsic and metadata type

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Add cache as metadata parameter

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen, subxt: Update metadata hash to use cache

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Implement Default trait for MetadataHasherCache

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Add cache for pallets

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Move functionality to metadata crate

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen, subxt: Use subxt-metadata crate

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Remove metdata hashing functionality

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Add documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Fix vector capacity to include extrinisc and type hash

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Add empty CLI

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-cli: Fetch metadata from substrate nodes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-cli: Log metadata hashes of provided nodes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-cli: Group compatible nodes by metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-cli: Simplify hash map insertion

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-cli: Move full metadata check to function

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-cli: Group metadata validation at the pallet level

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Persist metadata cache

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Move compatibility cli from subxt-metadata to subxt-cli

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Remove cli from subxt-metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cli: Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Fix compatible metadata when pallets are registered in different order

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Handle result of pallet hashing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Remove type cache for deterministic hashing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Add test assets from `substrate-node-template` tag `polkadot-v0.9.17`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-tests: Check cache hashing for Balances pallet

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Fix `get_type_hash` clippy issue

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-tests: Compare one time cache with persistent cache

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-test: Check metadata hash populates cache for pallets

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-tests: Simplify `cache_deterministic_hash` test

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-tests: Check deterministic metadata for different order pallets

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Implement TransactionApiUnchecked for skipping pallet validation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Implement StorageApiUnchecked for skipping pallet validation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Remove skip_pallet_validation boolean

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Implement ClientUnchecked for skipping metadata validation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update polkadot.rs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update examples of rpc_call to skip metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Remove heck dependency

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Add pallet name as an identifier for pallet hashing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Implement MetadataHashDetails

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Adjust testing to `MetadataHashDetails` interface

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Remove extra `pallet_name`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Update polkadot.rs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Fix clippy issue

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Change StorageApi to support `_unchecked` methods

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Change TransactionApi to support `_unchecked` methods

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Switch back from `TryFrom` to `From` for `subxt::Client`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen, subxt: Remove `ClientUnchecked`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Expose `validate_metadata` as validation of compatibility method

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Update to the new interface

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Update test integration to latest interface

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Update polkadot.rs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Check different pallet index order

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Check recursive type hashing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Check recursive types registered in different order

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Fix recursive types warning

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Remove test assets

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Extend tests to verify cached pallet values

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Add metadata compatiblity example

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Revert balance_transfer to initial form

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Add ConstantsApi metadata check

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Modify tests to accomodate ConstantsApi changes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Modify verified version

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Generate polkadot.rs from `0.9.18-4542a603cc-aarch64-macos`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Update polkadot_metadata.scale from `0.9.18-4542a603cc-aarch64-macos`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Update documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Modify default pallet usage

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Remove hex dependency

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Add MetadataTestType to capture complex types

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Update tests to use complex types

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Check metadata correctness via extending pallets

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Extend pallet hash with Events

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Extend pallet hash with constants

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Extend pallet hash with error

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Extend metadata compatibiliy with StorageApi and ConstantsApi

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Modify comments and documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Benchmarks for full validation and pallet validation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/benches: Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Hash metadata just by inspecting the provided pallets

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Make pallets generic over T for `AsRef<str>`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Expose the name of the pallets composing the metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt/tests: Update polkadot.rs with pallets name

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Obtain metadata hash only by inspecting pallets

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen,subxt: Extend the metadata hash to utilize just pallets

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt/tests: Update polkadot.rs with client metadata has per pallet

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Test `get_metadata_per_pallet_hash` correctness

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/benches: Fix decode of metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* [static metadata] validate storage, calls and constants per call (#507)

* validate storage, calls and constants per call

* fix typo

* cache per-thing hashing, move an Arc, remove some unused bits

* create hash_cache to simplify metadata call/constant/storage caching

* simplify/robustify the caching logic to help prevent mismatch between get and set

* cargo fmt

* Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* bench the per-call metadata functions

* metadata: Add test for `node_template_runtime_variant`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ensure criteron cli opts work

* group benchmarks and avoid unwrap issues

* metadata: Check template runtime for handling the pallet swap order case

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Remove debug logs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Optimise by removing field's name and type_name and type's path

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Refactor `get_type_hash` to break recursion earlier

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Add tests for `hash_cache`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Add tests for checking Metadata Inner cache

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Check semantic changes inside enum and struct fields

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Add enums named differently with compatible semantic meaning

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Guard testing of release versions for `node_template_runtime`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Improve documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update polkadot.rs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata/tests: Manually construct type of `node_template_runtimeL::Call`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* no more special Call handling, avoid a little cloning, and actually sort by name

* remove unused deps and fmt

* RuntimeMetadataLastVersion => RuntimeMetadataV14

* remove a bunch of allocations in the metadata hashing, speed up from ~17ms to ~5ms

* update release docs to release metadata crate too

* subxt: Remove codegen dependency

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Replace std RwLock with parking_lot

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt/tests: Add ws address to `TestNodeProcess`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt/tests: Add metadata validation integration test

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Allow setting metadata on the ClientBuilder

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt/tests: Check incompatible metadatas

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata: Fix constant hashing for deterministic output

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt/tests: Check metadata validation for constants

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt/tests: Test validation for calls

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt/tests: Test validation for storage

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Expose `set_metadata` for testing only

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt: Guard metadata tests under integration-tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

Co-authored-by: James Wilson <james@jsdw.me>
2022-04-28 12:37:07 +03:00