From c7426458d71ac84645a76eda23491a641c58e3af Mon Sep 17 00:00:00 2001 From: kukabi Date: Tue, 5 Dec 2023 13:30:07 +0300 Subject: [PATCH] Report service substrate client structure change pt1. --- _docker/compose/.env.sample | 2 +- subvt-app-service/Cargo.toml | 2 +- subvt-block-processor/Cargo.toml | 2 +- subvt-config/Cargo.toml | 2 +- subvt-governance/Cargo.toml | 2 +- subvt-logging/Cargo.toml | 2 +- subvt-metrics/Cargo.toml | 2 +- subvt-network-status-server/Cargo.toml | 2 +- subvt-network-status-updater/Cargo.toml | 2 +- subvt-nft/Cargo.toml | 2 +- subvt-notification-generator/Cargo.toml | 2 +- subvt-notification-processor/Cargo.toml | 2 +- subvt-onekv-updater/Cargo.toml | 2 +- subvt-persistence/Cargo.toml | 2 +- subvt-plotter/Cargo.toml | 2 +- subvt-proc-macro/Cargo.toml | 2 +- subvt-referendum-updater/Cargo.toml | 2 +- subvt-report-service/Cargo.toml | 2 +- subvt-report-service/src/validator/mod.rs | 12 ++++++------ subvt-service-common/Cargo.toml | 2 +- subvt-substrate-client/Cargo.toml | 2 +- subvt-telegram-bot/Cargo.toml | 2 +- subvt-telemetry-processor/Cargo.toml | 2 +- subvt-types/Cargo.toml | 2 +- subvt-utility/Cargo.toml | 2 +- subvt-validator-details-server/Cargo.toml | 2 +- subvt-validator-list-server/Cargo.toml | 2 +- subvt-validator-list-updater/Cargo.toml | 2 +- 28 files changed, 33 insertions(+), 33 deletions(-) diff --git a/_docker/compose/.env.sample b/_docker/compose/.env.sample index 8ad6e505..871f1fc9 100644 --- a/_docker/compose/.env.sample +++ b/_docker/compose/.env.sample @@ -1,4 +1,4 @@ -VERSION=0.17.10 +VERSION=0.17.11 ENV=production LOG_LEVEL=debug diff --git a/subvt-app-service/Cargo.toml b/subvt-app-service/Cargo.toml index c868eab5..75278559 100644 --- a/subvt-app-service/Cargo.toml +++ b/subvt-app-service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-app-service" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-block-processor/Cargo.toml b/subvt-block-processor/Cargo.toml index 830d37b3..962a849f 100644 --- a/subvt-block-processor/Cargo.toml +++ b/subvt-block-processor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-block-processor" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-config/Cargo.toml b/subvt-config/Cargo.toml index 8b2a9e43..dcea3e34 100644 --- a/subvt-config/Cargo.toml +++ b/subvt-config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-config" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-governance/Cargo.toml b/subvt-governance/Cargo.toml index 8f0d90b1..513f1277 100644 --- a/subvt-governance/Cargo.toml +++ b/subvt-governance/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-governance" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-logging/Cargo.toml b/subvt-logging/Cargo.toml index 9b5bf289..8dbf5560 100644 --- a/subvt-logging/Cargo.toml +++ b/subvt-logging/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-logging" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-metrics/Cargo.toml b/subvt-metrics/Cargo.toml index 12b336ea..e9e08420 100644 --- a/subvt-metrics/Cargo.toml +++ b/subvt-metrics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-metrics" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-network-status-server/Cargo.toml b/subvt-network-status-server/Cargo.toml index bc48feab..28281603 100644 --- a/subvt-network-status-server/Cargo.toml +++ b/subvt-network-status-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-network-status-server" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-network-status-updater/Cargo.toml b/subvt-network-status-updater/Cargo.toml index 24132bc8..3731f160 100644 --- a/subvt-network-status-updater/Cargo.toml +++ b/subvt-network-status-updater/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-network-status-updater" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-nft/Cargo.toml b/subvt-nft/Cargo.toml index 1c8b46d6..1ef14244 100644 --- a/subvt-nft/Cargo.toml +++ b/subvt-nft/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-nft" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-notification-generator/Cargo.toml b/subvt-notification-generator/Cargo.toml index ab3dc1ac..4fd8c687 100644 --- a/subvt-notification-generator/Cargo.toml +++ b/subvt-notification-generator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-notification-generator" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-notification-processor/Cargo.toml b/subvt-notification-processor/Cargo.toml index 7b0345e2..76019e3f 100644 --- a/subvt-notification-processor/Cargo.toml +++ b/subvt-notification-processor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-notification-processor" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-onekv-updater/Cargo.toml b/subvt-onekv-updater/Cargo.toml index 79a395da..e1bf741b 100644 --- a/subvt-onekv-updater/Cargo.toml +++ b/subvt-onekv-updater/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-onekv-updater" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-persistence/Cargo.toml b/subvt-persistence/Cargo.toml index 907e9b52..59d3c368 100644 --- a/subvt-persistence/Cargo.toml +++ b/subvt-persistence/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-persistence" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-plotter/Cargo.toml b/subvt-plotter/Cargo.toml index 5a212e3f..5758ce57 100644 --- a/subvt-plotter/Cargo.toml +++ b/subvt-plotter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-plotter" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-proc-macro/Cargo.toml b/subvt-proc-macro/Cargo.toml index fb814b55..335c7ff3 100644 --- a/subvt-proc-macro/Cargo.toml +++ b/subvt-proc-macro/Cargo.toml @@ -3,7 +3,7 @@ proc-macro = true [package] name = "subvt-proc-macro" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-referendum-updater/Cargo.toml b/subvt-referendum-updater/Cargo.toml index ac300128..c35b6998 100644 --- a/subvt-referendum-updater/Cargo.toml +++ b/subvt-referendum-updater/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-referendum-updater" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-report-service/Cargo.toml b/subvt-report-service/Cargo.toml index 24f6be7f..71695c50 100644 --- a/subvt-report-service/Cargo.toml +++ b/subvt-report-service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-report-service" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-report-service/src/validator/mod.rs b/subvt-report-service/src/validator/mod.rs index 1eeb8a35..87def4f1 100644 --- a/subvt-report-service/src/validator/mod.rs +++ b/subvt-report-service/src/validator/mod.rs @@ -1,7 +1,8 @@ -use crate::{ResultResponse, ServiceState}; +use crate::{ResultResponse, ServiceState, CONFIG}; use actix_web::{get, web, HttpResponse}; use serde::Deserialize; use std::str::FromStr; +use subvt_substrate_client::SubstrateClient; use subvt_types::crypto::AccountId; use subvt_types::err::ServiceError; use subvt_types::report::{ @@ -253,11 +254,12 @@ pub(crate) async fn validator_reward_chart_service( query: web::Query, data: web::Data, ) -> ResultResponse { + let substrate_client = SubstrateClient::new(&CONFIG).await?; let rewards = data .postgres .get_validator_total_rewards(query.start_timestamp, query.end_timestamp) .await?; - let block_hash = data.substrate_client.get_current_block_hash().await?; + let block_hash = substrate_client.get_current_block_hash().await?; let account_ids: Vec = rewards .iter() .map(|reward| reward.validator_account_id) @@ -271,8 +273,7 @@ pub(crate) async fn validator_reward_chart_service( } } } - let new_accounts = data - .substrate_client + let new_accounts = substrate_client .get_accounts(&new_account_ids, false, &block_hash) .await?; let parent_account_ids: Vec = new_accounts @@ -288,8 +289,7 @@ pub(crate) async fn validator_reward_chart_service( } } } - let new_parent_accounts = data - .substrate_client + let new_parent_accounts = substrate_client .get_accounts(&new_parent_account_ids, false, &block_hash) .await?; // write new accounts to cache diff --git a/subvt-service-common/Cargo.toml b/subvt-service-common/Cargo.toml index 2028b7be..eddcdd41 100644 --- a/subvt-service-common/Cargo.toml +++ b/subvt-service-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-service-common" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-substrate-client/Cargo.toml b/subvt-substrate-client/Cargo.toml index 44418624..487228cb 100644 --- a/subvt-substrate-client/Cargo.toml +++ b/subvt-substrate-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-substrate-client" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-telegram-bot/Cargo.toml b/subvt-telegram-bot/Cargo.toml index 6bbe57a1..1df14d8f 100644 --- a/subvt-telegram-bot/Cargo.toml +++ b/subvt-telegram-bot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-telegram-bot" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-telemetry-processor/Cargo.toml b/subvt-telemetry-processor/Cargo.toml index 97c8d4ab..50282007 100644 --- a/subvt-telemetry-processor/Cargo.toml +++ b/subvt-telemetry-processor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-telemetry-processor" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-types/Cargo.toml b/subvt-types/Cargo.toml index 61d59db2..56597049 100644 --- a/subvt-types/Cargo.toml +++ b/subvt-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-types" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-utility/Cargo.toml b/subvt-utility/Cargo.toml index fba9d807..aef07dc6 100644 --- a/subvt-utility/Cargo.toml +++ b/subvt-utility/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-utility" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-validator-details-server/Cargo.toml b/subvt-validator-details-server/Cargo.toml index 21e45b40..0ee269f6 100644 --- a/subvt-validator-details-server/Cargo.toml +++ b/subvt-validator-details-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-validator-details-server" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-validator-list-server/Cargo.toml b/subvt-validator-list-server/Cargo.toml index 60f9d92a..9fb7d172 100644 --- a/subvt-validator-list-server/Cargo.toml +++ b/subvt-validator-list-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-validator-list-server" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0" diff --git a/subvt-validator-list-updater/Cargo.toml b/subvt-validator-list-updater/Cargo.toml index bc14e24d..5b68e3ae 100644 --- a/subvt-validator-list-updater/Cargo.toml +++ b/subvt-validator-list-updater/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subvt-validator-list-updater" -version = "0.17.10" +version = "0.17.11" edition = "2021" rust-version = "1.67.0"