Skip to content

Commit

Permalink
Merge branch 'master' into jsdw-frame-decode
Browse files Browse the repository at this point in the history
  • Loading branch information
jsdw authored Sep 30, 2024
2 parents 84ce256 + 72db833 commit 31965e0
Show file tree
Hide file tree
Showing 8 changed files with 260 additions and 307 deletions.
247 changes: 124 additions & 123 deletions Cargo.lock

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bitvec = { version = "1", default-features = false }
blake2 = { version = "0.10.6", default-features = false }
clap = { version = "4.5.18", features = ["derive", "cargo"] }
cfg-if = "1.0.0"
criterion = "0.4"
criterion = "0.5.1"
codec = { package = "parity-scale-codec", version = "3.6.9", default-features = false }
color-eyre = "0.6.3"
console_error_panic_hook = "0.1.7"
Expand Down Expand Up @@ -103,7 +103,7 @@ scale-typegen = "0.8.0"
scale-typegen-description = "0.8.0"
serde = { version = "1.0.210", default-features = false, features = ["derive"] }
serde_json = { version = "1.0.128", default-features = false }
syn = { version = "2.0.15", features = ["full", "extra-traits"] }
syn = { version = "2.0.77", features = ["full", "extra-traits"] }
thiserror = "1.0.64"
tokio = { version = "1.40", default-features = false }
tracing = { version = "0.1.40", default-features = false }
Expand All @@ -113,7 +113,7 @@ trybuild = "1.0.99"
url = "2.5.2"
wabt = "0.10.0"
wasm-bindgen-test = "0.3.24"
which = "5.0.0"
which = "6.0.3"
strip-ansi-escapes = "0.2.0"
proptest = "1.5.0"
hex-literal = "0.4.1"
Expand Down Expand Up @@ -141,7 +141,7 @@ tokio-util = "0.7.12"
# Substrate crates:
sp-core = { version = "34.0.0", default-features = false }
sp-crypto-hashing = { version = "0.1.0", default-features = false }
sp-runtime = "39.0.0"
sp-runtime = "39.0.1"
sp-keyring = "39.0.0"
sp-maybe-compressed-blob = "11.0.0"
sp-state-machine = "0.43.0"
Expand All @@ -164,16 +164,15 @@ bip32 = { version = "0.5.2", default-features = false }
hmac = { version = "0.12.1", default-features = false }
pbkdf2 = { version = "0.12.2", default-features = false }
schnorrkel = { version = "0.11.4", default-features = false }
secp256k1 = { version = "0.28.2", default-features = false }
keccak-hash = { version = "0.10.0", default-features = false }
secrecy = "0.8.0"
secp256k1 = { version = "0.29.1", default-features = false }
keccak-hash = { version = "0.11.0", default-features = false }
secrecy = "0.10.2"
sha2 = { version = "0.10.8", default-features = false }
zeroize = { version = "1", default-features = false }
base64 = { version = "0.22.1", default-features = false }
scrypt = { version = "0.11.0", default-features = false }
crypto_secretbox = { version = "0.1.1", default-features = false }


[profile.dev.package.smoldot-light]
opt-level = 2
[profile.test.package.smoldot-light]
Expand Down
8 changes: 3 additions & 5 deletions signer/src/crypto/secret_uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use core::fmt::Display;

use super::DeriveJunction;
use alloc::vec::Vec;
use alloc::{string::ToString, vec::Vec};
use regex::Regex;
use secrecy::SecretString;

Expand Down Expand Up @@ -108,10 +108,8 @@ impl core::str::FromStr for SecretUri {
let password = cap.name("password");

Ok(Self {
phrase: SecretString::from_str(phrase).expect("Returns infallible error; qed"),
password: password.map(|v| {
SecretString::from_str(v.as_str()).expect("Returns infallible error; qed")
}),
phrase: SecretString::from(phrase.to_string()),
password: password.map(|v| SecretString::from(v.as_str().to_string())),
junctions,
})
}
Expand Down
4 changes: 2 additions & 2 deletions signer/src/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ impl Keypair {
let seed = SecretKeyBytes::from_hex(hex_str)?;
Self::from_secret_key(seed)?
} else {
let phrase = bip39::Mnemonic::from_str(phrase.expose_secret().as_str())?;
let pass_str = password.as_ref().map(|p| p.expose_secret().as_str());
let phrase = bip39::Mnemonic::from_str(phrase.expose_secret())?;
let pass_str = password.as_ref().map(|p| p.expose_secret());
Self::from_phrase(&phrase, pass_str)?
};

