82 Commits

Author SHA1 Message Date
pezkuwichain b8ee6a084f Rebrand subxt to pezkuwi-subxt with pezsp_runtime support
- Renamed all crate names from subxt-* to pezkuwi-subxt-*
- Updated codegen to use pezsp_runtime, pezsp_core, pezframe_support instead of sp_runtime, sp_core, frame_support
- Replaced all internal references from subxt_* to pezkuwi_subxt_*
- Added local path dependencies to Pezkuwi SDK crates
- Updated workspace configuration for edition 2024
2025-12-19 16:00:14 +03:00
James Wilson 8203679cbd Merge v0.50.x to master (#2127)
* v0.50.0: Integrate frame-decode, redo storage APIs and break up Error. (#2100)

* WIP integrating new frame-decode and working out new storage APIS

* WIP: first pass adding new storage things to subxt-core

* Second pass over Address type and start impl in Subxt

* WIP new storage APIs

* WIP New storage APIs roughly completed, lots of errors still

* Remove PlainorMap enum; plain and map values now use same struct to simplify usage

* Begin 'fixing' errors

* WIP splitting errors and tidying payload/address traits

* Get subxt-core compiling

* Small fixes in subxt-core and remove metadata mod

* subxt-core: cargo check --all-targets passes

* Fix test

* WIP starting to update subxt from subxt-core changes

* WIP splitting up subxt errors into smaller variants

* WIP errors: add DispatchError errors

* Port new Storage APIs to subxt-core

* cargo check -p subxt passes

* Quick-fix errors in subxt-cli (explore subcommand)

* fmt

* Finish fixing codegen up and start fixing examples

* get Subxt examples compiling and bytes_at for constants

* Add some arcs to limit lifetimes in subxt/subxt-core storage APIs

* A little Arcing to allow more method chaining in Storage APIs, aligning with Subxt

* Update codegen test

* cargo check --all-targets passing

* cargo check --features 'unstable-light-client' passing

* clippy

* Remove unused dep in subxt

* use published frame-decode

* fix wasm-example

* Add new tx extension to fix daily tests

* Remove unused subxt_core::dynamic::DecodedValue type

* Update book to match changes

* Update docs to fix more broken bits

* Add missing docs

* fmt

* allow larger result errs for now

* Add missing alloc imports in subxt-core

* Fix doc tests and fix bug getting constant info

* Fix V14 -> Metadata transform for storage & constants

* Fix parachain example

* Fix FFI example

* BlockLength decodes t ostruct, not u128

* use fetch/iter shorthands rather than entry in most storage tests

* Fix some integration tests

* Fix Runtime codegen tests

* Expose the dynamic custom_value selecter and use in a UI test

* Update codegen metadata

* Tidy CLI storage query and support (str,str) as a storage address

* Add (str,str) as valid constant address too

* Show string tuple in constants example

* Via the magic of traits, avoid needing any clones of queries/addresses and accept references to them

* clippy

* [v0.50] update scale-info-legacy and frame-decode to latest (#2119)

* bump scale-info-legacy and frame-decode to latest

* Remove something we don't need in this PR

* Fully remove unused for now dep

* [v0.50] Convert historic metadata to subxt::Metadata (#2120)

* First pass converting historic metadatas to our subxt::Metadata type

* use published frame-decode

* fmt and rename legacy metadata macro

* Enable legacy feature where needed in subxt_metadata so it compiles on its own

* Use cargo hack more in CI and fix subxt-metadata features

* Add tests for metadata conversion (need to optimise; some too expensive right now

* Address performance and equality issues in metadata conversion testing

* fmt

* fmt all

* clippy

* Fix a doc link

* Test codegen and fixes to make it work

* Remove local frame-decode patch

* bump frame-decode to latest

* [v0.50.0] Allow visiting extrinsic fields in subxt_historic (#2124)

* Allow visiting extrinsic fields

* fmt

* Don't use local scale-decode dep

* Clippy and tidy

* Extend 'subxt codegen' CLI to work with legacy metadatas

* Simplify historic extrinsics example now that AccountId32s have paths/names

* clippy

* clippy

* clippy..

* Allow visiting storage values, too, and clean up extrinsic visiting a little by narrowing lifetime

* Try to fix flaky test

* Add custom value decode to extrinsics example

* Remove useless else branch ra thought I needed

* Simplify examples

* Prep to release v0.0.5 (#2126)
2025-11-22 10:44:03 +00:00
Sven Eriksson a62aea4c37 Fix typos (#2112) 2025-10-24 10:34:25 +01:00
Evelina Carl 884dfe6c69 chore: fix some typos (#2098) 2025-09-26 10:43:45 +01:00
James Wilson 42f1a62a05 Fix 1.89 clippy warnings (#2055)
* Fix 1.89 clippy warnings

* WASM lightclient clippy fixes too
2025-08-11 15:33:55 +01:00
puzzle-rusher e892802baf Clippy fixes (#2033)
* clippy fixed

* wasm clippy

* clippy fixes

* post clippy fmt

* last clippy fix
2025-07-04 21:21:31 +01:00
James Wilson 23c62f3d5d Update to 2024 edition (#2001)
* Update to 2024 edition

* Update to 2024 edition; fmt, use<> and remove refs

* async functions
2025-05-09 16:12:18 +01:00
James Wilson 9ba89e3ed7 Support v16 metadata and use it by default if it's available (#1999)
* Support v16 metadata and use it by default if it's available

* lockfile

* fix blocks test; new transaction extension in kitchensink runtime

* Bump scale-typegen to 0.11.1 to cater for Duration prelude type

* fmt

* Fix no-std test building

* Cargo update and bump substrate deps

* Update test and no-std deps

* fmt

* fix test
2025-05-08 14:44:44 +01:00
James Wilson 4524590821 Metadata V16: Implement support for Pallet View Functions (#1981)
* Support Pallet View Functions in Subxt

* fmt

* clippy

* Move a little view function logic to subxt_core

* clippy

* Add back check that prob isnt needed

* avoid vec macro in core

* Add view funciton test and apply various fixes to get it working

* Add test for dynamic view fn call and fix issues

* clippy

* fix test-runtime

* fmt

* remove export

* avoid vec for nostd core

* use const instead of fn for view fn call name

* Update to support latest unstable metadata

* Update metadata stripping tests for new v16 version
2025-04-24 14:42:07 +01:00
James Wilson 72ac18491c Support V16 metadata and refactor metadata code (#1967)
* WIP integrate unstable v16 metadata into Subxt

* first pass moving retain to the CLI tool

* Remove otuer enum variant stripping and move now simpler strip_metadata to new crate. test it

* tidyup to use stripmetadata package etc

* Fix / comment out tests

* fmt

* clippy

* Fix wasm example

* wasm-example fix

* wasm-example fix

* Maske sure to move IDs around after types.retain()

* fmt

* Tweak comment

* Find dispatch error separately to avoid issues during mapping

* Expose associated type information in pallet metadata

* Hopefully fix flaky archive RPC

* remove unwanted temp file

* Address nits

* Add back commented-otu tests and address review comments

* use either, and simplify for_each
2025-03-28 15:35:55 +00:00
James Wilson b6b9ac65c7 Support constructing and submitting V5 transactions (#1931)
* TransactionExtensions basic support for V5 VerifySignature and renames

* WIP: subxt-core v5 transaction support

* Subxt to support V5 extrinsics

* WIP tests failing with wsm trap error

* Actually encode mortality to fix tx encode issue

* fmt

* rename to sign_with_account_and_signature

* Add explicit methods for v4 and v5 ext construction

* clippy

* fix wasm example and no mut self where not needed

* fix doc example

* another doc fix

* Add tests for tx encoding and fix v5 encode issue

* add copyright and todo

* refactor APIs to have clear v4/v5 split in core and slightly nicer split in subxt proper

* rename Partial/SubmittableExtrinsic to *Transaction

* Remove SignerT::address since it's not needed

* doc fixes

* fmt

* doc fixes

* Fix comment number

* Clarify panic behaviour of inject_signature

* fmt
2025-03-11 11:14:27 +00:00
wgyt 396762510a update copyright year (#1924)
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2025-02-24 16:07:29 +00:00
Niklas Adolfsson 69ce6d726f deps: remove polkadot-sdk umbrella crate (#1926)
* deps: get rid of polkadot-sdk umbrella crate

* fix nits

* Update subxt/src/backend/mod.rs

* Update subxt/src/events/events_client.rs

* Update metadata/src/utils/validation.rs

* cargo clippy fix

* fix ui tests
2025-02-24 12:38:21 +01:00
James Wilson 94f4e7f39b preserve custom metadata when converting between Subxt metadata and frame_metadata (#1914) 2025-01-30 16:14:11 +00:00
David Wood 3ab5832059 chore: fix some typos in comment (#1898)
Signed-off-by: davidwoood <davidwood@aliyun.com>
2025-01-20 09:53:48 +00:00
Niklas Adolfsson f5e9ce0d2c remove substrate compat (#1850)
* remove substrate compat

* add hacky example

* simplify substrate-compat example

* simplify substrate-compat example

* cargo fmt

* fix build

* add more examples

* fix nit

* fix test build

* Update subxt/examples/substrate_compat_signer.rs

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

* keep only polkadot signer example

* remove more substrate compat related stuff

* fix example

* link to substrate signer example in book

* Update subxt/src/book/usage/transactions.rs

* Update subxt/src/book/usage/transactions.rs

* address grumbles

* fix nits

---------

Co-authored-by: James Wilson <james@jsdw.me>
2024-11-27 16:46:38 +01:00
Pavlo Khrystenko 7d1002192e Migrate custom error trait impls to thiserror (#1856)
* Migrate to thiserror

* missing bits

* review comment

* Apply suggestions from code review

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

* From<scale_decode::visitor::Error> to remove Into::intos

* scale crates for core::error::Error

* bump msrv 1.81

* make signer crate compile

---------

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: James Wilson <james.wilson@parity.io>
2024-11-18 09:39:14 +00:00
James Wilson 3219659f12 Fix substrate nightly (#1848) 2024-10-30 10:40:02 +01:00
Niklas Adolfsson 2f7ea3ff64 chore(deps): bump frame-metadata from 16 to 17 (#1836)
* chore(deps): bump frame-metadata from 16 to 17

* fix substrate test build

* revert test fix

---------

Co-authored-by: James Wilson <james@jsdw.me>
2024-10-23 17:57:06 +02:00
James Wilson c07c760d85 Update frame-decode to 0.4.0 (#1833) 2024-10-22 13:08:40 +02:00
Pavlo Khrystenko ae0fce8dff Strip metadata fix (#1774)
* Fix metadata stripping being too eager

closes #1659

---------

Co-authored-by: James Wilson <james@jsdw.me>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2024-10-21 22:41:14 +02:00
Niklas Adolfsson 0e86993cd7 deps: use polkadot-sdk umbrella crate (#1786)
* deps: unify usage of polkadot-sdk crates

* cargo fmt

* fix macro crate

* make tests compile

* fix more nits

* fix doc tests

* fix more nits

* more nits

* core: remove polkadot-sdk/std

* cargo fmt

* remove polkadot-sdk/std by default

* Update metadata/Cargo.toml

* remove more std

* Update Cargo.toml
2024-10-11 14:19:11 +02:00
James Wilson b5209a162e Use frame-decode for core extrinsic decode logic (#1785)
* WIP using frame-decode for core extrinsic decode logic

* fmt

* Fix dependabot config

* clippy

* tidy some imports

* Fix a couple of tests

* Update to frame-decode 0.0.7

* fix docs

* Decode exts earlier to avoid doing it every iter/find step

* frame-decode to 0.1.0

* fmt

* clippy

* fix wasm example

* doc test fixes

* Fix test

* Fix a couple of subxt_core tests
2024-10-01 11:21:51 +01:00
Niklas Adolfsson 39d130ec69 chore: make it possible override clippy all (#1698)
* chore: make it possible override `clippy all`

* chore: fix clippy lints

* Update Cargo.toml
2024-07-29 17:43:33 +02:00
Pavlo Khrystenko 971c15cf3b Disable clippy::unwrap_or_default lint for the project (#1647)
* disable clippy lint trigerred by a macro

* typo in lint name

* Update macro/src/lib.rs

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

* move missing docs

* add workspace.lints = true for remaining crates

* lint fixes

* Update signer/src/eth.rs

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

---------

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: James Wilson <james@jsdw.me>
2024-06-18 18:45:40 +02:00
Pavlo Khrystenko 5a0682c1e0 Remove derive_more (#1600)
* replace derive_more's 'From' in signer

* replace derive_more's 'From' in core

* Remove `derive_more`'s `Display` usages (#1601)

* Remove derive_more's 'Display' from core

* Remove derive_more's 'Display' from metadata

* Remove derive_more's 'Display' from signer

* Remove derive_more from dependencies (#1602)

closes #1503

* Update signer/src/eth.rs

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

* rename convert_error to impl_from

* rename convert_error to impl_from in core

---------

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2024-05-24 11:18:51 +02:00
Alexandru Vasile a5d94a4b8b metadata: Fix cargo clippy (#1574)
* metadata: Fix cargo clippy

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

* subxt/backend: Fix clone clippy

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

* tests: Use clone into

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

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2024-05-06 10:11:39 +02:00
Tadeo Hepperle a0cb14aa4f subxt-core crate (#1466)
* start migrating, broken

* first iteration of updating

* fmt and clippy

* add Composite<u32> decoding via scale value patch

* bump scale type gen versions

* fix decoding with new scale decode

* compiling with changed deps

* core utils, condig, client, metadata

* core crate compiling

* signer crate no once lock

* add core to no-std-tests, change imports

* broken commit, start pulling everything together in subxt

* port more things to subxt

* events in core crate, extrinsics sadly much more difficult

* almost all examples pass again

* dynamic values fix in examples

* fix no std issue and fmt

* remove unused dependencies

* fix lightclient impl

* runtime version refactor

* formatting and addressing nits

* more comments addressed

* update wasm example and no-std-signer tests

* other nits and error impl on signer errors

* fix feature flag

* fix runtime version refactor

* fix doc links

* fix integration tests

* fix feature flag gated client state

* fix native feature in CI

* fix lightclient utils

* make imports more lean in subxt-core

* integrate changes from subxt-core imports into subxt

* other changes in subxt simplify imports more

* fix  and docs

* doc false for cli

* fix clippy

* remove events block hash in tests

* codegen no-std support in generated code

* export alloc crate for no-std codegen

* fix doc test

* implement James comments

* remove std traits, use core traits instead

* address nits

* remove unusued dep in no-std tests

* fix Box import in no_std

* sp-crypto-hashing instead of sp-core-hashing

* bump scale-typegen, add no std codegen tests

* fix some things

* replace unmaintained derivative with derive_where to remove non-canonical warnings

* fmt

* remove unused dep

* fix deps

* update artifacts to fix type ID mismatches

* bump to latest scale-typegen

---------

Co-authored-by: James Wilson <james@jsdw.me>
2024-03-27 08:55:08 +00:00
James Wilson 98c4c0135b chore: rename sp-core-hashing to sp-crypto-hashing (#1490)
* rename sp-core-hashing to sp-crypto-hashing

* fmt
2024-03-21 16:18:00 +01:00
Tadeo Hepperle a2ee750365 Typed Storage Keys (#1419)
* first iteration on storage multi keys

* decoding values from concat style hashers

* move util functions and remove comments

* change codegen for storage keys and fix examples

* trait bounds don't match scale value...

* fix trait bounds and examples

* reconstruct storage keys in iterations

* build(deps): bump js-sys from 0.3.67 to 0.3.68 (#1428)

Bumps [js-sys](https://github.com/rustwasm/wasm-bindgen) from 0.3.67 to 0.3.68.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

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

* build(deps): bump clap from 4.4.18 to 4.5.0 (#1427)

Bumps [clap](https://github.com/clap-rs/clap) from 4.4.18 to 4.5.0.
- [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.4.18...clap_complete-v4.5.0)

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

* build(deps): bump either from 1.9.0 to 1.10.0 (#1425)

Bumps [either](https://github.com/rayon-rs/either) from 1.9.0 to 1.10.0.
- [Commits](https://github.com/rayon-rs/either/compare/1.9.0...1.10.0)

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

* build(deps): bump thiserror from 1.0.56 to 1.0.57 (#1424)

Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.56 to 1.0.57.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.56...1.0.57)

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

* build(deps): bump jsonrpsee from 0.21.0 to 0.22.0 (#1426)

* build(deps): bump jsonrpsee from 0.21.0 to 0.22.0

Bumps [jsonrpsee](https://github.com/paritytech/jsonrpsee) from 0.21.0 to 0.22.0.
- [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.21.0...v0.22.0)

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

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

* Update Cargo.lock

---------

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>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* subxt: Derive `std::cmp` traits for subxt payloads and addresses (#1429)

* subxt/tx: Derive std::cmp traits

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

* subxt/runtime_api: Derive std::cmp traits

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

* subxt/constants: Derive std::cmp traits

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

* subxt/custom_values: Derive std::cmp traits

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

* subxt/storage: Derive std::cmp traits

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

* subxt: Fix non_canonical_partial_ord_impl clippy introduced in 1.73

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

* subxt: Add comment wrt derivative issue that triggers clippy warning

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

* Update subxt/src/backend/mod.rs

* Update subxt/src/constants/constant_address.rs

---------

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

* fix clippy

* add integration tests

* fix doc tests

* change hashing logic for hashers=1

* refactor

* clippy and fmt

* regenerate polkadot file which got changed by the automatic PR

* nested design for storage keys

* refactor codegen

* codegen adjustments

* fix storage hasher codegen test

* Suggestions for storage value decoding (#1457)

* Storage decode tweaks

* doc tweak

* more precise error when leftover or not enough bytes

* integrate nits from PR

* add fuzztest for storage keys, fix decoding bug

* clippy and fmt

* clippy

* Niklas Suggestions

* lifetime issues and iterator impls

* fmt and clippy

* regenerate polkadot.rs

* fix storage key encoding for empty keys

* rename trait methods for storage keys

* fix hasher bug...

* impl nits, add iterator struct seperate from `StorageHashers`

* clippy fix

* remove println

---------

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: James Wilson <james@jsdw.me>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
2024-03-06 14:04:51 +01:00
Tadeo Hepperle 5447035716 Subxt Metadata: #[no_std] compatibility (#1401)
* no-std tests and porting of subxt-metadata

* update pipeline

* fix generate custom metadata test

* fix cargo run command

* adjust pipeline

* remove prelude from subxt-metadata

* revert autoformatting of Cargo.toml

* remove alloc::format! again, still causes linker errors

* add no-std-build for thumbv7em-none-eabi target

* remove std feature flag

* remove libc and add small readme with test instructions

* change ci for nightly no std
2024-02-15 10:49:15 +01:00
Tadeo Hepperle c3e02e7be2 Bugfix: trimmed metadata hash comparison fails in is_codegen_valid_for (#1306)
* 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>

* test and outer enum pre compute

* explicit OuterEnumHashes type

* clippy

* move outer enums to their own module

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2023-12-06 15:41:07 +00: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
James Wilson cf7e2db1b7 chainHead based backend implementation (#1161)
* add follow_stream impl

* follow_stream_unpin first draft

* add tests for follow_stream_unpin

* more tests and fixes for follow_stream_unpin

* first pass follow_stream_driver

* follow_stream_driver: add tests, fix things, buffer events from last finalized

* First pass finishing Backend impl

* Fix test compile issues

* clippy fixes

* clippy fix and consistify light_client

* revert lightclient tweak

* revert other lightclient thing

* cargo fmt

* start testing unstable backend behind feature flag

* more test fixes and move test-runtime metadata path just incase

* fix compile error

* ensure transaction progress stream actually used and fix another test

* cargo fmt

* CI tweak

* improve some comments and address some feedback bits

* update CI to use our own nightly binary

* wait for finalized block perhaps
2023-09-26 16:58:30 +01:00
Alexandru Vasile c2522c6b5b metadata: Generate runtime outer enums if not present in V14 (#1174)
* metadata: Extend outer enum generation for V14

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

* metadata: Generate outer enums if not present

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

* metadata: Porpagate v14 error instead of panic

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

* metadata: Try to find `RuntimeCall` then `Call` enums

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

* metadata: Ensure the returned type is variant for outer enums

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

* metadata: Replace or with or_else

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

* metadata: Apply clippy

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

* metadata: Return error and generate only `RuntimeError`

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

* metadata: Remove modified path

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

* metadata/tests: Check missing runtime types

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

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2023-09-25 18:37:38 +03:00
Tadeo Hepperle 12e343449e Make the codegen more accessible for running in WASM (#1154)
* minor api changes

* parsing instead of format_ident!

* fix self issue

* expose types on typegen

* web wasm support via feature flag

* fmt and clippy

* small adjustments

* remove exposing of types() in type generator

* adjust compile error

* remove little any flag

* Need access to the type registry from the typegen again

* Bump proc-macro2 from 1.0.66 to 1.0.67 (#1164)

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](https://github.com/dtolnay/proc-macro2/compare/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>

* Bump serde_json from 1.0.106 to 1.0.107 (#1166)

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](https://github.com/serde-rs/json/compare/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>

* Bump trybuild from 1.0.84 to 1.0.85 (#1167)

Bumps [trybuild](https://github.com/dtolnay/trybuild) from 1.0.84 to 1.0.85.
- [Release notes](https://github.com/dtolnay/trybuild/releases)
- [Commits](https://github.com/dtolnay/trybuild/compare/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>

* Bump Swatinem/rust-cache from 2.6.2 to 2.7.0 (#1168)

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](https://github.com/swatinem/rust-cache/compare/e207df5d269b42b69c8bc5101da26f7d31feddb4...a95ba195448af2da9b00fb742d14ffaaf3c21f43)

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

* Bump jsonrpsee from 0.20.0 to 0.20.1 (#1165)

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](https://github.com/paritytech/jsonrpsee/compare/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>

* Bump clap from 4.4.2 to 4.4.3 (#1163)

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](https://github.com/clap-rs/clap/compare/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>

* fix double quote import introduced by merge

* clippy

* put ensure_unique_types on metadata, revert toml changes

* fmt

* solve frame_metadata import

* tidy fetch-metadata and non_exhaustive on errors

* remove the getrandom thing

* fix toml autoformatting

---------

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-09-20 13:16:05 +02:00
Tadeo Hepperle c8462defab Add proper test Custom values (#1147)
* add proper tests for custom values

* remove try operators

* use sustrate compat for import of hash

* add license and hex

* add script to artifacts.sh

* custom values with ids not in metadata can be accessed in static interface

* fmt and clippy

* access bytes of custom values directly, even if type id wrong

* final fixes

* removing substrate-compat flag from ui tests

* Update subxt/src/custom_values/custom_values_client.rs

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

* remove types access in type generator

* 2 extra lines

---------

Co-authored-by: James Wilson <james@jsdw.me>
2023-09-12 15:46:12 +02:00
James Wilson a3d25db846 Unstable Backend: add back the old chainHead RPCs/tests (#1137)
* add back unstable APIs and tests

* clippy fixes

* fmt with new rust

* deserialize from object or array into api versions

* remove inspect

* add some of the other unstable RPC methods we might want

* clippy fix

* no unused deps warning in test crate

* fix doc fails

* legacy -> unstable

Co-authored-by: Tadeo Hepperle <62739623+tadeohepperle@users.noreply.github.com>

* runtime_updates -> with_runtiem

* add test and be consistent with naming of unstable RPCs

---------

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: Tadeo Hepperle <62739623+tadeohepperle@users.noreply.github.com>
2023-08-29 12:35:35 +01:00
Alexandru Vasile 91a56fd580 Apply cargo fmt (#1146)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2023-08-28 15:03:29 +02:00
Tadeo Hepperle b413e5e84e Codegen for custom values in metadata (#1117)
* work in progress

* add custom types access

* nit

* custom values client

* adjust light client

* adjust doc comments

* adjust book for custom values in code gen

* format and check docs

* work in progress

* add custom types access

* nit

* custom values client

* adjust light client

* codegen and validation

* adjust docs

* use ignore in docs in book

* change iter implementation

* use validation hash and other codegen changes

* add ui test for custom values codegen

* allow 'latest' metadata to be returned from the fallback code (#1127)

* nits

* fix validation check

* fix comments

* nits

---------

Co-authored-by: James Wilson <james@jsdw.me>
2023-08-24 09:50:44 +02:00
Tadeo Hepperle 8ba113f368 V15 Metadata: Support accessing custom types (#1106)
* work in progress

* add custom types access

* nit

* custom values client

* adjust light client

* adjust doc comments

* adjust book for custom values in code gen

* format and check docs

* use ignore in docs in book
2023-08-11 14:49:29 +02:00
Tadeo Hepperle 475a1413e4 Prevent bug when reusing type ids in hashing (#1075)
* practice TDD

* implement a hashmap 2-phases approach

* use nicer types

* add test for cache filling

* adjust test

---------

Co-authored-by: James Wilson <james@jsdw.me>
2023-07-19 19:49:08 +02:00
Alexandru Vasile 78a106f059 Utilize Metadata V15 (#1041)
* Update frame-metadata to the latest branch

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

* metadata: Add outer enum types

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

* metadata: Extend the extrinsic with address,call,sign,extra types

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

* Codegen test Event, Error and Call for outer enums

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

* Revert "Codegen test Event, Error and Call for outer enums"

This reverts commit db542dca0369eedd257a7ec031d5b5549bc46a88.

* Update frame-metadata from the latest release

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

* Update scale-info

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

* codegen/error: Support v15 message

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

* metadata: Convert v14 to v15

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

* metadata/retain: Adjust to extrinsic type for V15

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

* metadata/validation: Adjust hashing for extrinsic types V15

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

* scripts: Fetch V15 and output codegen for full_client only

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

* subxt/blocks: Use extrinsic types directly

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

* testing: Fetch V15 for build script

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

* artifacts: Generate from latest polkadot version

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

* codegen: Fetch legacy with old API for v14 only

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

* rpc: Fetch metadata versions

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

* client: Fetch latest unstable then V15 then V14

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

* testing: Adjust testing API to latest interface

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

* Adjust clippy

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

* metadata: Generate the `RuntimeError` type for V14

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

* Remove testing files

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

* testing/staking: Remove controller account from bond

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

* metadata/validation: Use specific variants for hashing RuntimeCall

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

* XXX: Custom Substrate binary: must revert with next release

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

* XXX: To revert: CI use hardcoded substrate

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

* codegen: Use v15 outer enum types

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

* metadata: Retain outer enum types

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

* codegen: Use outer enum types instead of generating them

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

* Update artifacts

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

* Revert "XXX: Custom Substrate binary: must revert with next release"

This reverts commit e9705298661919f5769720b35030759fb8a7b01d.

Revert "XXX: To revert: CI use hardcoded substrate"

This reverts commit b18a5a0985a56ee4ad99bc9a1c0f9cd733cf4271.

* testing: Include env for dummy wat contracts

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

* Adjsut clippy

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

* ci: Use new link for fetching latest substrate binary

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

* tests: Include dummy RuntimeEvent into test metadata

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

* ci: Bump light-client timeout tests to 25min

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

* metadata/validation: Use specific pallets as provided

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

* testing: Rename metadata constant

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

* metadata: Use call_ty instead of signature_ty

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

* metadata: Rename retaining variant function

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

* metadata: Use Option<&[&str]>

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

* online_client: Fetch V15 metadata explicitely

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

* metadata/validation: Include the hash of the outer enum types

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

* metadata: Fix sign typo

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

* artifacts: Update the artifacts

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

* subxt: Remove RootError RootEvent and RootExtrinsic traits

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

* Update polkadot.rs

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

* metadata/tests: Ensure outer enum variants are retained

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

* scripts: Include multiple pallets for our decoding purposes

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

* subxt: Apply clippy

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

* artifacts: Update small metadata

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

* error: Keep raw bytes for the ModuleError representation

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

* error: Modify docs to not include links

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

* subxt/tests: Propagate `RuntimeCall` to outer enums

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

* subxt: Provide proper byte slice for decoding

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

* Update artifacts

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

* cli/tests: Adjust expected pallets message

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

* metadata: Test conversion from v14 to v15

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

* metadata: Fix typo

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

* Update subxt/src/blocks/extrinsic_types.rs

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

* metadata: Simplify type path for RuntimeError

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

* metadata/validation: Use visited ids per outer enum

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

* error: Remove RawModuleError

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

* Fix new clippy error from updated rust version

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>
2023-07-17 12:52:02 +03:00
Tadeo Hepperle 2a990edaca Metadata difference command (#1015)
* diffing pallets and runtime apis

* print diff

* clippy fix and format

* change formatting

* fmt

* diff working with storage details

* fix diff

* cargo fmt

* remove printing of node

* change strings

* handle parsing differently

* clippy fix

* cargo fmt

* more abstraction

* clippy fix and fmt

* add unit test and ordering

* fix small issue
2023-06-21 14:33:21 +02:00
Tadeo Hepperle 992ec9ab9b Fix codegen validation when Runtime APIs are stripped (#1000)
* modify code gen

* cargo fmt

* fix return

* move the runtime_apis static

* small layout change

* tidy up metadata UI testing and test validation function too

* fix validation tests to point to metadata

* update codegen

* fix clippy and tests

* tweak a comment

* rename validate_codegen => is_codegen_valid_for

---------

Co-authored-by: James Wilson <james@jsdw.me>
2023-06-09 10:10:48 +01:00
James Wilson 27d5868be6 Remove invalid redundant clone warning (#996) 2023-06-02 11:27:04 +01:00
James Wilson 870d4df2ed Skip call variants if there aren't any (#980)
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2023-05-26 13:40:35 +01:00
James Wilson b9f5419095 Introduce Metadata type (#974)
* WIP new Metadata type

* Finish basic Metadata impl inc hashing and validation

* remove caching from metadata; can add that higher up

* remove caches

* update retain to use Metadata

* clippy fixes

* update codegen to use Metadata

* clippy

* WIP fixing subxt lib

* WIP fixing tests, rebuild artifacts, fix OrderedMap::retain

* get --all-targets compiling

* move DispatchError type lookup back to being optional

* cargo clippy

* fix docs

* re-use VariantIndex to get variants

* add docs and enforce docs on metadata crate

* fix docs

* add test and fix docs

* cargo fmt

* address review comments

* update lockfiles

* ExactSizeIter so we can ask for len() of things (and hopefully soon is_empty()
2023-05-25 10:35:21 +01:00
Tadeo Hepperle e63d618b28 Retain specific runtime APIs (#961)
* retain runtime apis

* fix ui test

* use boxed closures
2023-05-22 11:02:36 +02:00
dependabot[bot] 9980e9db72 Bump scale-info from 2.6.0 to 2.7.0 (#973)
Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.6.0 to 2.7.0.
- [Release notes](https://github.com/paritytech/scale-info/releases)
- [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md)
- [Commits](https://github.com/paritytech/scale-info/commits/v2.7.0)

---
updated-dependencies:
- dependency-name: scale-info
  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>
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
2023-05-22 09:59:33 +01:00