From 6836f9ba99af40e4e23d86b6873b8eb3a97033dd Mon Sep 17 00:00:00 2001 From: Tadeo hepperle Date: Thu, 20 Jul 2023 13:53:50 +0200 Subject: [PATCH 1/7] remove defautl feature, add target cfg, change CI job waml --- .github/workflows/rust.yml | 14 ++++-- subxt/Cargo.toml | 2 +- subxt/src/book/usage/transactions.rs | 71 +++++++++++++++------------- subxt/src/client/online_client.rs | 6 ++- 4 files changed, 51 insertions(+), 42 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d5d8d62982..b61009ea80 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -60,6 +60,10 @@ jobs: - name: Cargo check all targets. run: cargo check --all-targets + # A basic check for WASM target specifically + - name: Cargo check WASM target + run: cargo check --no-default-features --features jsonrpsee,web --target wasm32-unknown-unknown + # Next, check subxt features. # - `native` feature must always be enabled # - `web` feature is always ignored. @@ -71,9 +75,9 @@ jobs: # check it without. We can't enable subxt or web features here, so no cargo hack. - name: Cargo check subxt-signer run: | - cargo check -p subxt-signer - cargo check -p subxt-signer --no-default-features --features sr25519 - cargo check -p subxt-signer --no-default-features --features ecdsa + cargo check -p subxt-signer + cargo check -p subxt-signer --no-default-features --features sr25519 + cargo check -p subxt-signer --no-default-features --features ecdsa # We can't enable web features here, so no cargo hack. - name: Cargo check subxt-lightclient @@ -271,8 +275,8 @@ jobs: # `listen-addr` is used to configure p2p to accept websocket connections instead of TCP. # `node-key` provides a deterministic p2p address. substrate --dev --node-key 0000000000000000000000000000000000000000000000000000000000000001 --listen-addr /ip4/0.0.0.0/tcp/30333/ws > /dev/null 2>&1 & - wasm-pack test --headless --firefox - wasm-pack test --headless --chrome + wasm-pack test --no-default-features --features jsonrpsee,web --headless --firefox + wasm-pack test --no-default-features --features jsonrpsee,web --headless --chrome pkill substrate working-directory: testing/wasm-rpc-tests diff --git a/subxt/Cargo.toml b/subxt/Cargo.toml index d4fa845d27..5165254a54 100644 --- a/subxt/Cargo.toml +++ b/subxt/Cargo.toml @@ -17,7 +17,7 @@ keywords = ["parity", "substrate", "blockchain"] [features] # For dev and documentation reasons we enable more features than are often desired. # it's recommended to use `--no-default-features` and then select what you need. -default = ["jsonrpsee", "native", "substrate-compat"] +default = ["jsonrpsee", "native"] # Enable this for native (ie non web/wasm builds). # Exactly 1 of "web" and "native" is expected. diff --git a/subxt/src/book/usage/transactions.rs b/subxt/src/book/usage/transactions.rs index d4b3ce75d4..362d4abbd0 100644 --- a/subxt/src/book/usage/transactions.rs +++ b/subxt/src/book/usage/transactions.rs @@ -77,40 +77,43 @@ //! Let's see how to use each of these approaches: //! //! ```rust -//! use subxt::config::PolkadotConfig; -//! use std::str::FromStr; -//! -//! //// 1. Use a `subxt_signer` impl: -//! use subxt_signer::{ SecretUri, sr25519 }; -//! -//! // Get hold of a `Signer` for a test account: -//! let alice = sr25519::dev::alice(); -//! -//! // Or generate a keypair, here from an SURI: -//! let uri = SecretUri::from_str("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password") -//! .expect("valid URI"); -//! let keypair = sr25519::Keypair::from_uri(&uri) -//! .expect("valid keypair"); -//! -//! //// 2. Use the corresponding `sp_core::Pair` impl: -//! use subxt::tx::PairSigner; -//! use sp_core::Pair; -//! -//! // Get hold of a `Signer` for a test account: -//! let alice = sp_keyring::AccountKeyring::Alice.pair(); -//! let alice = PairSigner::::new(alice); -//! -//! // Or generate a keypair, here from an SURI: -//! let keypair = sp_core::sr25519::Pair::from_string("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password", None) -//! .expect("valid URI"); -//! let keypair = PairSigner::::new(keypair); -//! # -//! # // Test that these all impl Signer trait while we're here: -//! # -//! # fn is_subxt_signer(_signer: impl subxt::tx::Signer) {} -//! # is_subxt_signer(subxt_signer::sr25519::dev::alice()); -//! # is_subxt_signer(subxt_signer::ecdsa::dev::alice()); -//! # is_subxt_signer(PairSigner::::new(sp_keyring::AccountKeyring::Alice.pair())); +//! #[cfg(feature = "substrate-compat")] +//! { +//! use subxt::config::PolkadotConfig; +//! use std::str::FromStr; +//! +//! //// 1. Use a `subxt_signer` impl: +//! use subxt_signer::{ SecretUri, sr25519 }; +//! +//! // Get hold of a `Signer` for a test account: +//! let alice = sr25519::dev::alice(); +//! +//! // Or generate a keypair, here from an SURI: +//! let uri = SecretUri::from_str("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password") +//! .expect("valid URI"); +//! let keypair = sr25519::Keypair::from_uri(&uri) +//! .expect("valid keypair"); +//! +//! //// 2. Use the corresponding `sp_core::Pair` impl: +//! use subxt::tx::PairSigner; +//! use sp_core::Pair; +//! +//! // Get hold of a `Signer` for a test account: +//! let alice = sp_keyring::AccountKeyring::Alice.pair(); +//! let alice = PairSigner::::new(alice); +//! +//! // Or generate a keypair, here from an SURI: +//! let keypair = sp_core::sr25519::Pair::from_string("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password", None) +//! .expect("valid URI"); +//! let keypair = PairSigner::::new(keypair); +//! # +//! # // Test that these all impl Signer trait while we're here: +//! # +//! # fn is_subxt_signer(_signer: impl subxt::tx::Signer) {} +//! # is_subxt_signer(subxt_signer::sr25519::dev::alice()); +//! # is_subxt_signer(subxt_signer::ecdsa::dev::alice()); +//! # is_subxt_signer(PairSigner::::new(sp_keyring::AccountKeyring::Alice.pair())); +//! } //! ``` //! //! See the `subxt_signer` crate or the [`sp_core::Pair`] docs for more ways to construct diff --git a/subxt/src/client/online_client.rs b/subxt/src/client/online_client.rs index db242de3bf..907dd5bc25 100644 --- a/subxt/src/client/online_client.rs +++ b/subxt/src/client/online_client.rs @@ -468,7 +468,7 @@ mod jsonrpsee_helpers { } // helpers for a jsonrpsee specific OnlineClient. -#[cfg(all(feature = "jsonrpsee", feature = "web"))] +#[cfg(all(feature = "jsonrpsee", feature = "web", target_arch = "wasm32"))] mod jsonrpsee_helpers { pub use jsonrpsee::{ client_transport::web, @@ -480,7 +480,9 @@ mod jsonrpsee_helpers { /// Build web RPC client from URL pub async fn client(url: &str) -> Result { - let (sender, receiver) = web::connect(url).await.unwrap(); + let (sender, receiver) = web::connect(url) + .await + .map_err(|e| Error::Transport(e.into()))?; Ok(ClientBuilder::default() .max_notifs_per_subscription(4096) .build_with_wasm(sender, receiver)) From 40915019fbd93ef776773f2596109231dd8b2f42 Mon Sep 17 00:00:00 2001 From: Tadeo hepperle Date: Thu, 20 Jul 2023 15:21:36 +0200 Subject: [PATCH 2/7] adjust CI job --- .github/workflows/rust.yml | 42 +- examples/wasm-example/Cargo.lock | 1040 ++++++++++++++++++++++++++++-- 2 files changed, 1013 insertions(+), 69 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b61009ea80..1a22dabf22 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,7 +24,7 @@ env: WASM_BINDGEN_TEST_TIMEOUT: 60 jobs: - build: + check: name: Cargo check runs-on: ubuntu-latest steps: @@ -60,10 +60,6 @@ jobs: - name: Cargo check all targets. run: cargo check --all-targets - # A basic check for WASM target specifically - - name: Cargo check WASM target - run: cargo check --no-default-features --features jsonrpsee,web --target wasm32-unknown-unknown - # Next, check subxt features. # - `native` feature must always be enabled # - `web` feature is always ignored. @@ -87,6 +83,34 @@ jobs: - name: Cargo hack; check each feature/crate on its own run: cargo hack --exclude subxt --exclude subxt-signer --exclude subxt-lightclient --exclude-all-features --each-feature check --workspace + # Check examples, which aren't a part of the workspace and so are otherwise missed: + - name: Cargo check examples + run: | + cargo check --manifest-path examples/parachain-example/Cargo.toml + + wasm_check: + name: Cargo check (WASM) + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Install Rust stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: wasm32-unknown-unknown + override: true + + - name: Rust Cache + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 + + # Check WASM examples, which aren't a part of the workspace and so are otherwise missed: + - name: Cargo check WASM examples + run: | + cargo check --manifest-path examples/wasm-example/Cargo.toml --target wasm32-unknown-unknown + fmt: name: Cargo fmt runs-on: ubuntu-latest @@ -145,7 +169,7 @@ jobs: command: test args: --doc - nonwasm_tests: + tests: name: "Test non-wasm" runs-on: ubuntu-latest-16-cores steps: @@ -179,7 +203,7 @@ jobs: command: nextest args: run --workspace - nonwasm_light_client_tests: + light_client_tests: name: "Test Light Client" runs-on: ubuntu-latest-16-cores timeout-minutes: 25 @@ -275,8 +299,8 @@ jobs: # `listen-addr` is used to configure p2p to accept websocket connections instead of TCP. # `node-key` provides a deterministic p2p address. substrate --dev --node-key 0000000000000000000000000000000000000000000000000000000000000001 --listen-addr /ip4/0.0.0.0/tcp/30333/ws > /dev/null 2>&1 & - wasm-pack test --no-default-features --features jsonrpsee,web --headless --firefox - wasm-pack test --no-default-features --features jsonrpsee,web --headless --chrome + wasm-pack test --headless --firefox + wasm-pack test --headless --chrome pkill substrate working-directory: testing/wasm-rpc-tests diff --git a/examples/wasm-example/Cargo.lock b/examples/wasm-example/Cargo.lock index 795141f57c..cde42f2546 100644 --- a/examples/wasm-example/Cargo.lock +++ b/examples/wasm-example/Cargo.lock @@ -2,6 +2,67 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aead" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", + "opaque-debug", +] + +[[package]] +name = "aes-gcm" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc3be92e19a7ef47457b8e6f90707e12b6ac5d20c6f3866584fa3be0787d839f" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + [[package]] name = "anyhow" version = "1.0.71" @@ -20,6 +81,15 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +[[package]] +name = "arrayvec" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +dependencies = [ + "nodrop", +] + [[package]] name = "arrayvec" version = "0.7.2" @@ -43,15 +113,36 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.26", ] +[[package]] +name = "atomic" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" + [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base58" version = "0.2.0" @@ -88,6 +179,21 @@ dependencies = [ "serde", ] +[[package]] +name = "bip39" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" +dependencies = [ + "bitcoin_hashes", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" + [[package]] name = "bitflags" version = "1.3.2" @@ -115,6 +221,16 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +dependencies = [ + "arrayvec 0.4.12", + "constant_time_eq 0.1.5", +] + [[package]] name = "blake2b_simd" version = "1.0.1" @@ -122,8 +238,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", - "arrayvec", - "constant_time_eq", + "arrayvec 0.7.2", + "constant_time_eq 0.2.5", ] [[package]] @@ -150,6 +266,15 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "tinyvec", +] + [[package]] name = "bumpalo" version = "3.13.0" @@ -186,6 +311,40 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chacha20" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", + "zeroize", +] + +[[package]] +name = "chacha20poly1305" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array", +] + [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -196,12 +355,24 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + [[package]] name = "constant_time_eq" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "core-foundation" version = "0.9.3" @@ -227,6 +398,25 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + [[package]] name = "crunchy" version = "0.2.2" @@ -243,6 +433,65 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "ctr" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a232f92a03f37dd7d7dd2adc67166c77e9cd88de5b019b9a9eecfaeaf7bfd481" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "4.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d4ba9852b42210c7538b75484f9daa0655e9a3ac04f693747bb0f02cf3cfe16" +dependencies = [ + "cfg-if", + "fiat-crypto", + "packed_simd_2", + "platforms", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-ng" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.4", + "subtle-ng", + "zeroize", +] + [[package]] name = "darling" version = "0.14.4" @@ -288,7 +537,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.17", + "syn 2.0.26", ] [[package]] @@ -310,7 +559,7 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" dependencies = [ "darling_core 0.20.1", "quote", - "syn 2.0.17", + "syn 2.0.26", ] [[package]] @@ -330,8 +579,10 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ + "convert_case", "proc-macro2", "quote", + "rustc_version", "syn 1.0.109", ] @@ -355,6 +606,26 @@ dependencies = [ "subtle", ] +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", +] + [[package]] name = "either" version = "1.8.1" @@ -367,6 +638,12 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "fiat-crypto" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" + [[package]] name = "fixed-hash" version = "0.8.0" @@ -399,6 +676,17 @@ name = "frame-metadata" version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" +dependencies = [ + "cfg-if", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "frame-metadata" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cf1549fba25a6fcac22785b61698317d958e96cac72a59102ea45b9ae64692" dependencies = [ "cfg-if", "parity-scale-codec", @@ -468,7 +756,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.26", ] [[package]] @@ -490,7 +778,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" dependencies = [ "gloo-timers", - "send_wrapper", + "send_wrapper 0.4.0", ] [[package]] @@ -534,6 +822,22 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "ghash" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +dependencies = [ + "opaque-debug", + "polyval", +] + +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + [[package]] name = "gloo" version = "0.8.0" @@ -725,6 +1029,18 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +dependencies = [ + "serde", +] [[package]] name = "heck" @@ -747,6 +1063,36 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac 0.8.1", +] + [[package]] name = "http" version = "0.2.9" @@ -872,7 +1218,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "intx" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f38a50a899dc47a6d0ed5508e7f601a2e34c3a85303514b5d137f3c10a0c75" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", ] [[package]] @@ -995,35 +1374,189 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.144" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "libm" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" + +[[package]] +name = "libm" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" + +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64 0.13.1", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "log" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" + +[[package]] +name = "lru" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.45.0", +] + +[[package]] +name = "no-std-net" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43794a0ace135be66a25d3ae77d41b91615fb68ae937f904090203e81f755b65" + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] [[package]] -name = "log" -version = "0.4.17" +name = "num-integer" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "cfg-if", + "autocfg", + "num-traits", ] [[package]] -name = "memchr" -version = "2.5.0" +name = "num-rational" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", +] [[package]] -name = "mio" -version = "0.8.6" +name = "num-traits" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.45.0", + "autocfg", ] [[package]] @@ -1036,6 +1569,15 @@ dependencies = [ "libc", ] +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.17.1" @@ -1054,13 +1596,23 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "packed_simd_2" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" +dependencies = [ + "cfg-if", + "libm 0.1.4", +] + [[package]] name = "parity-scale-codec" version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28" dependencies = [ - "arrayvec", + "arrayvec 0.7.2", "bitvec", "byte-slice-cast", "impl-trait-for-tuples", @@ -1080,6 +1632,21 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "percent-encoding" version = "2.2.0" @@ -1103,7 +1670,7 @@ checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.26", ] [[package]] @@ -1129,6 +1696,35 @@ dependencies = [ "thiserror", ] +[[package]] +name = "platforms" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" + +[[package]] +name = "poly1305" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1194,9 +1790,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -1220,9 +1816,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.28" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" dependencies = [ "proc-macro2", ] @@ -1241,7 +1837,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -1251,9 +1847,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", ] +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" + [[package]] name = "rand_core" version = "0.6.4" @@ -1272,12 +1874,18 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", + "spin 0.5.2", "untrusted", "web-sys", "winapi", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -1290,6 +1898,15 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + [[package]] name = "rustls" version = "0.20.8" @@ -1329,6 +1946,17 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +[[package]] +name = "ruzstd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3ffab8f9715a0d455df4bbb9d21e91135aab3cd3ca187af0cd0c3c3f868fdc" +dependencies = [ + "byteorder", + "thiserror-core", + "twox-hash", +] + [[package]] name = "ryu" version = "1.0.13" @@ -1404,9 +2032,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.7.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b569c32c806ec3abdf3b5869fb8bf1e0d275a7c1c9b0b05603d9464632649edf" +checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" dependencies = [ "bitvec", "cfg-if", @@ -1418,9 +2046,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53012eae69e5aa5c14671942a5dd47de59d4cdcff8532a6dd0e081faf1119482" +checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1437,7 +2065,7 @@ dependencies = [ "base58", "blake2", "either", - "frame-metadata", + "frame-metadata 15.1.0", "parity-scale-codec", "scale-bits", "scale-decode", @@ -1457,6 +2085,22 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "schnorrkel" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "844b7645371e6ecdf61ff246ba1958c29e802881a749ae3fb1993675d210d28d" +dependencies = [ + "arrayref", + "arrayvec 0.7.2", + "curve25519-dalek-ng", + "merlin", + "rand_core 0.6.4", + "sha2 0.9.9", + "subtle-ng", + "zeroize", +] + [[package]] name = "sct" version = "0.7.0" @@ -1490,17 +2134,29 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" + [[package]] name = "send_wrapper" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + [[package]] name = "serde" -version = "1.0.164" +version = "1.0.173" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f" dependencies = [ "serde_derive", ] @@ -1518,20 +2174,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.173" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "a6250dde8342e0232232be9ca3db7aa40aceb5a3e5dd9bddbc00d99a007cde49" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.26", ] [[package]] name = "serde_json" -version = "1.0.97" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ "itoa", "ryu", @@ -1563,6 +2219,19 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + [[package]] name = "sha2" version = "0.10.6" @@ -1584,6 +2253,12 @@ dependencies = [ "keccak", ] +[[package]] +name = "siphasher" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" + [[package]] name = "slab" version = "0.4.8" @@ -1599,6 +2274,98 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "smoldot" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cce5e2881b30bad7ef89f383a816ad0b22c45915911f28499026de4a76d20ee" +dependencies = [ + "arrayvec 0.7.2", + "async-lock", + "atomic", + "base64 0.21.2", + "bip39", + "blake2-rfc", + "bs58", + "crossbeam-queue", + "derive_more", + "ed25519-zebra", + "either", + "event-listener", + "fnv", + "futures-channel", + "futures-util", + "hashbrown 0.14.0", + "hex", + "hmac 0.12.1", + "itertools", + "libsecp256k1", + "merlin", + "no-std-net", + "nom", + "num-bigint", + "num-rational", + "num-traits", + "pbkdf2", + "rand", + "rand_chacha", + "ruzstd", + "schnorrkel", + "serde", + "serde_json", + "sha2 0.10.6", + "siphasher", + "slab", + "smallvec", + "snow", + "tiny-keccak", + "twox-hash", + "wasmi", +] + +[[package]] +name = "smoldot-light" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2f7b4687b83ff244ef6137735ed5716ad37dcdf3ee16c4eb1a32fb9808fa47" +dependencies = [ + "async-lock", + "blake2-rfc", + "derive_more", + "either", + "event-listener", + "fnv", + "futures-channel", + "futures-util", + "hashbrown 0.14.0", + "hex", + "itertools", + "log", + "lru", + "rand", + "serde", + "serde_json", + "siphasher", + "slab", + "smoldot", +] + +[[package]] +name = "snow" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ccba027ba85743e09d15c03296797cad56395089b832b48b5a5217880f57733" +dependencies = [ + "aes-gcm", + "blake2", + "chacha20poly1305", + "curve25519-dalek 4.0.0-rc.1", + "rand_core 0.6.4", + "rustc_version", + "sha2 0.10.6", + "subtle", +] + [[package]] name = "socket2" version = "0.4.9" @@ -1633,7 +2400,7 @@ dependencies = [ "blake2b_simd", "byteorder", "digest 0.10.7", - "sha2", + "sha2 0.10.6", "sha3", "sp-std", "twox-hash", @@ -1651,6 +2418,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "static_assertions" version = "1.1.0" @@ -1669,6 +2442,12 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +[[package]] +name = "subtle-ng" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" + [[package]] name = "subxt" version = "0.29.0" @@ -1677,7 +2456,7 @@ dependencies = [ "blake2", "derivative", "either", - "frame-metadata", + "frame-metadata 16.0.0", "futures", "getrandom", "hex", @@ -1693,6 +2472,7 @@ dependencies = [ "serde", "serde_json", "sp-core-hashing", + "subxt-lightclient", "subxt-macro", "subxt-metadata", "thiserror", @@ -1703,7 +2483,7 @@ dependencies = [ name = "subxt-codegen" version = "0.29.0" dependencies = [ - "frame-metadata", + "frame-metadata 16.0.0", "heck", "hex", "jsonrpsee", @@ -1712,9 +2492,33 @@ dependencies = [ "quote", "scale-info", "subxt-metadata", - "syn 2.0.17", + "syn 2.0.26", + "thiserror", + "tokio", +] + +[[package]] +name = "subxt-lightclient" +version = "0.29.0" +dependencies = [ + "futures", + "futures-timer", + "futures-util", + "getrandom", + "instant", + "js-sys", + "send_wrapper 0.6.0", + "serde", + "serde_json", + "smoldot", + "smoldot-light", "thiserror", "tokio", + "tokio-stream", + "tracing", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", ] [[package]] @@ -1724,14 +2528,14 @@ dependencies = [ "darling 0.20.1", "proc-macro-error", "subxt-codegen", - "syn 2.0.17", + "syn 2.0.26", ] [[package]] name = "subxt-metadata" version = "0.29.0" dependencies = [ - "frame-metadata", + "frame-metadata 16.0.0", "parity-scale-codec", "scale-info", "sp-core-hashing", @@ -1751,9 +2555,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.17" +version = "2.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388" +checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" dependencies = [ "proc-macro2", "quote", @@ -1775,6 +2579,26 @@ dependencies = [ "thiserror-impl", ] +[[package]] +name = "thiserror-core" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d97345f6437bb2004cd58819d8a9ef8e36cdd7661c2abc4bbde0a7c40d9f497" +dependencies = [ + "thiserror-core-impl", +] + +[[package]] +name = "thiserror-core-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ac1c5050e43014d16b2f94d0d2ce79e65ffdd8b38d8048f9c8f6a8a6da62ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "thiserror-impl" version = "1.0.40" @@ -1783,16 +2607,41 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.26", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", ] +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" -version = "1.28.1" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -1811,7 +2660,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.26", ] [[package]] @@ -1894,7 +2743,7 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.26", ] [[package]] @@ -1948,6 +2797,16 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +[[package]] +name = "universal-hash" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" +dependencies = [ + "generic-array", + "subtle", +] + [[package]] name = "untrusted" version = "0.7.1" @@ -1997,7 +2856,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.26", "wasm-bindgen-shared", ] @@ -2031,7 +2890,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.26", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2053,6 +2912,47 @@ dependencies = [ "yew", ] +[[package]] +name = "wasmi" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51fb5c61993e71158abf5bb863df2674ca3ec39ed6471c64f07aeaf751d67b4" +dependencies = [ + "intx", + "smallvec", + "spin 0.9.8", + "wasmi_arena", + "wasmi_core", + "wasmparser-nostd", +] + +[[package]] +name = "wasmi_arena" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468" + +[[package]] +name = "wasmi_core" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624e6333e861ef49095d2d678b76ebf30b06bf37effca845be7e5b87c90071b7" +dependencies = [ + "downcast-rs", + "libm 0.2.7", + "num-traits", + "paste", +] + +[[package]] +name = "wasmparser-nostd" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9157cab83003221bfd385833ab587a039f5d6fa7304854042ba358a3b09e0724" +dependencies = [ + "indexmap-nostd", +] + [[package]] name = "web-sys" version = "0.3.63" @@ -2314,3 +3214,23 @@ dependencies = [ "quote", "syn 1.0.109", ] + +[[package]] +name = "zeroize" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.26", +] From e6bdea3a40cb6dfbfcb4e0b8549b49358d3005d7 Mon Sep 17 00:00:00 2001 From: Tadeo hepperle Date: Fri, 21 Jul 2023 10:38:27 +0200 Subject: [PATCH 3/7] Adjust docs --- subxt/src/book/usage/transactions.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subxt/src/book/usage/transactions.rs b/subxt/src/book/usage/transactions.rs index 73012402c5..8483a1a957 100644 --- a/subxt/src/book/usage/transactions.rs +++ b/subxt/src/book/usage/transactions.rs @@ -66,8 +66,8 @@ //! There are two main ways to create a compatible signer instance: //! 1. The `subxt_signer` crate provides a WASM compatible implementation of [`crate::tx::Signer`] //! for chains which require sr25519 or ecdsa signatures (requires the `subxt` feature to be enabled). -//! 2. Alternately, Subxt can use instances of Substrate's [`sp_core::Pair`] to sign things by wrapping -//! them in a [`crate::tx::PairSigner`] (requires the `substrate-compat` feature to be enabled). +//! 2. Alternately, Subxt can use instances of Substrate's `sp_core::Pair` to sign things by wrapping +//! them in a `crate::tx::PairSigner` (requires the `substrate-compat` feature to be enabled). //! //! Going for 1 leads to fewer dependencies being imported and WASM compatibility out of the box via //! the `web` feature flag. Going for 2 is useful if you're already using the Substrate dependencies or @@ -116,7 +116,7 @@ //! } //! ``` //! -//! See the `subxt_signer` crate or the [`sp_core::Pair`] docs for more ways to construct +//! See the `subxt_signer` crate or the `sp_core::Pair` docs for more ways to construct //! and work with key pairs. //! //! If this isn't suitable/available, you can either implement [`crate::tx::Signer`] yourself to use From 6ebb1908f7382ad978e9b608cadbb8f457ef1711 Mon Sep 17 00:00:00 2001 From: Tadeo hepperle Date: Fri, 21 Jul 2023 11:14:58 +0200 Subject: [PATCH 4/7] adjust the CI job --- .github/workflows/rust.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1a22dabf22..f1dc7b8f32 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -83,11 +83,6 @@ jobs: - name: Cargo hack; check each feature/crate on its own run: cargo hack --exclude subxt --exclude subxt-signer --exclude subxt-lightclient --exclude-all-features --each-feature check --workspace - # Check examples, which aren't a part of the workspace and so are otherwise missed: - - name: Cargo check examples - run: | - cargo check --manifest-path examples/parachain-example/Cargo.toml - wasm_check: name: Cargo check (WASM) runs-on: ubuntu-latest @@ -109,7 +104,7 @@ jobs: # Check WASM examples, which aren't a part of the workspace and so are otherwise missed: - name: Cargo check WASM examples run: | - cargo check --manifest-path examples/wasm-example/Cargo.toml --target wasm32-unknown-unknown + cargo check --manifest-path examples/wasm-example/Cargo.toml fmt: name: Cargo fmt From 32210d5dc13dba6559e0a852fb1965d637b4feb5 Mon Sep 17 00:00:00 2001 From: Tadeo hepperle Date: Fri, 21 Jul 2023 13:54:04 +0200 Subject: [PATCH 5/7] add wasm targe to ci again --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f1dc7b8f32..e71653e640 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -104,7 +104,7 @@ jobs: # Check WASM examples, which aren't a part of the workspace and so are otherwise missed: - name: Cargo check WASM examples run: | - cargo check --manifest-path examples/wasm-example/Cargo.toml + cargo check --manifest-path examples/wasm-example/Cargo.toml --target wasm32-unknown-unknown fmt: name: Cargo fmt From 6ddeb74ce3ccb042049523336688372160cbeda2 Mon Sep 17 00:00:00 2001 From: Tadeo hepperle Date: Fri, 21 Jul 2023 14:18:15 +0200 Subject: [PATCH 6/7] remove the unresolved links from the book --- subxt/src/book/setup/config.rs | 32 ++++++++++++++++---------------- subxt/src/tx/signer.rs | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/subxt/src/book/setup/config.rs b/subxt/src/book/setup/config.rs index 255130704d..85cbf84dfa 100644 --- a/subxt/src/book/setup/config.rs +++ b/subxt/src/book/setup/config.rs @@ -34,17 +34,17 @@ //! at the time of writing. The `AccountId`, `Hash` and `Header` types of the [frame_system::pallet::Config](https://docs.rs/frame-system/latest/frame_system/pallet/trait.Config.html) //! correspond to the ones we want to use for implementing [crate::Config]. In the Case of Statemint (Asset Hub) they are: //! -//! - AccountId: [`sp_core::crypto::AccountId32`] -//! - Hash: [`sp_core::H256`] -//! - Hasher (type `Hashing` in [frame_system::pallet::Config](https://docs.rs/frame-system/latest/frame_system/pallet/trait.Config.html)): [`sp_runtime::traits::BlakeTwo256`] -//! - Header: [`sp_runtime::generic::Header`](sp_runtime::generic::Header) +//! - AccountId: `sp_core::crypto::AccountId32` +//! - Hash: `sp_core::H256` +//! - Hasher (type `Hashing` in [frame_system::pallet::Config](https://docs.rs/frame-system/latest/frame_system/pallet/trait.Config.html)): `sp_runtime::traits::BlakeTwo256` +//! - Header: `sp_runtime::generic::Header` //! //! Subxt has its own versions of some of these types in order to avoid needing to pull in Substrate dependencies: //! -//! - [`sp_core::crypto::AccountId32`] can be swapped with [`crate::utils::AccountId32`]. -//! - [`sp_core::H256`] is a re-export which subxt also provides as [`crate::config::substrate::H256`]. -//! - [`sp_runtime::traits::BlakeTwo256`] can be swapped with [`crate::config::substrate::BlakeTwo256`]. -//! - [`sp_runtime::generic::Header`] can be swapped with [`crate::config::substrate::SubstrateHeader`]. +//! - `sp_core::crypto::AccountId32` can be swapped with [`crate::utils::AccountId32`]. +//! - `sp_core::H256` is a re-export which subxt also provides as [`crate::config::substrate::H256`]. +//! - `sp_runtime::traits::BlakeTwo256` can be swapped with [`crate::config::substrate::BlakeTwo256`]. +//! - `sp_runtime::generic::Header` can be swapped with [`crate::config::substrate::SubstrateHeader`]. //! //! Having a look at how those types are implemented can give some clues as to how to implement other custom types that //! you may need to use as part of your config. @@ -53,20 +53,20 @@ //! //! A Substrate runtime is typically constructed by using the [frame_support::construct_runtime](https://docs.rs/frame-support/latest/frame_support/macro.construct_runtime.html) macro. //! In this macro, we need to specify the type of an `UncheckedExtrinsic`. Most of the time, the `UncheckedExtrinsic` will be of the type -//! [sp_runtime::generic::UncheckedExtrinsic](sp_runtime::generic::UncheckedExtrinsic). +//! `sp_runtime::generic::UncheckedExtrinsic`. //! The generic parameters `Address` and `Signature` specified when declaring the `UncheckedExtrinsic` type //! are the types for `Address` and `Signature` we should use when implementing the [crate::Config] trait. This information can //! also be obtained from the metadata (see [`frame_metadata::v15::ExtrinsicMetadata`]). In case of Statemint (Polkadot Asset Hub) //! we see the following types being used in `UncheckedExtrinsic`: //! -//! - Address: [sp_runtime::MultiAddress](sp_runtime::MultiAddress) -//! - Signature: [sp_runtime::MultiSignature] +//! - Address: `sp_runtime::MultiAddress](sp_runtime::MultiAddress` +//! - Signature: `sp_runtime::MultiSignature` //! //! As above, Subxt has its own versions of these types that can be used instead to avoid pulling in Substrate dependencies. //! Using the Subxt versions also makes interacting with generated code (which uses them in some places) a little nicer: //! -//! - [`sp_runtime::MultiAddress`] can be swapped with [`crate::utils::MultiAddress`]. -//! - [`sp_runtime::MultiSignature`] can be swapped with [`crate::utils::MultiSignature`]. +//! - `sp_runtime::MultiAddress` can be swapped with [`crate::utils::MultiAddress`]. +//! - `sp_runtime::MultiSignature` can be swapped with [`crate::utils::MultiSignature`]. //! //! ### ExtrinsicParams //! @@ -100,7 +100,7 @@ //! ); //! ``` //! -//! Each element of the `SignedExtra` tuple implements [codec::Encode] and [sp_runtime::traits::SignedExtension] +//! Each element of the `SignedExtra` tuple implements [codec::Encode] and `sp_runtime::traits::SignedExtension` //! which has an associated type `AdditionalSigned` that also implements [codec::Encode]. Let's look at the underlying types //! for each tuple element. All zero-sized types have been replaced by `()` for simplicity. //! @@ -109,8 +109,8 @@ //! | [`frame_system::CheckNonZeroSender`](https://docs.rs/frame-system/latest/frame_system/struct.CheckNonZeroSender.html) | () | () | //! | [`frame_system::CheckSpecVersion`](https://docs.rs/frame-system/latest/frame_system/struct.CheckSpecVersion.html) | () | [u32] | //! | [`frame_system::CheckTxVersion`](https://docs.rs/frame-system/latest/frame_system/struct.CheckTxVersion.html) | () | [u32] | -//! | [`frame_system::CheckGenesis`](https://docs.rs/frame-system/latest/frame_system/struct.CheckGenesis.html) | () | `Config::Hash` = [sp_core::H256] | -//! | [`frame_system::CheckMortality`](https://docs.rs/frame-system/latest/frame_system/struct.CheckMortality.html) | [sp_runtime::generic::Era] | `Config::Hash` = [sp_core::H256] | +//! | [`frame_system::CheckGenesis`](https://docs.rs/frame-system/latest/frame_system/struct.CheckGenesis.html) | () | `Config::Hash` = `sp_core::H256` | +//! | [`frame_system::CheckMortality`](https://docs.rs/frame-system/latest/frame_system/struct.CheckMortality.html) | `sp_runtime::generic::Era` | `Config::Hash` = `sp_core::H256` | //! | [`frame_system::CheckNonce`](https://docs.rs/frame-system/latest/frame_system/struct.CheckNonce.html) | `frame_system::pallet::Config::Index` = u32 | () | //! | [`frame_system::CheckWeight`](https://docs.rs/frame-system/latest/frame_system/struct.CheckWeight.html) | () | () | //! | [`frame_system::ChargeAssetTxPayment`](https://docs.rs/frame-system/latest/frame_system/struct.ChargeAssetTxPayment.html) | [pallet_asset_tx_payment::ChargeAssetTxPayment](https://docs.rs/pallet-asset-tx-payment/latest/pallet_asset_tx_payment/struct.ChargeAssetTxPayment.html) | () | diff --git a/subxt/src/tx/signer.rs b/subxt/src/tx/signer.rs index 487df6af72..b007cbb256 100644 --- a/subxt/src/tx/signer.rs +++ b/subxt/src/tx/signer.rs @@ -50,7 +50,7 @@ mod pair_signer { where T: Config, Pair: PairT, - // We go via an sp_runtime::MultiSignature. We can probably generalise this + // We go via an `sp_runtime::MultiSignature`. We can probably generalise this // by implementing some of these traits on our built-in MultiSignature and then // requiring them on all T::Signatures, to avoid any go-between. ::Signer: From, From 6f7f7ba6883a2084cc9fae9012c5cdb80e5de57f Mon Sep 17 00:00:00 2001 From: James Wilson Date: Fri, 21 Jul 2023 15:27:39 +0100 Subject: [PATCH 7/7] Update subxt/src/book/usage/transactions.rs --- subxt/src/book/usage/transactions.rs | 74 ++++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/subxt/src/book/usage/transactions.rs b/subxt/src/book/usage/transactions.rs index 8483a1a957..6cbae2fa4c 100644 --- a/subxt/src/book/usage/transactions.rs +++ b/subxt/src/book/usage/transactions.rs @@ -77,43 +77,43 @@ //! Let's see how to use each of these approaches: //! //! ```rust -//! #[cfg(feature = "substrate-compat")] -//! { -//! use subxt::config::PolkadotConfig; -//! use std::str::FromStr; -//! -//! //// 1. Use a `subxt_signer` impl: -//! use subxt_signer::{ SecretUri, sr25519 }; -//! -//! // Get hold of a `Signer` for a test account: -//! let alice = sr25519::dev::alice(); -//! -//! // Or generate a keypair, here from an SURI: -//! let uri = SecretUri::from_str("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password") -//! .expect("valid URI"); -//! let keypair = sr25519::Keypair::from_uri(&uri) -//! .expect("valid keypair"); -//! -//! //// 2. Use the corresponding `sp_core::Pair` impl: -//! use subxt::tx::PairSigner; -//! use sp_core::Pair; -//! -//! // Get hold of a `Signer` for a test account: -//! let alice = sp_keyring::AccountKeyring::Alice.pair(); -//! let alice = PairSigner::::new(alice); -//! -//! // Or generate a keypair, here from an SURI: -//! let keypair = sp_core::sr25519::Pair::from_string("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password", None) -//! .expect("valid URI"); -//! let keypair = PairSigner::::new(keypair); -//! # -//! # // Test that these all impl Signer trait while we're here: -//! # -//! # fn is_subxt_signer(_signer: impl subxt::tx::Signer) {} -//! # is_subxt_signer(subxt_signer::sr25519::dev::alice()); -//! # is_subxt_signer(subxt_signer::ecdsa::dev::alice()); -//! # is_subxt_signer(PairSigner::::new(sp_keyring::AccountKeyring::Alice.pair())); -//! } +//! # #[cfg(feature = "substrate-compat")] +//! # { +//! use subxt::config::PolkadotConfig; +//! use std::str::FromStr; +//! +//! //// 1. Use a `subxt_signer` impl: +//! use subxt_signer::{ SecretUri, sr25519 }; +//! +//! // Get hold of a `Signer` for a test account: +//! let alice = sr25519::dev::alice(); +//! +//! // Or generate a keypair, here from an SURI: +//! let uri = SecretUri::from_str("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password") +//! .expect("valid URI"); +//! let keypair = sr25519::Keypair::from_uri(&uri) +//! .expect("valid keypair"); +//! +//! //// 2. Use the corresponding `sp_core::Pair` impl: +//! use subxt::tx::PairSigner; +//! use sp_core::Pair; +//! +//! // Get hold of a `Signer` for a test account: +//! let alice = sp_keyring::AccountKeyring::Alice.pair(); +//! let alice = PairSigner::::new(alice); +//! +//! // Or generate a keypair, here from an SURI: +//! let keypair = sp_core::sr25519::Pair::from_string("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password", None) +//! .expect("valid URI"); +//! let keypair = PairSigner::::new(keypair); +//! # +//! # // Test that these all impl Signer trait while we're here: +//! # +//! # fn is_subxt_signer(_signer: impl subxt::tx::Signer) {} +//! # is_subxt_signer(subxt_signer::sr25519::dev::alice()); +//! # is_subxt_signer(subxt_signer::ecdsa::dev::alice()); +//! # is_subxt_signer(PairSigner::::new(sp_keyring::AccountKeyring::Alice.pair())); +//! # } //! ``` //! //! See the `subxt_signer` crate or the `sp_core::Pair` docs for more ways to construct