* 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>
* WIP EncodeAsType and DecodeAsType
* remove silly cli experiment code
* Get things finally compiling with EncodeAsType and DecodeAsType
* update codegen test and WrapperKeepOpaque proper impl (in case it shows up in codegen)
* fix tests
* accomodate scale-value changes
* starting to migrate to EncodeAsType/DecodeAsType
* static event decoding and tx encoding to use DecodeAsFields/EncodeAsFields
* some tidy up and add decode(skip) attrs where needed
* fix root event decoding
* #[codec(skip)] will do, and combine map_key stuff into storage_address since it's all specific to that
* fmt and clippy
* update Cargo.lock
* remove patched scale-encode
* bump scale-encode to 0.1 and remove unused dep in testing crate
* update deps and use released scale-decode
* update scale-value to latest to remove git branch
* Apply suggestions from code review
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
* remove sorting in derives/attr generation; spit them out in order given
* re-add derive sorting; it's a hashmap
* StaticTxPayload and DynamicTxPayload rolled into single Payload struct
* StaticStorageAddress and DynamicStorageAddress into single Address struct
* Fix storage address byte retrieval
* StaticConstantAddress and DynamicConstantAddress => Address
* Simplify storage codegen to fix test
* Add comments
* Alias to RuntimeEvent rather than making another, and prep for substituting call type
* remove unnecessary clone
* Fix docs and failing UI test
* root_bytes -> to_root_bytes
* document error case in StorageClient::address_bytes()
---------
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
* feat!: Allow for remapping type parameters in type substitutions
* chore: cargo fmt
* chore: cargo clippy
* chore: Remove some old code
* a little tidy
* address comment nit
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
* refactor: Simplify collecting type substitutes
* Simplify ItemMod::from
* Preserve inner Rust items when expanding the subxt::subxt macro
* No named lifetimes
* Update codegen/src/api/mod.rs
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* Move passing UI tests under `ui_tests`
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* 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>
* 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
* Add failing test for compact generic parameter
* WIP refactor type generation
* Fmt
* Remove deprecated rustfmt optionns
* Remove license template path
* Update parent type parameter visitor
* Introduce different methods for generating a type path for a field
* Add comment
* Fix weights refs
* Add extra compact test cases
* Fmt
* WIP API changes
* debug impls
* Get main crate compiling with first round of changes
* Some tidy up
* Add WithExtrinsicParams, and have SubstrateConfig + PolkadotConfig, not DefaultConfig
* move transaction into extrinsic folder
* Add runtime updates back to OnlineClient
* rework to be 'client first' to fit better with storage + events
* add support for events to Client
* tidy dupe trait bound
* Wire storage into client, but need to remove static reliance
* various tidy up and start stripping codegen to remove bits we dont need now
* First pass updating calls and constants codegen
* WIP storage client updates
* First pass migrated runtime storage over to new format
* pass over codegen to generate StorageAddresses and throw other stuff out
* don't need a Call trait any more
* shuffle things around a bit
* Various proc_macro fixes to get 'cargo check' working
* organise what's exposed from subxt
* Get first example working; balance_transfer_with_params
* get balance_transfer example compiling
* get concurrent_storage_requests.rs example compiling
* get fetch_all_accounts example compiling
* get a bunch more of the examples compiling
* almost get final example working; type mismatch to look into
* wee tweaks
* move StorageAddress to separate file
* pass Defaultable/Iterable info to StorageAddress in codegen
* fix storage validation ne, and partial run through example code
* Remove static iteration and strip a generic param from everything
* fix doc tests in subxt crate
* update test utils and start fixing frame tests
* fix frame staking tests
* fix the rest of the test compile issues, Borrow on storage values
* cargo fmt
* remove extra logging during tests
* Appease clippy and no more need for into_iter on events
* cargo fmt
* fix dryRun tests by waiting for blocks
* wait for blocks instead of sleeping or other test hacks
* cargo fmt
* Fix doc links
* Traitify StorageAddress
* remove out-of-date doc comments
* optimise decoding storage a little
* cleanup tx stuff, trait for TxPayload, remove Err type param and decode at runtime
* clippy fixes
* fix doc links
* fix doc example
* constant address trait for consistency
* fix a typo and remove EncodeWithMetadata stuff
* Put EventDetails behind a proper interface and allow decoding into top level event, too
* fix docs
* tweak StorageAddress docs
* re-export StorageAddress at root for consistency
* fix clippy things
* Add support for dynamic values
* fix double encoding of storage map key after refactor
* clippy fix
* Fixes and add a dynamic usage example (needs new scale_value release)
* bump scale_value version
* cargo fmt
* Tweak event bits
* cargo fmt
* Add a test and bump scale-value to 0.4.0 to support this
* remove unnecessary vec from dynamic example
* Various typo/grammar fixes
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
* Address PR nits
* Undo accidental rename in changelog
* Small PR nits/tidyups
* fix tests; codegen change against latest substrate
* tweak storage address util names
* move error decoding to DecodeError and expose
* impl some basic traits on the extrinsic param builder
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
* 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>
* codegen: Composite fields docs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Propagate docs for Event type
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Propagate docs for calls module
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 `TypeDefGenKind::Enum` kind
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen/tests: Recursively obtain raw metadata documentation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen/tests: Generate runtime interface from node metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen/tests: Obtain documentation from generated runtime API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen/tests: Match raw documentation with the generated one
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Revert not longer needed "codegen: Composite fields docs"
This reverts commit 5460bbafc6262ac4f53e11d4ef11e44e1ce8296f.
* codegen/tests: Improve test regex documentation
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.
* codegen: Move documentation test to integration crate
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen_documentation: Add license + fmt
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update `polkadot.rs`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Move test under `testing` folder
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update testing/integration-tests/src/codegen/codegen_documentation.rs
Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>
Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>
* 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