Commit Graph

24 Commits

Author SHA1 Message Date
Igor Matuszewski f0ce26db7b Add bitvec-like generic support to the scale-bits type for use in codegen (#718)
* Add bitvec-like generic support to the scale-bits type for use in codegen

* Use nightly 1.66 formatting

* Fix reading input while decoding bit sequences

* Add tests for our DecodedBits wrapper

* Add convenience DecodedBits::(in)to_bits functions

* Don't expose DecodedBits::bit_format

* Re-export scale_bits as peer dependency

* Move subxt::utils into a separate file

* Hide DecodedBits internals

* Don't re-export types from the `bits` module

* Update subxt/src/utils/bits.rs

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

* Update subxt/src/utils/bits.rs

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

* Address review feedback

* Clarify the byte needed calculation in DecodedBits encoding

* Remove remaining dbg! invocations

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2022-11-24 15:09:20 +01: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
James Wilson d03e599684 Add runtime_metadata_url to pull metadata directly from a node (#689)
* Allow metadata to be pulled directly from a node with runtime_metadata_url

* Update docs

* https too, and abstract out block_on fn

* tweak a comment in the example
2022-10-19 11:07:12 +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
James Wilson c55b7ba3e3 dual license (#590) 2022-06-28 14:09:41 +01: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
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 b32cd32c2d Use minimum amount of dependencies for crates (#524)
* macro: Reduce dependencies

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

* macro: Remove dev-dependencies

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

* codegen: Reduce dependencies

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

* subxt: Reduce dependencies

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2022-04-29 15:35:16 +01:00
Andrew Jones 24317b4311 Add custom derives for specific generated types (#520)
* WIP implement custom derives per type

* WIP wiring up specific type derives

* Fmt

* Rename GeneratedTypeDerives to Derives

* Fmt

* Fix errors

* Fix test runtime

* Make derives appear in alphabetic order

* Clippy

* Add derive_for_type attribute to example

* Add docs to example

* Rename GeneratedTypeDerive

* Rename ty to type in attribute

* Update darling

* Update codegen/src/types/derives.rs

Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>

* Update codegen/src/types/mod.rs

Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>

* Update codegen/src/types/mod.rs

Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>

* review: update method name

* Add unit tests for combined derives

* Remove out of date docs

* Add macro usage docs

Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
2022-04-28 12:26:34 +01: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
James Wilson dffeee431e Release prep for 0.20.0 (#502)
* v0.20.0 release prep

* wee text tweak

* remove dry-run step that doesn't actually work

* Fix typo

Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>

* No more "in"

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

* Fix "customized" typo

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

Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>
2022-04-06 16:42:10 +01:00
James Wilson 3758c850f3 Release prep for 0.19.0 (#481)
* prep to release 0.19.0

* fix URLs to https
2022-03-21 11:24:04 +00:00
James Wilson 14ef6c8256 Bump to 0.18.1 (#467) 2022-03-04 11:57:00 +00:00
Alexandru Vasile 3baaa01fb1 Release preparation for v0.18.0 (#464)
* Bump release version to v0.18.0

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

* Update changelog

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

* Update dependency version to v0.18.0

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

* Modify changelog

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

* Move changelog entries from added to changed
2022-03-02 21:02:38 +02:00
Andrew Jones 11f24d78f7 Update scale-info and parity-scale-codec requirements (#462)
* Update scale-info and parity-scale-codec requirements

* Update CHANGELOG

* Update frame-metadata

* Update bitvec

* Fix test

* Update bitvec event decoding

* More bitvec updates

* Update substrate primitives dependencies

* Fix up bitvec errors and decode error

* Fix up bitvec errors

* Update polkadot codegen
2022-03-01 16:36:38 +00:00
Andrew Jones 4bed7eb716 Fix conversion of Call struct names to UpperCamelCase (#441)
* Fix conversion of `Call` struct names to UpperCamelCase

* Update to latest heck and use ToUpperCamelCase
2022-02-10 13:10:27 +00:00
Alexandru Vasile e9be43aaff Release preparation for v0.17.0 (#434)
* lib: Export `GenericError` to avoid linking to private items

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

* Bump version to v0.17.0

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

* doc: Add crates to bump

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

* Update changelog

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

* changelog: Add new line between title and list

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

* releasing: Remove extra closing bracket

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

* releasing: Fix cargo install typo for cargo-hack

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

* Remove subxt version from macro and test-runtime

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

* releasing: Change PR link to sort in descending order

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

* changelog: Add missing PR

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2022-02-04 15:44:56 +02:00
David 667dfa291c Release prep for v0.16.0 (#417)
* Draft changelog

* Bump (and normalize version): v0.16.0

* Update changelog

* Update Cargo.toml

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

* Add not about 0.16 being disruptive

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2022-02-01 10:48:41 +00:00
Andrew Jones da8ec3d737 Release initial versions of subxt-codegen and subxt-cli (#320)
* Bump codegen and cli to 0.2

* Add CLI README.md
2021-11-15 09:27:04 +00:00
Andrew Jones 78fd590d17 Add missing cargo metadata fields for new crates (#311) 2021-11-09 09:36:58 +00:00
Andrew Jones 793c945fbd Generate runtime API from metadata (#294)
* Remove test macro

* Remove client crate

* Create tests crate and move pallet specific tests there

* Extract client, remove metadata and extra, more demolition

* Update substrate dependencies to git dependencies

* Remove Store stuff for now

* Comment out some Call usages

* Add back Runtime trait coped from original System trait

* Make subxt lib compile

* Delete old proc macros and copy over type generation from chameleon

* WIP make transfer balance test pass

* Change to subxt attribute macro

* WIP provide user defined type substitutes

* User defined type substitutes compile

* WIP submitting transactions

* WIP transfer balance test

* Fix macro

* Cargo fmt

* WIP generating storage hashers

* WIP add AccountData trait for fetching the nonce

* Support single type storage map keys

* WIP impl AccountInfo retrieval

* Fix up storage struct generation

* Implement AccountData triait directly on storage entry

* Borrow storage map key and convert account id

* Implement storage fetch client methods

* Remove legacy metadata storage key construction

* Rename CheckEra to CheckMortality

* Substitute perthings types for compact impls

* Fmt

* Downgrade dyn-clone for cargo-contract compat

* Scale-fo 1.0

* scale-info 1.0

* Remove special range handling

* Restore wildcard type params

* Frame metadata 14.0

* WIP decoding events

* WIP more dynamically decoding events

* Fmt

* Decode events, handle errors

* Uncomment some tests

* Remove unused get_mod function

* Fix some warnings

* Fix some more warnings

* Fix some more warnings

* Add tests mod

* Rename node-runtime tests mod to frame

* Fix some warnings

* Fmt

* WIP generate storage client with getters

* Storage client compiling

* Generate storage client api

* Fix up system account query account ids

* WIP generating tx api fns

* Only generate tx api fields when calls available

* Fix tx api call fns

* Fmt

* WIP generate event structs

* call functions not async

* Derive Eq for comparison on generated types

* Generate event structs

* Fix call name

* Fmt

* Update node runtime metadata to substrate c000780db

* Download latest substrate release for integration testing

* Fix event decoding

* Remove unused imports

* Fix plain storage access, total_issuance pass

* Fmt

* Restore contracts tests

* Backoff connecting to substrate node

* Add required TypeInfo impls for local SignedExtension impls

* Remove unnecessary assert formatting

* Fix handling of DispatchError

* Refactor contracts tests

* Troubleshooting contract not found

* Remove more client feature stuff

* Fix dynamic event variant decoding, write consumed index to output

* Fmt

* Use substrate branch with heavy dependency removed

* Remove sp-rcp dependency, define types locally

* Ignore cargo timeing files

* Use my branch for substrate test deps

* Fix storage key type gen

* Comment out fetching contract info

* Add key iteration, extract storage client from main client

* Debugging key generation

* Use substrate master branch

* Fix call test

* Remove TypeSegmenter and dynclone dependency

* Publicly expose Rpc mod

* Unused import warnings

* Add getter for runtime metadata

* Add pallet and event indices for raw events

* Add is_call and is_event convenience trait functions

* Add missing docs

* Refactor tests crate

* Restore remaining client tests

* Fmt

* Fix warnings

* Restore get_mod as test helper and fmt

* Use client references for api calls

* Fix api usages with methods

* Use Bytes for RawEvent debug

* Update metadata

* Restoring some Balances tests

* Populate runtime storage metadata

* Restore balances lock test

* Restore Balances error test

* Fmt

* Restore transfer subscription API

* Staking test

* Restore another staking test

* Restore another staking test

* Restore another staking test

* Partially restore chill_works_for_controller_only staking test

* Fix fetching Optional storage entries

* Restore staking bond test

* Restore remaining staking tests

* Fmt

* Restore sudo tests

* Add some system tests

* Fmt

* Resolve some todos

* Remove pass through rpc methods on Client, expose via rpc() getter

* Remove more rpc pass through methods

* Remove submit tx pass through rpc methods

* Add some comments to SubmittableExtrinsic methods

* Construct the runtime api from the client

* Fmt

* Use From trait instead of new for AccountData query

* Rename subxt_proc_macro crate to subxt_macro

* Fix AccountData From impl

* Extract codegen crate from macro crate

* Fmt

* Replace chameleon hidden field name

* Extract StructDef for generating structs

* More refactoring of StructDef, moving towards sharing with typegen

* Replace explicit tests crate with single implicit integration tests crate

* Rename from substrate-subxt to subxt

* Fix runtime path relative to root Cargo.toml

* Move RpcClient creation to RpcClient

* WIP get examples to compile

* Rename Runtime to Config trait

* WIP implementing default Config

* WIP implementing default extrinsic extras

* fix metadata constants (#299)

* Move DefaultConfig definition and impl to macro

* Extract type substitute parsing to ir mod

* Extract calls, events and storage from api generation

* Add some hardcoded type substitute defaults

* Fmt

* Add utility pallet tests (#300)

* add batch call test example

* add pallet utility tests

* add utility module

* fix warnings

* Add polkadot runtime metadata for example

* Fix system errors and fmt

* Add subxt-cli crate

* Add metadata and codegen subcommands

* Make subxt-cli codegen command work

* Fmt

* Add polkadot codegen test

* Comment about how to run codegen

* Derive AsCompact for structs with single concrete unsigned int field

* Fix bitvec codegen, adds as non optional dependency

* Regenerate polkadot api with bitvec fix

* Edition 2021

* Fix polkadot codegen with bitvec

* Polkadot balance transfer is working

* Fix fetch remote

* Fix transfer_subscribe example

* Fix submit_and_watch example

* Fmt

* Generate storage iter method for iterating over keys

* Fmt

* Fix existential deposit test

* Fix staking tests

* Add option for custom generated type derives

* Add generated type derives for test runtime api

* Fmt

* Copy WrapperTypeOpaque from substrate, add Encode/Decode

* Fmt

* Extract type generator to module, separate & fix tests

* Fully qualified primitive and prelude types

* Fix up remaining type gen tests

* Skip formatting of generated polkadot example code

* Remove empty utility test file.

* Newline

* Update cli/src/main.rs

Co-authored-by: David <dvdplm@gmail.com>

* Rename subxt-cli executable to subxt

* Update src/client.rs

Co-authored-by: David <dvdplm@gmail.com>

* Add some code docs to TypeGenerator.

* Extract TypePath to own file

* Extract type def generation to separate file

* Renamed ModuleType to TypeDefGen

* Fmt

* Factor out type parameter from final_key

* Fix some type paths

* Resolve some todos

* Resolve some panic todos in events

* Add EventsDecodingError

* Decode compact composite types with a single primitive field

* Decode compact composite types with a single primitive field

* Update src/metadata.rs

Co-authored-by: Andrew Plaza <aplaza@liquidthink.net>

* Remove Perbill compact substitute types

* Remove todos regarding maintaining Rust code items, promoted to follow up issue.

* Remove todo regarding overridding default config impl

* Remove todo regarding overridding default Extra

* Remove todo regarding AccountData storage type defintion

* Remove todo regarding borrowing storage key arguments

* Remove type substitution tests todo

* Remove `Box` field name type hack todo

* Remove Compact todo

* Remove sudo todos

* Remove BitVec implementation todo

* Fmt

* Add health warning to README

* Fix up health warning

Co-authored-by: Paulo Martins <paulormart@users.noreply.github.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: Andrew Plaza <aplaza@liquidthink.net>
2021-11-03 11:28:59 +00:00