Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stabilize reconnecting-rpc-client #1803

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ jobs:
uses: actions-rs/[email protected]
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
Expand Down Expand Up @@ -295,7 +295,7 @@ jobs:
uses: actions-rs/[email protected]
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
Expand Down
4 changes: 2 additions & 2 deletions subxt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ web = [
runtime = ["tokio/rt", "wasm-bindgen-futures"]

# Enable this to use the reconnecting rpc client
unstable-reconnecting-rpc-client = ["dep:finito", "jsonrpsee"]
reconnecting-rpc-client = ["dep:finito", "jsonrpsee"]

# Enable this to use jsonrpsee (allowing for example `OnlineClient::from_url`).
jsonrpsee = [
Expand Down Expand Up @@ -165,7 +165,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"]
Expand Down
2 changes: 1 addition & 1 deletion subxt/examples/setup_reconnecting_rpc_client.rs
Original file line number Diff line number Diff line change
@@ -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"`
Expand Down
4 changes: 2 additions & 2 deletions subxt/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
)*
}
Expand Down
2 changes: 1 addition & 1 deletion testing/integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion testing/integration-tests/src/utils/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 4 additions & 4 deletions testing/integration-tests/src/utils/node_proc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -124,7 +124,7 @@ where
/// Kind of rpc client to use in tests
pub enum RpcClientKind {
Legacy,
UnstableReconnecting,
Reconnecting,
}

/// Construct a test node process.
Expand Down Expand Up @@ -153,7 +153,7 @@ impl TestNodeProcessBuilder {
}
}

/// Set the testRunner to use a preferred RpcClient impl, ie Legacy or Unstable
/// Set the testRunner to use a preferred RpcClient impl, ie Legacy or Reconnecting.
pub fn with_rpc_client_kind(&mut self, rpc_client_kind: RpcClientKind) -> &mut Self {
self.rpc_client = rpc_client_kind;
self
Expand Down Expand Up @@ -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_reconnecting_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}"))?;

Expand Down
2 changes: 1 addition & 1 deletion testing/wasm-rpc-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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", "runtime"] }
subxt = { path = "../../subxt", default-features = false, features = ["web", "jsonrpsee", "reconnecting-rpc-client"] }
Loading