* subxt: Add subscription to runtime upgrades
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Synchronize and expose inner `RuntimeVersion` of the `Client`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Add runtime update example
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Expose `RuntimeVersion` as locked
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Expose `Metadata` as locked
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt/storage: Use locked metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Use parking lot RwLock variant for locked metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Utilize locked metadata variant
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt/transaction: Use locked metadata variant
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update subxt to use locked version of the Metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Add runtime update client wrapper
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Modify runtime update example
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Fix clippy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Fix cargo check
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Keep consistency with cargo check fix
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Remove unnecessary Arc
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Remove MetadataInner and use parking_lot::RwLock
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update polkadot.rs generation comment
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Switch to async::Mutex
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Block executor while decoding dynamic events
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Use async API to handle async locking
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Remove unused dependencies
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update examples and integration-tests
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Fix test deadlock
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Revert back to sync lock
Revert "Fix test deadlock"
This reverts commit 4a79933df23e81573611cb14be6c5b5b2b56d4df.
Revert "Update examples and integration-tests"
This reverts commit 5423f6eb4131582909d5a4ca70adff75e27cdd0e.
Revert "Remove unused dependencies"
This reverts commit e8ecbabb5b01a7ba4ae83b8bde36295a3f64daf7.
Revert "codegen: Use async API to handle async locking"
This reverts commit ced4646541c431adcb973369b1061b7b3cbfaae1.
Revert "subxt: Block executor while decoding dynamic events"
This reverts commit 8b3ba4a5eabb29f77ac1ca671450956fc479a33d.
Revert "subxt: Switch to async::Mutex"
This reverts commit f5bde9b79394a6bf61b6b9daefc36ceaa84b82be.
* subxt: Perform RuntimeVersion update before fetching metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Reintroduce MetadataInner
* Use parking lot instead of std::RwLock
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Reduce lock metadata time when decoding events
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Update `validate_metdata` locking pattern
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt/examples: Update polkadot download link
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* tests: Wrap metadata in a helper function
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update examples/examples/subscribe_runtime_updates.rs
Co-authored-by: James Wilson <james@jsdw.me>
* subxt/updates: Update runtime if version is different
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>
* 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>
* 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>
* codegen: Propagate documentation for Constants
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Propagate documentation for `CompositeDef` wrapper
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Propagate docs for enum variant of `CompositeDef` wrapper
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Propagate docs for Storage entries
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Move docs from internal structs to methods of StorageApi
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Propagate the same docs for storage iter variants
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Move docs from call structs to methods of TransactionApi
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Handle new errors of type [u8; 4] with backwards compatibility
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Add comments about the compatibility of `DispatchError::Module`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Handle legacy cases appropriately
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Introduce `ModuleErrorType` for compatibility versioning
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Implement `module_error_type` helper
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Implement `quote::ToTokens` for `ModuleErrorType`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Rename new error to ArrayError
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Add strict checks for ModuleError
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Fix cargo fmt
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen, subxt: Expose the error's raw bytes to user
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Update polkadot with ModuleErrorRaw
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Rename `ModuleErrorRaw` to `ModuleErrorData`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Expose method to obtain error index
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Rename `ModuleErrorRaw` to `ModuleErrorData`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* WIP extrinsic api updates
* First pass done; now to get things compiling again
* document and tweak new structs/traits
* cargo check --all-targets now compiles without issue
* Polkadot and Substrate take different extra params; support both
* Fix transaction format (missing byte from AccountId -> Address) and fmt
* Tweak Signer trait
* Tweak comments and such in extrinsic params
* check all examples against newer polkadot, add new one with params, import path tweaks
* clippy fix, and save an allocation when signing
* Remove unnecessary Default clauses
* Tidy up and fix comments. Panic if payload size >4GB
* fix typo
* remove code related to getting nonce from storage and use RPC call instead
* cargo fmt
* move nonce fetching into Rpc, since it's just an RPC call
* clippy
* make subscription stream generic in EventSubscription
* rename to EventSub/FinalizedEventSub
* wip fix some lifetimes so that event sub can depend on client in stream
* Cargo fmt + comment tweaks
* Add another comment
* factor out prev block header fetching into a separate function to tidy
* add a comment
* remove ListOrValue as it's unused
* Into<u128> on BlockNumber to simplify things
* clippy
* Fix an example and clippy
* simplify iterator now we are Into<u128>
* Into<u64> instead because it needs serializing, and test core logic
* Tweak missing block test to fill in >=2 holes
* tweak a comment
* codegen: Update polkadot.rs
polkadot commit-hash: d96d3bea85
polkadot tag: v0.9.16-rc2
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Reference key storage api
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Regenerate polkadot.rs with reference api
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* tests: Update tests with reference interface
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Fix polkadot.rs license check
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Update polkadot.rs with copyright
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Revert "codegen: Update polkadot.rs with copyright"
This reverts commit 2970d0573dc0b11d01072b270a525ad497992ddf.
Revert "cli: Fix polkadot.rs license check"
This reverts commit 6fe8818582ae39669c059c1ed0424b6606620295.
* codegen: Implement AccountData trait in the expected order
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Store implementation of StorageEntry
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Generate AccountDefaultData wrapper struct
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Allow `Account` references
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Utilize AccountDefaultData instead of Account
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* tests: Update tests to utilize `Account` reference
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Rename AccountDefaultData to AccountOwned
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Add comments for wrapper account
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Obtain vector type parameter for TypePath::Type
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Use slices instead of `& std::vec` in storage API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Fix documentation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* tests: Remove extra reference
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Add staking example to exercise storage API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* tests: Update storage tests
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Fix cargo clippy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Simplify vec_type_param
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Rename staking_details.rs to fetch_staking_details.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* tests: Remove dummy variable
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Update polkadot version
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Apply rust-fmt
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Regenerate polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Remove comment
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Distinct handling for N fields + 1 hasher vs N fields + N hashers
* tweak comment
* cargo fmt
* fix typo
* Add a few storage specific tests
* clippy fixes
* cargo fmt
* Add a test to specifically address this fix
* comment typo
* Address niggles
* slgihtly nicer iter code
* Substitute BTreeMap/BTreeSet for Vec
* regen code
* cargo fmt
* undo test tweak since not substituting bounded things at the mo
* add a couple of comments
* Add error information back into metadata to roll back removal in #394
* Go back to obtaining runtime error info
* re-do codegen too to check that it's all gravy
* Convert DispatchError module errors into a module variant to make them easier to work with
* Fix broken doc link
* ModuleError is now a tuple variant
* more robust pointer to DispatchError
* backward compat
* clippy
* cargo fmt
* abort_call_site and simplify path comparison
* clippy
* Add reworked event types
* first pass implementing event subscriptions
* make clear that some methods are private
* comment tidy
* use Events in transaction stuff
* align transaction and event APIs
* remove __private_ prefixes; they are ugly
* fix examples and remove old events and subscription code
* better comments on hidden event functions
* re-add find_first_event; it's used a bunch in tests and examples
* cargo check --all-targets now passes
* Fix up existing event tests
* cargo fmt
* change todo to note
* clippy and doc niggles
* revert to find_first_event
* Add specific subscription related tests
* cargo fmt
* Update tests and add/fix examples
* cargo fmt
* add a little to subscribe_all_events example
* cargo fmt
* move an example comment
* easy access to root mod for more clarity
* add a couple of tests to ensure that events properly decoded until naff bytes
* Simplify EventSubscription Stream impl a little
* Address some PR feedback
* WIP DispatchError generic param
* main crate now compiling with new E generic param for DispatchError
* Remove E param from RpcClient since it doesn't really need it
* Point to generated DispatchError in codegen so no need for additional param there
* More error hunting; cargo check --all-targets passes now
* Use our own RuntimeVersion struct (for now) to avoid error decoding into sp_version::RuntimeVersion
* cargo fmt
* fix docs and expose private documented thing that I think should be pub
* move error info to compile time so that we can make DispatchError a little nicer to work with
* cargo fmt
* clippy
* Rework error handling to remove <E> param in most cases
* fix Error doc ambiguity (hopefully)
* doc tweaks
* docs: remove dismbiguation thing that isn't needed now
* One more Error<E> that can be a BasicError
* rewrite pallet errors thing into normal loops to tidy
* tidy errors codegen a little
* tidy examples/custom_type_derives.rs a little
* cargo fmt
* silcnce clippy in example
* WIP Implementing new event subscription API
* back to lifetimes, fix example
* no more need for accept_weak_inclusion
* thread lifetime through to prevent 'temporary dropped' issue
* make working with events a little nicer
* Get tests compiling
* fmt and clippy
* _name back to name
* dont take ownership, just have stronger note
* Attempt to fix test
* remove commented-out code
* Add a couple more helper methods and a test
* Remove custom ExtrinsicFailed handling; treat them like other events
* Handle runtime errors in TransactionProgress related bits
* cargo fmt + clippy
* Fix some of the failing tests
* remove unused import
* fix transfer_error test
* Fix compile errors against new substrate latest
* Comment tweaks, and force test-runtime rebuild
* Drop the TransactionProgress subscription when we hit 'end' statuses
* cargo fmt
* find_event to find_first_event and helper to return all matching events
* TransactionProgressStatus to TransactionStatus
* Copy and improve docs on TransactionStatus from substrate
* debug impl for Client to avoid manual debug impls elsewhere
* Add and tweak comments, specifically a note about block inclusion on errors
* clippy + fmt
* Fix docs
* Ignore 'error' statuses and adhere to the substrate docs
* tweak and improve some comments per @dvdplm's suggestions
* Break transaction* structs into separate file
* fmt and fix doc link
* Make system properties an arbitrary JSON object
* Add comment
* Make timestamp test more reliable
* Fmt
* Update src/client.rs
Co-authored-by: David <dvdplm@gmail.com>
* Update src/client.rs
Co-authored-by: David <dvdplm@gmail.com>
* Fix clippy errors and warnings
* Fix tests
Co-authored-by: David <dvdplm@gmail.com>
* Check docs, clippy, test run
* test parallel CI adapted from other package; is it faster?
* Remember to download substrate
* Nightly for cargo fmt
* Standardise CI names
* fix clippy complaints
* Ensure docs are valid and export publicly accessible types
* all-targets clippy, and fix additional lint errors
* newline in ci file
* 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>