From 13f9c703a343509c710b1ebd805244ab07ef0fb5 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Tue, 1 Oct 2024 17:18:27 +0200 Subject: [PATCH 1/3] stabilize reconnecting-rpc-client --- .github/workflows/rust.yml | 4 ++-- subxt/Cargo.toml | 4 ++-- subxt/examples/setup_reconnecting_rpc_client.rs | 2 +- subxt/src/macros.rs | 4 ++-- testing/integration-tests/Cargo.toml | 2 +- testing/wasm-rpc-tests/Cargo.toml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e1819ecf19..5fbaad0eaa 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -261,7 +261,7 @@ jobs: uses: actions-rs/cargo@v1.0.3 with: command: test - args: --doc --features unstable-reconnecting-rpc-client + args: --doc --features reconnecting-rpc-client - if: "failure()" uses: "andymckay/cancel-action@a955d435292c0d409d104b57d8e78435a93a6ef1" # v0.5 @@ -295,7 +295,7 @@ jobs: uses: actions-rs/cargo@v1.0.3 with: command: nextest - args: run --workspace --features unstable-reconnecting-rpc-client + args: run --workspace --features reconnecting-rpc-client - if: "failure()" uses: "andymckay/cancel-action@a955d435292c0d409d104b57d8e78435a93a6ef1" # v0.5 diff --git a/subxt/Cargo.toml b/subxt/Cargo.toml index b44faa476d..090be043dc 100644 --- a/subxt/Cargo.toml +++ b/subxt/Cargo.toml @@ -48,7 +48,7 @@ web = [ ] # Enable this to use the reconnecting rpc client -unstable-reconnecting-rpc-client = ["dep:finito", "dep:tokio", "jsonrpsee", "wasm-bindgen-futures"] +reconnecting-rpc-client = ["dep:finito", "dep:tokio", "jsonrpsee", "wasm-bindgen-futures", "tokio/rt-multi-thread"] # Enable this to use jsonrpsee (allowing for example `OnlineClient::from_url`). jsonrpsee = [ @@ -156,7 +156,7 @@ required-features = ["unstable-light-client", "jsonrpsee", "native"] [[example]] name = "setup_reconnecting_rpc_client" path = "examples/setup_reconnecting_rpc_client.rs" -required-features = ["unstable-reconnecting-rpc-client"] +required-features = ["reconnecting-rpc-client"] [package.metadata.docs.rs] features = ["default", "substrate-compat", "unstable-light-client"] diff --git a/subxt/examples/setup_reconnecting_rpc_client.rs b/subxt/examples/setup_reconnecting_rpc_client.rs index f89e08d0e1..30f85b197c 100644 --- a/subxt/examples/setup_reconnecting_rpc_client.rs +++ b/subxt/examples/setup_reconnecting_rpc_client.rs @@ -1,5 +1,5 @@ //! Example to utilize the `reconnecting rpc client` in subxt -//! which hidden behind behind `--feature unstable-reconnecting-rpc-client` +//! which hidden behind behind `--feature reconnecting-rpc-client` //! //! To utilize full logs from the RPC client use: //! `RUST_LOG="jsonrpsee=trace,subxt-reconnecting-rpc-client=trace"` diff --git a/subxt/src/macros.rs b/subxt/src/macros.rs index 84cad40d2c..4094d353fb 100644 --- a/subxt/src/macros.rs +++ b/subxt/src/macros.rs @@ -56,8 +56,8 @@ macro_rules! cfg_jsonrpsee_web { macro_rules! cfg_reconnecting_rpc_client { ($($item:item)*) => { $( - #[cfg(all(feature = "unstable-reconnecting-rpc-client", any(feature = "native", feature = "web")))] - #[cfg_attr(docsrs, doc(cfg(feature = "unstable-reconnecting-rpc-client")))] + #[cfg(all(feature = "reconnecting-rpc-client", any(feature = "native", feature = "web")))] + #[cfg_attr(docsrs, doc(cfg(feature = "reconnecting-rpc-client")))] $item )* } diff --git a/testing/integration-tests/Cargo.toml b/testing/integration-tests/Cargo.toml index ecf485d57b..f592410c68 100644 --- a/testing/integration-tests/Cargo.toml +++ b/testing/integration-tests/Cargo.toml @@ -36,7 +36,7 @@ serde = { workspace = true } scale-info = { workspace = true, features = ["bit-vec"] } sp-core = { workspace = true } syn = { workspace = true } -subxt = { workspace = true, features = ["unstable-metadata", "native", "jsonrpsee", "substrate-compat", "unstable-reconnecting-rpc-client"] } +subxt = { workspace = true, features = ["unstable-metadata", "native", "jsonrpsee", "substrate-compat", "reconnecting-rpc-client"] } subxt-signer = { workspace = true, features = ["default"] } subxt-codegen = { workspace = true } subxt-metadata = { workspace = true } diff --git a/testing/wasm-rpc-tests/Cargo.toml b/testing/wasm-rpc-tests/Cargo.toml index 103091739c..9e50d23cd6 100644 --- a/testing/wasm-rpc-tests/Cargo.toml +++ b/testing/wasm-rpc-tests/Cargo.toml @@ -15,4 +15,4 @@ futures-util = "0.3.30" # This crate is not a part of the workspace, because it # requires the "jsonrpsee web" features to be enabled, which we don't # want enabled for workspace builds in general. -subxt = { path = "../../subxt", default-features = false, features = ["web", "jsonrpsee", "unstable-reconnecting-rpc-client"] } +subxt = { path = "../../subxt", default-features = false, features = ["web", "jsonrpsee", "reconnecting-rpc-client"] } From f01f2c7e0ee0a7aa7f3c4510f7fe5d4c3742e142 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 2 Oct 2024 09:45:40 +0200 Subject: [PATCH 2/3] fix build --- subxt/Cargo.toml | 2 +- testing/wasm-rpc-tests/Cargo.lock | 107 ++++++++++++++++++++---------- 2 files changed, 74 insertions(+), 35 deletions(-) diff --git a/subxt/Cargo.toml b/subxt/Cargo.toml index 090be043dc..f253077bf4 100644 --- a/subxt/Cargo.toml +++ b/subxt/Cargo.toml @@ -48,7 +48,7 @@ web = [ ] # Enable this to use the reconnecting rpc client -reconnecting-rpc-client = ["dep:finito", "dep:tokio", "jsonrpsee", "wasm-bindgen-futures", "tokio/rt-multi-thread"] +reconnecting-rpc-client = ["dep:finito", "dep:tokio", "jsonrpsee", "wasm-bindgen-futures"] # Enable this to use jsonrpsee (allowing for example `OnlineClient::from_url`). jsonrpsee = [ diff --git a/testing/wasm-rpc-tests/Cargo.lock b/testing/wasm-rpc-tests/Cargo.lock index d42f541e11..8a27e550aa 100644 --- a/testing/wasm-rpc-tests/Cargo.lock +++ b/testing/wasm-rpc-tests/Cargo.lock @@ -97,7 +97,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -445,7 +445,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -493,7 +493,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -515,7 +515,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -526,7 +526,7 @@ checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -539,7 +539,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -667,6 +667,21 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "frame-decode" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed90459016b06a2855321469cb01fbc74208c80c06b085d1ed13162cf8bd7e1b" +dependencies = [ + "frame-metadata 16.0.0", + "hex", + "parity-scale-codec", + "scale-decode", + "scale-info", + "scale-type-resolver", + "sp-crypto-hashing", +] + [[package]] name = "frame-metadata" version = "15.1.0" @@ -750,7 +765,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -1301,11 +1316,11 @@ dependencies = [ [[package]] name = "keccak-hash" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b286e6b663fb926e1eeb68528e69cb70ed46c6d65871a21b2215ae8154c6d3c" +checksum = "3e1b8590eb6148af2ea2d75f38e7d29f5ca970d5a4df456b3ef19b8b415d0264" dependencies = [ - "primitive-types", + "primitive-types 0.13.1", "tiny-keccak", ] @@ -1485,7 +1500,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -1608,7 +1623,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -1653,7 +1668,17 @@ dependencies = [ "impl-codec", "impl-serde", "scale-info", - "uint", + "uint 0.9.5", +] + +[[package]] +name = "primitive-types" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d15600a7d856470b7d278b3fe0e311fe28c2526348549f8ef2ff7db3299c87f5" +dependencies = [ + "fixed-hash", + "uint 0.10.0", ] [[package]] @@ -1694,7 +1719,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -1920,7 +1945,7 @@ checksum = "e98f3262c250d90e700bb802eb704e1f841e03331c2eb815e46516c4edbf5b27" dependencies = [ "derive_more", "parity-scale-codec", - "primitive-types", + "primitive-types 0.12.2", "scale-bits", "scale-decode-derive", "scale-type-resolver", @@ -1947,7 +1972,7 @@ checksum = "4ba0b9c48dc0eb20c60b083c29447c0c4617cb7c4a4c9fef72aa5c5bc539e15e" dependencies = [ "derive_more", "parity-scale-codec", - "primitive-types", + "primitive-types 0.12.2", "scale-bits", "scale-encode-derive", "scale-type-resolver", @@ -2012,15 +2037,15 @@ dependencies = [ "proc-macro2", "quote", "scale-info", - "syn 2.0.75", + "syn 2.0.79", "thiserror", ] [[package]] name = "scale-value" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4d772cfb7569e03868400344a1695d16560bf62b86b918604773607d39ec84" +checksum = "8cd6ab090d823e75cfdb258aad5fe92e13f2af7d04b43a55d607d25fcc38c811" dependencies = [ "base58", "blake2", @@ -2139,7 +2164,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -2423,7 +2448,7 @@ dependencies = [ "instant", "jsonrpsee", "parity-scale-codec", - "primitive-types", + "primitive-types 0.12.2", "scale-bits", "scale-decode", "scale-encode", @@ -2458,7 +2483,7 @@ dependencies = [ "scale-info", "scale-typegen", "subxt-metadata", - "syn 2.0.75", + "syn 2.0.79", "thiserror", "tokio", ] @@ -2470,13 +2495,14 @@ dependencies = [ "base58", "blake2", "derive-where", + "frame-decode", "frame-metadata 16.0.0", "hashbrown", "hex", "impl-serde", "keccak-hash", "parity-scale-codec", - "primitive-types", + "primitive-types 0.12.2", "scale-bits", "scale-decode", "scale-encode", @@ -2524,13 +2550,14 @@ dependencies = [ "quote", "scale-typegen", "subxt-codegen", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] name = "subxt-metadata" version = "0.37.0" dependencies = [ + "frame-decode", "frame-metadata 16.0.0", "hashbrown", "parity-scale-codec", @@ -2551,9 +2578,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.75" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -2583,7 +2610,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -2644,7 +2671,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -2759,7 +2786,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -2828,6 +2855,18 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "uint" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "909988d098b2f738727b161a106cfc7cab00c539c2687a8836f8e565976fb53e" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "unicode-bidi" version = "0.3.15" @@ -2929,7 +2968,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", "wasm-bindgen-shared", ] @@ -2963,7 +3002,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2997,7 +3036,7 @@ checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -3248,7 +3287,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] [[package]] @@ -3268,5 +3307,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.79", ] From 50a4c2b19d6901b34a152add02c3177118ad91ba Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Thu, 3 Oct 2024 17:50:02 +0200 Subject: [PATCH 3/3] remove missed unstable stuff --- testing/integration-tests/src/utils/context.rs | 2 +- testing/integration-tests/src/utils/node_proc.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testing/integration-tests/src/utils/context.rs b/testing/integration-tests/src/utils/context.rs index 7542a0dac4..bcab4c729a 100644 --- a/testing/integration-tests/src/utils/context.rs +++ b/testing/integration-tests/src/utils/context.rs @@ -35,5 +35,5 @@ pub async fn test_context() -> TestContext { } pub async fn test_context_reconnecting_rpc_client() -> TestContext { - test_context_with("alice".to_string(), RpcClientKind::UnstableReconnecting).await + test_context_with("alice".to_string(), RpcClientKind::Reconnecting).await } diff --git a/testing/integration-tests/src/utils/node_proc.rs b/testing/integration-tests/src/utils/node_proc.rs index 96e2cbd22a..90249e1fe7 100644 --- a/testing/integration-tests/src/utils/node_proc.rs +++ b/testing/integration-tests/src/utils/node_proc.rs @@ -16,7 +16,7 @@ use subxt::{ // The URL that we'll connect to for our tests comes from SUBXT_TEXT_HOST env var, // defaulting to localhost if not provided. If the env var is set, we won't spawn // a binary. Note though that some tests expect and modify a fresh state, and so will -// fail. Fo a similar reason wyou should also use `--test-threads 1` when running tests +// fail. For a similar reason you should also use `--test-threads 1` when running tests // to reduce the number of conflicts between state altering tests. const URL_ENV_VAR: &str = "SUBXT_TEST_URL"; fn is_url_provided() -> bool { @@ -124,7 +124,7 @@ where /// Kind of rpc client to use in tests pub enum RpcClientKind { Legacy, - UnstableReconnecting, + Reconnecting, } /// Construct a test node process. @@ -187,7 +187,7 @@ impl TestNodeProcessBuilder { let ws_url = get_url(proc.as_ref().map(|p| p.ws_port())); let rpc_client = match self.rpc_client { RpcClientKind::Legacy => build_rpc_client(&ws_url).await, - RpcClientKind::UnstableReconnecting => build_unstable_rpc_client(&ws_url).await, + RpcClientKind::Reconnecting => build_reconnecting_rpc_client(&ws_url).await, } .map_err(|e| format!("Failed to connect to node at {ws_url}: {e}"))?; @@ -232,7 +232,7 @@ async fn build_rpc_client(ws_url: &str) -> Result { Ok(rpc_client) } -async fn build_unstable_rpc_client(ws_url: &str) -> Result { +async fn build_reconnecting_rpc_client(ws_url: &str) -> Result { let client = RpcClientBuilder::new() .retry_policy(ExponentialBackoff::from_millis(100).max_delay(Duration::from_secs(10))) .build(ws_url.to_string())