Skip to content

Commit

Permalink
Dependency updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
kukabi committed Apr 20, 2024
1 parent 0da2669 commit c984d42
Show file tree
Hide file tree
Showing 34 changed files with 184 additions and 151 deletions.
153 changes: 91 additions & 62 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion subvt-governance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rust-version = "1.67.0"
anyhow = { workspace = true }
lazy_static = { workspace = true }
log = { workspace = true }
reqwest = { version = "0.11", features = ["blocking", "json", "gzip", "brotli"] }
reqwest = { version = "0.12", features = ["blocking", "json", "gzip", "brotli"] }
serde_json = "1.0"
subvt-config = { path = "../subvt-config" }
subvt-types = { path = "../subvt-types" }
Expand Down
2 changes: 1 addition & 1 deletion subvt-network-status-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jsonrpsee = { version = "0.22", features = ["full"] }
lazy_static = { workspace = true }
log = { workspace = true }
once_cell = "1"
redis = { version = "0.24", features = ["tokio-comp"] }
redis = { version = "0.25", features = ["tokio-comp"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
subvt-config = { path = "../subvt-config" }
Expand Down
8 changes: 4 additions & 4 deletions subvt-network-status-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use futures_util::StreamExt as _;
use jsonrpsee::server::{RpcModule, ServerBuilder, ServerHandle};
use jsonrpsee::SubscriptionMessage;
use lazy_static::lazy_static;
use redis::aio::Connection;
use redis::aio::MultiplexedConnection;
use std::sync::{Arc, Mutex, RwLock};
use subvt_config::Config;
use subvt_service_common::Service;
Expand All @@ -32,7 +32,7 @@ pub struct NetworkStatusServer;

impl NetworkStatusServer {
async fn read_current_network_status(
connection: &mut Connection,
connection: &mut MultiplexedConnection,
) -> anyhow::Result<NetworkStatus> {
let key = format!("subvt:{}:network_status", CONFIG.substrate.chain);
let status_json_string: String = redis::cmd("GET")
Expand Down Expand Up @@ -145,14 +145,14 @@ impl Service for NetworkStatusServer {
CONFIG.redis.url
))?;

let mut pubsub_connection = redis_client.get_async_connection().await?.into_pubsub();
let mut pubsub_connection = redis_client.get_async_pubsub().await?;
pubsub_connection
.subscribe(format!(
"subvt:{}:network_status:publish:best_block_number",
CONFIG.substrate.chain
))
.await?;
let mut data_connection = redis_client.get_async_connection().await?;
let mut data_connection = redis_client.get_multiplexed_async_connection().await?;
metrics::subscription_count().set(0);
let server_stop_handle = NetworkStatusServer::run_rpc_server(&current_status, &bus).await?;

Expand Down
2 changes: 1 addition & 1 deletion subvt-network-status-updater/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ chrono = "0.4"
lazy_static = { workspace = true }
log = { workspace = true }
once_cell = "1"
redis = { version = "0.24", features = ["tokio-comp"] }
redis = { version = "0.25", features = ["tokio-comp"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
subvt-config = { path = "../subvt-config" }
Expand Down
11 changes: 7 additions & 4 deletions subvt-network-status-updater/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ impl NetworkStatusUpdater {
/// Updates the Redis database with the given network status data.
async fn update_redis(status: &NetworkStatus) -> anyhow::Result<()> {
let redis_client = redis::Client::open(CONFIG.redis.url.as_str())?;
let mut redis_connection = redis_client.get_async_connection().await.context(format!(
"Cannot connect to Redis at URL {}.",
CONFIG.redis.url
))?;
let mut redis_connection = redis_client
.get_multiplexed_async_connection()
.await
.context(format!(
"Cannot connect to Redis at URL {}.",
CONFIG.redis.url
))?;
let status_json_string = serde_json::to_string(status)?;
let mut redis_cmd_pipeline = Pipeline::new();
redis_cmd_pipeline
Expand Down
2 changes: 1 addition & 1 deletion subvt-nft/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ rust-version = "1.67.0"
anyhow = { workspace = true }
lazy_static = { workspace = true }
log = { workspace = true }
reqwest = { version = "0.11", features = ["blocking", "json", "gzip", "brotli"] }
reqwest = { version = "0.12", features = ["blocking", "json", "gzip", "brotli"] }
subvt-config = { path = "../subvt-config" }
subvt-types = { path = "../subvt-types" }
2 changes: 1 addition & 1 deletion subvt-notification-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ futures-util = "0.3"
lazy_static = { workspace = true }
log = { workspace = true }
once_cell = "1"
redis = "0.24"
redis = "0.25"
rustc-hash = "1.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::NotificationGenerator;
use anyhow::Context;
use redis::aio::Connection as RedisConnection;
use redis::aio::MultiplexedConnection as RedisConnection;
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
use std::str::FromStr;
use std::sync::Arc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Context;
use redis::aio::Connection as RedisConnection;
use redis::aio::MultiplexedConnection as RedisConnection;
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
use subvt_types::subvt::ValidatorDetails;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use crate::{metrics, NotificationGenerator, CONFIG};
use anyhow::Context;
use futures_util::StreamExt as _;
use redis::aio::Connection as RedisConnection;
use redis::aio::MultiplexedConnection as RedisConnection;
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
use std::sync::atomic::AtomicU32;
use std::sync::Arc;
Expand Down Expand Up @@ -140,9 +140,8 @@ impl NotificationGenerator {
"Cannot connect to Redis at URL {}.",
CONFIG.redis.url
))?;
let mut redis_pubsub_connection =
redis_client.get_async_connection().await?.into_pubsub();
let mut redis_data_connection = redis_client.get_async_connection().await?;
let mut redis_pubsub_connection = redis_client.get_async_pubsub().await?;
let mut redis_data_connection = redis_client.get_multiplexed_async_connection().await?;
redis_pubsub_connection
.subscribe(format!(
"subvt:{}:validators:publish:finalized_block_number",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{NotificationGenerator, CONFIG};
use anyhow::Context;
use chrono::Utc;
use redis::aio::Connection as RedisConnection;
use redis::aio::MultiplexedConnection as RedisConnection;
use rustc_hash::FxHashMap as HashMap;
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::Arc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::NotificationGenerator;
use anyhow::Context;
use redis::aio::Connection as RedisConnection;
use redis::aio::MultiplexedConnection as RedisConnection;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion subvt-notification-processor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lettre = { version = "0.11", default-features = true, features = ["tokio1-native
lettre_email = "0.9"
log = { workspace = true }
once_cell = "1"
redis = { version = "0.24", features = ["tokio-comp"] }
redis = { version = "0.25", features = ["tokio-comp"] }
rustc-hash = "1.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions subvt-notification-processor/src/processor/era_epoch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ impl NotificationProcessor {
"Cannot connect to {} Redis at URL {redis_url}.",
network.display,
))?;
let mut data_connection = redis.get_async_connection().await?;
let mut pubsub_connection = redis.get_async_connection().await?.into_pubsub();
let mut data_connection = redis.get_multiplexed_async_connection().await?;
let mut pubsub_connection = redis.get_async_pubsub().await?;
let mut maybe_active_era_index: Option<u32> = None;
let mut maybe_current_epoch_index: Option<u64> = None;
pubsub_connection
Expand Down
2 changes: 1 addition & 1 deletion subvt-onekv-updater/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ log = { workspace = true }
once_cell = "1"
prometheus = { version = "0.13", features = ["process"] }
rand = "0.8"
reqwest = { version = "0.11", features = ["blocking", "json", "gzip", "brotli"] }
reqwest = { version = "0.12", features = ["blocking", "json", "gzip", "brotli"] }
subvt-config = { path = "../subvt-config" }
subvt-metrics = { path = "../subvt-metrics" }
subvt-persistence = { path = "../subvt-persistence" }
Expand Down
2 changes: 1 addition & 1 deletion subvt-persistence/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ hex = "0.4"
lazy_static = { workspace = true }
log = { workspace = true }
parity-scale-codec = "3.6"
redis = { version = "0.24", features = ["tokio-comp"] }
redis = { version = "0.25", features = ["tokio-comp"] }
rustc-hash = "1.1"
serde = { version = "1.0" }
serde_json = "1.0"
Expand Down
18 changes: 9 additions & 9 deletions subvt-persistence/src/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Redis {
&self,
block_summary: &BlockSummary,
) -> anyhow::Result<()> {
let mut connection = self.client.get_async_connection().await?;
let mut connection = self.client.get_multiplexed_async_connection().await?;
redis::cmd("MSET")
.arg(format!(
"subvt:{}:validators:finalized_block_number",
Expand All @@ -54,7 +54,7 @@ impl Redis {
finalized_block_number: u64,
account_id: &AccountId,
) -> anyhow::Result<()> {
let mut connection = self.client.get_async_connection().await?;
let mut connection = self.client.get_multiplexed_async_connection().await?;
redis::cmd("SADD")
.arg(format!(
"subvt:{}:validators:{finalized_block_number}:active:account_id_set",
Expand All @@ -71,7 +71,7 @@ impl Redis {
finalized_block_number: u64,
validator_details: &ValidatorDetails,
) -> anyhow::Result<()> {
let mut connection = self.client.get_async_connection().await?;
let mut connection = self.client.get_multiplexed_async_connection().await?;
let validator_details_json = serde_json::to_string(validator_details)?;
redis::cmd("SET")
.arg(format!(
Expand All @@ -97,7 +97,7 @@ impl Redis {
"subvt:{}:validators:finalized_block_timestamp",
CONFIG.substrate.chain
);
let mut connection = self.client.get_async_connection().await?;
let mut connection = self.client.get_multiplexed_async_connection().await?;
let (number, hash, timestamp) = redis::cmd("MGET")
.arg(&[number_key, hash_key, timestamp_key])
.query_async(&mut connection)
Expand All @@ -114,7 +114,7 @@ impl Redis {
account_id: &AccountId,
) -> anyhow::Result<bool> {
let block_summary = self.get_finalized_block_summary().await?;
let mut connection = self.client.get_async_connection().await?;
let mut connection = self.client.get_multiplexed_async_connection().await?;
let active_set_key = format!(
"subvt:{}:validators:{}:active:account_id_set",
CONFIG.substrate.chain, block_summary.number
Expand Down Expand Up @@ -143,7 +143,7 @@ impl Redis {
if !self.validator_exists_by_account_id(account_id).await? {
return Ok(None);
}
let mut connection = self.client.get_async_connection().await?;
let mut connection = self.client.get_multiplexed_async_connection().await?;
let active_validator_key = format!(
"subvt:{}:validators:{finalized_block_number}:active:validator:{account_id}",
CONFIG.substrate.chain,
Expand All @@ -169,7 +169,7 @@ impl Redis {
}

pub async fn set_network_status(&self, network_status: &NetworkStatus) -> anyhow::Result<()> {
let mut connection = self.client.get_async_connection().await?;
let mut connection = self.client.get_multiplexed_async_connection().await?;
let network_status_json = serde_json::to_string(network_status)?;
redis::cmd("SET")
.arg(format!("subvt:{}:network_status", CONFIG.substrate.chain))
Expand All @@ -180,7 +180,7 @@ impl Redis {
}

pub async fn get_network_status(&self) -> anyhow::Result<NetworkStatus> {
let mut connection = self.client.get_async_connection().await?;
let mut connection = self.client.get_multiplexed_async_connection().await?;
let key = format!("subvt:{}:network_status", CONFIG.substrate.chain);
let status_json_string: String = redis::cmd("GET")
.arg(key)
Expand All @@ -197,7 +197,7 @@ impl Redis {
finalized_block_number: u64,
is_active: bool,
) -> anyhow::Result<Vec<ValidatorSummary>> {
let mut connection = self.client.get_async_connection().await?;
let mut connection = self.client.get_multiplexed_async_connection().await?;
let prefix = format!(
"subvt:{}:validators:{}:{}",
CONFIG.substrate.chain,
Expand Down
6 changes: 3 additions & 3 deletions subvt-plotter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ log = { workspace = true }
lazy_static = { workspace = true }
thiserror = { workspace = true }
rand = "0.8.5"
resvg = "0.40"
resvg = "0.41"
rustc-hash = "1.1.0"
subvt-config = { path = "../subvt-config" }
subvt-types = { path = "../subvt-types" }
subvt-utility = { path = "../subvt-utility" }
svg = "0.15"
svg = "0.17"
tiny-skia = "0.11"
usvg = "0.40"
usvg = "0.41"
6 changes: 3 additions & 3 deletions subvt-plotter/src/plotlib/axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ impl Axis {
AxisPosition::Left => (50, 4, 0),
AxisPosition::Right => ((self.length as i32 / 2), -42, 90),
};
let axis_label = Text::new()
let axis_label = Text::new(&self.label)
.set("x", x)
.set("y", y)
.set("text-anchor", "middle")
.set("font-size", "12px")
.set("font-family", "sans-serif")
.set("fill", "#222")
.set("transform", format!("rotate({rotate})"))
.add(TextNode::new(&self.label));
.set("transform", format!("rotate({rotate})"));
//.add(TextNode::new());
group.append(axis_label);
}

Expand Down
15 changes: 6 additions & 9 deletions subvt-plotter/src/plotlib/chart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,15 @@ impl<'a> Chart<'a> {
.set("class", "g-title")
.set("transform", format!("translate({},{})", self.width / 2, 40))
.add(
Text::new()
Text::new(&self.title)
.set("x", 0)
.set("y", 0)
.set("dy", ".35em")
.set("fill", "#222")
.set("text-anchor", "middle")
.set("font-size", "17px")
.set("font-family", "sans-serif")
.set("font-stype", "bold")
.add(TextNode::new(&self.title)),
.set("font-stype", "bold"),
);
group.append(title_group);
}
Expand All @@ -317,16 +316,15 @@ impl<'a> Chart<'a> {
.set("class", "g-subtitle")
.set("transform", format!("translate({},{})", self.width / 2, 64))
.add(
Text::new()
Text::new(&self.subtitle)
.set("x", 0)
.set("y", 0)
.set("dy", ".35em")
.set("fill", "#333")
.set("text-anchor", "middle")
.set("font-size", "14px")
.set("font-family", "sans-serif")
.set("font-style", "italic")
.add(TextNode::new(&self.subtitle)),
.set("font-style", "italic"),
);
group.append(subtitle_group);
}
Expand All @@ -340,16 +338,15 @@ impl<'a> Chart<'a> {
format!("translate({},{})", self.width - 120, 40),
)
.add(
Text::new()
Text::new(summary)
.set("x", 0)
.set("y", 0)
.set("dy", ".35em")
.set("fill", "#222")
.set("text-anchor", "middle")
.set("font-size", "15px")
.set("font-family", "sans-serif")
.set("font-style", "bold")
.add(TextNode::new(summary)),
.set("font-style", "bold"),
);
group.append(summary_group);
}
Expand Down
5 changes: 2 additions & 3 deletions subvt-plotter/src/plotlib/components/axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl AxisTick {
.set("stroke", "#333")
.set("stroke-width", "1px");

let tick_label = Text::new()
let tick_label = Text::new(formatted_label)
.set(
"transform",
format!(
Expand All @@ -146,8 +146,7 @@ impl AxisTick {
.set("text-anchor", tick_label_text_anchor)
.set("font-size", "12px")
.set("font-family", "sans-serif")
.set("fill", "#111")
.add(TextNode::new(formatted_label));
.set("fill", "#111");

group.append(tick_line);
group.append(tick_label);
Expand Down
5 changes: 2 additions & 3 deletions subvt-plotter/src/plotlib/components/bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,14 @@ impl DatumRepresentation for Bar {
),
};

let label = Text::new()
let label = Text::new(label_text)
.set(x_attr, label_x_attr_value)
.set(y_attr, self.bar_width / 2_f32)
.set("text-anchor", text_anchor)
.set("dy", ".35em")
.set("font-family", "sans-serif")
.set("fill", "#000")
.set("font-size", "13px")
.add(TextNode::new(label_text));
.set("font-size", "13px");

group.append(label);
}
Expand Down
Loading

0 comments on commit c984d42

Please sign in to comment.