* 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>
* 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()
* Have a pass over metadata validation
* trait metadata; fold instead of map+for
* remove a couple of other XORs, so all uses of it are now commented
* appease clippy
* speed up ui tests by reducing number of pallets
* add small and tiny versions of polkadot metadata
* change drop implementation fix test
* rust yml add nextest and merge tests
* 2
* 3
* 4
* 5
* 6
* add script for generating files
* Upgrade to `syn 2.0` (#875)
* WIP updating to syn 2.0.0
* WIP darling compat
* Update darling and syn workspace deps
* NestedMeta::parse_meta_list
* Rename attribute keyword type property to path
* Fmt
* Update more type to path
* Unused darling
* Cargo.lock
* Add missing syn features
* Metadata V15: Generate Runtime APIs (#918)
* 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>
* rpc: Fetch metadata at version
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* artifacts: Update polkadot.scale from commit 6dc9e84dde2
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Fetch V15 using the new API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Add runtime API interface
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Hash runtime API metadata for validation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Extract runtime API metadata wrapper from subxt::Metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Adjust hashing cache to reflect root+item keys
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc: Add raw state_call API method
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* runtime_api: Add payload with static and dynamic variants
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Allow payloads to call into the runtime
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Add example to make a runtime API call both static and dynamic
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Simplify client fetching
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Address feedback and fallback to old API if needed
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* runtime_api: Make mutability conditional on input params
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Regenerate polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Retain only pallets without runtime API info
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Retry via `Metadata_metadata` without conversion
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* payload: Remove `Decode` and change validation fn
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Retain runtime API types
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Runtime APIs documentation based on flag
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update examples/examples/custom_metadata_url.rs
Co-authored-by: James Wilson <james@jsdw.me>
* Update artifacts from polkadot-a6cfdb16e9
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update polkadot.rs with polkadot-a6cfdb16e9
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Generate input structures for runtime API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* runtime_api: Remove the static paylaod and use single impl
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Fetch account nonce
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Adjust build script to fetch latest metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Check account nonce from runtime API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update cargo.lock
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Fix doc generation for runtime types
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Rename `inputs` runtime calls module to `types`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Generate Calls structs inside the types module
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Check Alice account nonce before submitting the tx
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Add metadata version option flag supporting v14 and unstable
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Specify version to fetch
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Fallback to fetching latest stable metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Add unstable-metadata feature to fetch the latest
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* RuntimeVersion with Latest and Version(u32)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Adjust fetch_metadata to inspect version list
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Adjust metadata to metadata_legacy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* events: Adjust docs to use metadata_legacy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* have a pass over fetch_metadata
* cargo fmt
* Option<String> when fetch metadata via latest API
* clippy
* fmt
* cli: Use the MetadataVersion from codegen
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Specify latest as default for MetadataVersion
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Remove version from metadata and use the one from file_or_url
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Fix clippy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Decode metadata independently for different RPC calls
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>
* add small and tiny versions of polkadot metadata
* add script for generating files
* new metadata
* Runtime APIs; don't ask for validation hash anywhere except new_static (#947)
* remove validation hash where not wanted
* .into()
* fix example
* cargo fmt
* Subxt Guide (#890)
* WIP Starting to write book; extrinsics first pass done
* cargo fmt
* Ongoing work; events, constants, wip blocks
* at_latest() and wip blocks
* remove need to import parity-scale-codec crate with Subxt for macro to work
* More docs; expanding on setup guide and finish pass of main sections
* Tidy and remove example section for now
* format book lines to 100chars
* Fix example code
* cargo fmt
* cargo fmt
* fix example
* Fix typos
* fix broken doc links, pub mods
* Update Subxt macro docs
* can't link to Subxt here
* move macro docs to Subxt to make linking better and fix example code
* note on macro about docs
* cargo fmt
* document the no_default_derives macro feature
* Address feedback and remove redundant text
* address review comments; minor tweaks
* WIP add Runtime calls to book
* Improve Runtime API docs
* expose thing we forgot to expose and doc link fixes
* use new metadata files in book
* use mtadata full in docs
* regenerate polkadot.rs
* use small metadata in a couple of places
* Update scripts/artifacts.sh
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: Andrew Jones <ascjones@gmail.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>
* 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>
* rpc: Fetch metadata at version
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* artifacts: Update polkadot.scale from commit 6dc9e84dde2
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Fetch V15 using the new API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Add runtime API interface
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Hash runtime API metadata for validation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Extract runtime API metadata wrapper from subxt::Metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Adjust hashing cache to reflect root+item keys
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc: Add raw state_call API method
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* runtime_api: Add payload with static and dynamic variants
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Allow payloads to call into the runtime
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Add example to make a runtime API call both static and dynamic
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Simplify client fetching
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Address feedback and fallback to old API if needed
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* runtime_api: Make mutability conditional on input params
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Regenerate polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Retain only pallets without runtime API info
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Retry via `Metadata_metadata` without conversion
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* payload: Remove `Decode` and change validation fn
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Retain runtime API types
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Runtime APIs documentation based on flag
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update examples/examples/custom_metadata_url.rs
Co-authored-by: James Wilson <james@jsdw.me>
* Update artifacts from polkadot-a6cfdb16e9
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update polkadot.rs with polkadot-a6cfdb16e9
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Generate input structures for runtime API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* runtime_api: Remove the static paylaod and use single impl
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Fetch account nonce
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Adjust build script to fetch latest metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Check account nonce from runtime API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update cargo.lock
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Fix doc generation for runtime types
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Rename `inputs` runtime calls module to `types`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Generate Calls structs inside the types module
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Check Alice account nonce before submitting the tx
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Add metadata version option flag supporting v14 and unstable
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Specify version to fetch
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Fallback to fetching latest stable metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Add unstable-metadata feature to fetch the latest
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* RuntimeVersion with Latest and Version(u32)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Adjust fetch_metadata to inspect version list
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Adjust metadata to metadata_legacy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* events: Adjust docs to use metadata_legacy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* have a pass over fetch_metadata
* cargo fmt
* Option<String> when fetch metadata via latest API
* clippy
* fmt
* cli: Use the MetadataVersion from codegen
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Specify latest as default for MetadataVersion
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Remove version from metadata and use the one from file_or_url
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Fix clippy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Decode metadata independently for different RPC calls
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>
* 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
* Update cargo.lock to use scale-info v2.4.0
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Retain only a subset of the metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Generate top level Event
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Only retain DispatchError
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Export just the retain method
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Retain pallets
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Do not include extrinsic metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* retain: Fix clippy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* test-runtime: Generate per pallet metadata and rs file
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* ui-tests: Check per metadata generated files
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Revert "test-runtime: Generate per pallet metadata and rs file"
This reverts commit 725a2e5f8339a795892dbbd2df19e49330ae3a9b.
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* ui-tests: Adjust path to metadata file
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* ui-tests: Change drop order to keep `PalletMetadata` around
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update metadata/src/retain.rs
Co-authored-by: James Wilson <james@jsdw.me>
* Address feedback
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* retain: Keep extrinsic type
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Introduce `MetadataSource`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Use `MetadataSource` helper
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Use `FileOrUrl` flatten command argument
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* retain: Do not include generic type params in retained metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Adjust subxt to scale-info v2.5.0
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update scaleinfo to v2.5.0
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Remove deprecated fn
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Fix clippy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* benches: Use inner fields of scale info
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* address nits, and strip RuntimeCall type instead of trying to filter out use of it for better overall wins/clarity
* fix UI test
* move utils out of commands folder and fix clippy etc
* address nits
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>
* Add Static type which defers to Encode/Decode and impls EncodeAsType/DecodeAsType
* rename to static_type and impl Deref/Mut
* Improve type substitution in codegen so that concrete types can be swapped in
* A couple of comment tweaks and no need for a macro export
* Extend type substitution logic to work recursively on destination type
* cargo fmt
* Fix a couple of comments
* update ui test outpuot
* Add docs and missing_docs lint
* Add test for replacing multiple of Ident
* Update codegen/src/error.rs
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
* update copyright year and fix ui test
* simplify another error
---------
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
* chore: use workspace inheritance for package info
* add rust-version field into workspace package
* .workspace = true
---------
Co-authored-by: James Wilson <james@jsdw.me>
* begin porting over traits; remove Config use of Hash
* port over the Header bits that we need
* sp_core_hashing where possible, move Verify to PairSigner, remove unused errors
* tidy up Config things and move related bits into one place
* fix codegen
* copy Era over
* move AccountId, Address, Signer to Signer trait and a pass over fixing examples
* impl MultiAddress, MultiSignature, AccountId32 and add back to Config (for decoding later)
* Copy over StorageKey, StorageData, StorageChangeSet
* subxt core compiling with no sp_core or sp_runtime
* Get examples compiling
* pass over fixing tests
* cargo fmt
* clippy tweaks and update polkadot.rs
* fix codegen docs
* port over special DigestItem encoding/decoding
* clippy and doc fixes
* cargo fmt and example fix
* more cargo fmt-ing...
* substrate-extra to substrate-compat
* cargo.toml comments
* simplify PairSigner trait bounds
* move RPC types to a separate file
* fix docs
* Add some tests for things and other PR feedback
* bump to latest sp deps
* avoid needing substrate-compat feature in a test
* Patch all substrate deps to use my substrate branch
* default-features = false causing issus in test-runtime
* Use substrate polkadot release branch
* Use default-features for sp-runtime again :(
* Restore default-features for subxt-cli/sp-core
* Fix module error integration test
* Add Send + Sync bounds to ExtrinsicEvents::iter()
* Elide lifetime
* Revert adding Send + Sync
* Add Sync bound to Rpc::ClientError
* Remove version in subxt-metadata
* Use released crates
* Use released sp-keyring
* Fix sp-keyring deps
* Remove unnecessary sp-keyring default-features = false
* metadata: Exclude `field::type_name` from metadata validation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Adjust code-base to rust `1.62.0`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Add integration-tests feature flag
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Guard integration tests under feature flag
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* test-runtime: Place build.rs under feature flag
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Pass `integration-tests` feature to `test-runtime`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* CI: Use `integration-tests` feature to run all tests
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Rely on `#[cfg(feature = "integration-tests")]` for integration
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt/metadata: Manually construct test metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* artifacts: Move scale binary blob to dedicated folder
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Update path to metadata blob
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Rely on artifact metadata blob for benches
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* metadata: Remove `test-runtime` dependency
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Modify runtime path for `custom_type_derives`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Remove tests folder
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* test-runtime: Remove `integration-tests` feature flag
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* integration-tests: Add an integration test crate for subxt
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Remove `test-runtime` dependency
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Add comment for feature flags
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* integration-tests: Trim dependencies
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* integration-tests: Move dependencies under dev
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Revert "CI: Use `integration-tests` feature to run all tests"
This reverts commit 8e5f38ba8c633ac40420fadf58700ac402f762d4.
* integration-tests: Remove integration folder
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Fix feature flag and test comment
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Extra feature flag comment
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* integration-tests: Move tests content under src
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* 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>