Expand Down
4 changes: 2 additions & 2 deletions signer/src/sr25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ impl Keypair {
let seed = SecretKeyBytes::from_hex(hex_str)?;
Self::from_secret_key(seed)?
} else {
let phrase = bip39::Mnemonic::from_str(phrase.expose_secret().as_str())?;
let pass_str = password.as_ref().map(|p| p.expose_secret().as_str());
let phrase = bip39::Mnemonic::from_str(phrase.expose_secret())?;
let pass_str = password.as_ref().map(|p| p.expose_secret());
Self::from_phrase(&phrase, pass_str)?
};

Expand Down
10 changes: 6 additions & 4 deletions subxt/src/backend/rpc/reconnecting_rpc_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ use tokio::sync::{
mpsc::{self, UnboundedReceiver, UnboundedSender},
oneshot, Notify,
};
use url::Url;
use utils::display_close_reason;

// re-exports
Expand Down Expand Up @@ -359,10 +360,11 @@ where
}

/// Build and connect to the target.
pub async fn build(self, url: String) -> Result<RpcClient, RpcError> {
pub async fn build(self, url: impl AsRef<str>) -> Result<RpcClient, RpcError> {
let url = Url::parse(url.as_ref()).map_err(|e| RpcError::Transport(Box::new(e)))?;
let (tx, rx) = mpsc::unbounded_channel();
let client = Retry::new(self.retry_policy.clone(), || {
platform::ws_client(url.as_ref(), &self)
platform::ws_client(&url, &self)
})
.await?;

Expand Down Expand Up @@ -462,7 +464,7 @@ impl RpcClientT for RpcClient {
async fn background_task<P>(
mut client: Arc<WsClient>,
mut rx: UnboundedReceiver<Op>,
url: String,
url: Url,
client_builder: RpcClientBuilder<P>,
) where
P: Iterator<Item = Duration> + Send + 'static + Clone,
Expand Down Expand Up @@ -610,7 +612,7 @@ async fn subscription_handler(
}

struct ReconnectParams<'a, P> {
url: &'a str,
url: &'a Url,
client_builder: &'a RpcClientBuilder<P>,
close_reason: RpcError,
}
Expand Down
9 changes: 5 additions & 4 deletions subxt/src/backend/rpc/reconnecting_rpc_client/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use crate::backend::rpc::reconnecting_rpc_client::{RpcClientBuilder, RpcError};
use jsonrpsee::core::client::Client;
use std::sync::Arc;
use url::Url;

#[cfg(feature = "native")]
pub use tokio::spawn;
Expand All @@ -14,7 +15,7 @@ pub use wasm_bindgen_futures::spawn_local as spawn;

#[cfg(feature = "native")]
pub async fn ws_client<P>(
url: &str,
url: &Url,
builder: &RpcClientBuilder<P>,
) -> Result<Arc<Client>, RpcError> {
use jsonrpsee::ws_client::WsClientBuilder;
Expand Down Expand Up @@ -50,14 +51,14 @@ pub async fn ws_client<P>(
ws_client_builder = ws_client_builder.enable_ws_ping(*ping);
}

let client = ws_client_builder.build(url).await?;
let client = ws_client_builder.build(url.as_str()).await?;

Ok(Arc::new(client))
}

#[cfg(feature = "web")]
pub async fn ws_client<P>(
url: &str,
url: &Url,
builder: &RpcClientBuilder<P>,
) -> Result<Arc<Client>, RpcError> {
use jsonrpsee::wasm_client::WasmClientBuilder;
Expand All @@ -77,7 +78,7 @@ pub async fn ws_client<P>(
.request_timeout(*request_timeout)
.id_format(*id_kind);

let client = ws_client_builder.build(url).await?;
let client = ws_client_builder.build(url.as_str()).await?;

Ok(Arc::new(client))
}
Loading

0 comments on commit 31965e0

Please sign in to comment.