* Move Extrinsic decoding things to subxt_core and various tidy-ups
* A couple more fixes and fmt
* first pass moving tx logic to subxt_core
* cargo fmt
* fix wasm example
* clippy
* more clippy
* WIP Adding examples and such
* Move storage functionality more fully to subxt_core and nice examples for storage and txs
* Add example for events
* consistify how addresses/payloads are exposed in subxt-core and add runtime API fns
* Add runtime API core example
* fmt
* remove scale-info patch
* Add a little to the top level docs
* swap args around
* clippy
* cargo fmt and fix wasm-example
* doc fixes
* no-std-ise new subxt-core additions
* alloc, not core
* more no-std fixes
* A couple more fixes
* Add back extrinsic decode test
* storage_type: Strip key proper hash and entry bytes (32 instead of 16)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* storage_type: Fix typo
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* storage/tests: Check keys decode properly and don't cause errors
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update testing/integration-tests/src/full_client/storage/mod.rs
Co-authored-by: James Wilson <james@jsdw.me>
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>
* start migrating, broken
* first iteration of updating
* fmt and clippy
* add Composite<u32> decoding via scale value patch
* bump scale type gen versions
* fix decoding with new scale decode
* compiling with changed deps
* core utils, condig, client, metadata
* core crate compiling
* signer crate no once lock
* add core to no-std-tests, change imports
* broken commit, start pulling everything together in subxt
* port more things to subxt
* events in core crate, extrinsics sadly much more difficult
* almost all examples pass again
* dynamic values fix in examples
* fix no std issue and fmt
* remove unused dependencies
* fix lightclient impl
* runtime version refactor
* formatting and addressing nits
* more comments addressed
* update wasm example and no-std-signer tests
* other nits and error impl on signer errors
* fix feature flag
* fix runtime version refactor
* fix doc links
* fix integration tests
* fix feature flag gated client state
* fix native feature in CI
* fix lightclient utils
* make imports more lean in subxt-core
* integrate changes from subxt-core imports into subxt
* other changes in subxt simplify imports more
* fix and docs
* doc false for cli
* fix clippy
* remove events block hash in tests
* codegen no-std support in generated code
* export alloc crate for no-std codegen
* fix doc test
* implement James comments
* remove std traits, use core traits instead
* address nits
* remove unusued dep in no-std tests
* fix Box import in no_std
* sp-crypto-hashing instead of sp-core-hashing
* bump scale-typegen, add no std codegen tests
* fix some things
* replace unmaintained derivative with derive_where to remove non-canonical warnings
* fmt
* remove unused dep
* fix deps
* update artifacts to fix type ID mismatches
* bump to latest scale-typegen
---------
Co-authored-by: James Wilson <james@jsdw.me>
* WIP second pass over light client code for simpler API
* First pass new light client
* pub(crate) LightClientRpc::new_raw(), and fmt
* Update examples and add back a way to configure boot nodes and fetch chainspec from a URL
* Fix light client examples
* remove unused deps and tidy lightclient feature flags
* fix wasm error
* LightClientRpc can be cloned
* update light client tests
* Other small fixes
* exclude mod unless jsonrpsee
* Fix wasm-lightclient-tests
* add back docsrs bit and web+native feature flag compile error
* update book and light client example names
* fix docs
* new workflow and adjust node builder
* fix examples by fixing artifacts script
* use-nodes instead of use-substrate
* update yamls
* build polkadot
* remove the on-push trigger again, now that polkadot built in the CI
* add default implementation again
* integrate scale-typegen, remove types mod
* reintroduce default substitutes and derives
* support runtime_types only again
* generating polkadot.rs ok
* update scale-typegen to discrete error types
* scale-typegen-api-changes
* add note about UncheckedExtrinsic in default substitutes
* add resursive attributes and derives
* adjust example where Clone bound recursive
* move scale-typegen dependency to workspace
* expose default typegen settings
* lightclient: Fix wasm socket closure called after being dropped (#1289)
* lightclient: Close wasm socket while dropping from connecting state
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* lightclient: Construct one time only closures
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Enable console logs for lightclient WASM testing
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* lightclient: Separate wakes and check connectivity on poll_read
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* lightclient: Close the socket depending on internal state
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Revert "lightclient: Separate wakes and check connectivity on poll_read"
This reverts commit 866094001d4c0b119a80ed681a74b323f74eae1b.
* lightclient: Return pending if socket is opening from poll_read
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* lightclient: Close the socket on `poll_close`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* lightclient: Reset closures on Drop to avoid recursive invokation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* lightclient: Close the socket if not already closing
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* workflows: Install rustup component for building substrate (#1295)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Command to fetch chainSpec and optimise its size (#1278)
* cli: Add chainSpec command
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli/chainSpec: Move to dedicated module
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Compute the state root hash
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Remove code substitutes
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* artifacts: Update polkadot.json
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* scripts: Generate the chain spec
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Remove testing artifacts
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Fix clippy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Apply rustfmt
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Introduce feature flag for smoldot dependency
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli: Rename chain-spec to chain-spec-pruning
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* scripts: Update chain-spec command
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* remove comments and unused args
* Update substrate- and signer-related dependencies (#1297)
* update crypto dependencies, adjust keypair
* add scale_info::TypeInfo derive in some places
* add multi signature derive
* fix lock file
* fix lock file again :|
* adjust to new interface in scale-typegen
* use released scale typegen
* reintroduce type aliases
* introduce type aliases again using scale-typegen
* cargo fmt and clippy
* reconcile changes with master branch
* update polkadot.rs
* bump scale-typgen to fix substitution
* implemented Alex suggestions, regenerated polkadot.rs (did not change)
* resolve conflicts in Cargo.lock
* make expect messages more clear
* correct typos
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
* codegen: Generate type alias for storage return types
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Generate type alias for call function arguments
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Update polkadot.rs code from commit 2e2a75ff81
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Type aliases for runtime API parameters
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Type alias for runtime apis output
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* storage: Change path of the aliased module
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Adjust module indentation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Do not alias for api::runtime_types with unresolved generics
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Fix and document runtime API alias generation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update artifacts
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update cargo.lock file
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Generate composite structs with alias unnamed fields
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Update polkadot.rs file
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Alias storage unnamed parameters
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Change polkadot to rococo runtime
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Fix compiling tests in the codegen crate
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Extend storage test with alias module
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cli/tests: Adjust exepcted commands to the latest metadata
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Remove missleading comment and docs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Ensure unique names for generated runtime API types
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen/tests: Test expected runtime type generation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen/tests: Check duplicate params in runtime APIs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen/tests: Test colliding names of type aliases and parameters
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Fix clippy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Separate alias module from struct definition
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update polkadot.rs
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* codegen: Remove outdated docs from composite def
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* storage/fix: Use partial key instead of root key for iter
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* storage: Allow partial key construction
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* storage: Allow less provided types than num of hashes
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* storage: Error on more fields than types
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Check partial key iteration
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* storage: Rename variable wrt partial address bytes
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* storage: Identical storage key to root key if no keys are provided
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* First pass making matching on signed exts more general and handlng SkipCheckifFeeless
* remove unneeded derives (only exts we can decode into are handled by the user)
* No SkipCheckIfFeeless in integration tests either
* Cargo fmt
* Remove SkipCheckIfFeeless specific logic
* clippy
* matches to just return bool, not result
* remove now-invalid comment
* return error from find if .iter() errors
* config: Add `SkipCheckIfFeeless` signed extension
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* config: Add extra extension to the default params
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Adjust signed extension example
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* config: Extend SkipCheckIfFeeless with inner signed extension
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* config: Configure SkipCheck with inner signed extension params
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* config: Implement Deafult for SkipCheckIfFeelessParams with Option
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Fix example with proper extension
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* config: Extend <T as Config>::AssetId with EncodeAsType and Clone
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* config: Add SkipCheck with AssetTx
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* config: Encode as type from metadata the inner signed extensions
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Adjust examples
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* blocks: Use `SkipCheckIfFeeless` for decoding the tip of extensions
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* config: Decode `SkipCheckIfFeeless` with `Self`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* tests: Adjust testing
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* config: Descriptive errors for building `SkipCheckIfFeeless`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* config: Add docs for extra error types
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Add extra derives to signed extensions
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* config: Use `Default::default` to simplify type init
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* skeleton commit
* signed extension decoding
* fix some minor things
* make api more similar to Extrinsics
* defer decoding of signed extensions
* fix byte slices
* add test for nonce signed extension
* adjust test and extend for tip
* clippy
* support both ChargeTransactionPayment and ChargeAssetTxPayment
* address PR comments
* Extend lifetimes, expose pub structs, remove as_type
* add signed extensions to block subscribing example
* add Decoded type
* fix merging bug and tests
* add decoded type in CustomSignedExtension
* fix minor issues, extend test
* cargo fmt differences
* remove the `decoded` function
* new as_signed_extra fn, do not expose as_type anymore
* fix Result-Option order, simplify obtaining Nonce
* tx: Remove `wait_for_in_block` helper method (#1237)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update smoldot to 0.12 (#1212)
* Update lightclient
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Fix typo
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Update cargo.toml
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* lightclient: Add tracing logs to improve debugging
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* lightclient: Add socket buffers module for `PlatformRef`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* lightclient: Update `SubxtPlatform`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* cargo: Add lightclient dependencies
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update cargo.lock of wasm tests
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* lightclient: Add constant for with-buffer module
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* lightclient: Replace rand crate with getrandom
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* example: Update cargo lock file
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* examples: Update deps
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: Tadeo Hepperle <62739623+tadeohepperle@users.noreply.github.com>
* ChargeAssetTxPayment: support providing u32 or MultiLocation in default impl (#1227)
* Asset Id in Config trait
* add example configuring the config
* fmt
* fix Default trait bound
* merge examples, fix default again
* adjust config in examples
* Update subxt/src/config/mod.rs
Co-authored-by: James Wilson <james@jsdw.me>
---------
Co-authored-by: James Wilson <james@jsdw.me>
* generic AssetId
* fix generics
* fmt
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
* skeleton commit
* signed extension decoding
* fix some minor things
* make api more similar to Extrinsics
* defer decoding of signed extensions
* fix byte slices
* add test for nonce signed extension
* adjust test and extend for tip
* clippy
* support both ChargeTransactionPayment and ChargeAssetTxPayment
* address PR comments
* Extend lifetimes, expose pub structs, remove as_type
* add signed extensions to block subscribing example
* make example less ugly
---------
Co-authored-by: James Wilson <james@jsdw.me>
* Clone + Debug on Payloads/Addresses, and compare child storage results
* , to .
* clippy and fixes
* fix
* use derivative instead to remove boilerplate impls
* add missing import
* tidy up and extend wasm test timeout
* try 5 mins instead of 2
* add follow_stream impl
* follow_stream_unpin first draft
* add tests for follow_stream_unpin
* more tests and fixes for follow_stream_unpin
* first pass follow_stream_driver
* follow_stream_driver: add tests, fix things, buffer events from last finalized
* First pass finishing Backend impl
* Fix test compile issues
* clippy fixes
* clippy fix and consistify light_client
* revert lightclient tweak
* revert other lightclient thing
* cargo fmt
* start testing unstable backend behind feature flag
* more test fixes and move test-runtime metadata path just incase
* fix compile error
* ensure transaction progress stream actually used and fix another test
* cargo fmt
* CI tweak
* improve some comments and address some feedback bits
* update CI to use our own nightly binary
* wait for finalized block perhaps
* add back unstable APIs and tests
* clippy fixes
* fmt with new rust
* deserialize from object or array into api versions
* remove inspect
* add some of the other unstable RPC methods we might want
* clippy fix
* no unused deps warning in test crate
* fix doc fails
* legacy -> unstable
Co-authored-by: Tadeo Hepperle <62739623+tadeohepperle@users.noreply.github.com>
* runtime_updates -> with_runtiem
* add test and be consistent with naming of unstable RPCs
---------
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: Tadeo Hepperle <62739623+tadeohepperle@users.noreply.github.com>
* WIP backend trait
* WIP converting higher level stuff to using Backend impl
* more implementing new backend trait, mainly storage focused
* Get core code compiling with new backend bits
* subxt crate checks passing
* fix tests
* cargo fmt
* clippy/fixes
* merging and other fixes
* fix test
* fix lightclient code
* Fix some broken doc links
* another book link fix
* fix broken test when moving default_rpc_client
* fix dry_run test
* fix more tests; lightclient and wasm
* fix wasm tests
* fix some doc examples
* use next() instead of next_item()
* missing next_item() -> next()s
* move legacy RPc methods to LegacyRpcMethods type to host generic param instead of RpcClient
* standardise on all RpcClient types prefixed with Rpc, and 'raw' trait types prefixed with RawRpc so it's less ocnfusing which is which
* rename fixes
* doc fixes
* Add back system_dryRun RPC method and rename tx.dry_run() to tx.validate(), to signal that the calls are different
* Add a test that we return the correct extrinsic hash from submit()
* add TransactionValid details back, and protect against out of range bytes
* add test for decoding transaction validation from empty bytes
* fix clippy warning
* Bump to latest scale-encode,decode,value and fix test running
* remove patch deps
* update CI to spit out 'substrate-node' binary now
* fmt
* Fix test: compact type ID no longer present so can't re-encode Value in same way
* remove patch
* Fix cargo.lock
* Fix other compact test
* codegen: Add uncheckedExtrinsic substitute
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Add uncheckedExtrinsic replacement
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Test uncheckedExtrinsic encoding
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* testing: Apply clippy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Implement encode_to instead of encode for uncheckedExtrinsic
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subxt: Remove encode_as_fields from uncheckedExtrinsic
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* utils: Extend the UncheckedExtrinsic interface
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* utils: Use Static<Encoded> for uncheckedExtrinsic
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* utils: Remove extra impl on the uncheckedExtrinsic
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* utils: Add back the EncodeAsType
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* utils: Simplify the decode_as_type
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* utils: Use encode_as_type
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* utils: impl Decode for UncheckedExtrinsic
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update subxt/src/utils/unchecked_extrinsic.rs
Co-authored-by: James Wilson <james@jsdw.me>
* utils: Apply cargo fmt
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* utils: Check encoding / decoding of uncheckedExtrinsic
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* utils/tests: Use an already encoded tx bytes to start with
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>