mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Unify metric names (#1209)
* unify metric names * refactor standalone metrics * headers sync metrics * post-merge fix * fix compilation * fmt * fix dashboards * fix local dashboards * update Rococo/Wococo runtime version * remove commented code * fixed grumbles * fmt * fixed widget names
This commit is contained in:
committed by
Bastian Köcher
parent
940d7e463b
commit
bbf8b51f9c
@@ -17,6 +17,8 @@
|
||||
use codec::Decode;
|
||||
use frame_support::weights::{DispatchClass, DispatchInfo, Pays, Weight};
|
||||
use relay_kusama_client::Kusama;
|
||||
use sp_core::storage::StorageKey;
|
||||
use sp_runtime::{FixedPointNumber, FixedU128};
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
use crate::cli::{
|
||||
@@ -101,3 +103,14 @@ impl CliChain for Kusama {
|
||||
anyhow::bail!("Sending messages from Kusama is not yet supported.")
|
||||
}
|
||||
}
|
||||
|
||||
/// Storage key and initial value of Polkadot -> Kusama conversion rate.
|
||||
pub(crate) fn polkadot_to_kusama_conversion_rate_params() -> (StorageKey, FixedU128) {
|
||||
(
|
||||
bp_runtime::storage_parameter_key(
|
||||
bp_kusama::POLKADOT_TO_KUSAMA_CONVERSION_RATE_PARAMETER_NAME,
|
||||
),
|
||||
// starting relay before this parameter will be set to some value may cause troubles
|
||||
FixedU128::from_inner(FixedU128::DIV),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -64,10 +64,7 @@ impl SubstrateFinalitySyncPipeline for KusamaFinalityToPolkadot {
|
||||
type TargetChain = Polkadot;
|
||||
|
||||
fn customize_metrics(params: MetricsParams) -> anyhow::Result<MetricsParams> {
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self::FinalitySyncPipeline>(
|
||||
Some(finality_relay::metrics_prefix::<Self::FinalitySyncPipeline>()),
|
||||
params,
|
||||
)
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self::FinalitySyncPipeline>(params)
|
||||
}
|
||||
|
||||
fn start_relay_guards(&self) {
|
||||
|
||||
@@ -21,7 +21,6 @@ use std::ops::RangeInclusive;
|
||||
use codec::Encode;
|
||||
use frame_support::weights::Weight;
|
||||
use sp_core::{Bytes, Pair};
|
||||
use sp_runtime::{FixedPointNumber, FixedU128};
|
||||
|
||||
use bp_messages::MessageNonce;
|
||||
use bridge_runtime_common::messages::target::FromBridgedChainMessagesProof;
|
||||
@@ -33,7 +32,6 @@ use relay_polkadot_client::{
|
||||
HeaderId as PolkadotHeaderId, Polkadot, SigningParams as PolkadotSigningParams,
|
||||
};
|
||||
use relay_substrate_client::{Chain, Client, TransactionSignScheme, UnsignedTransaction};
|
||||
use relay_utils::metrics::MetricsParams;
|
||||
use substrate_relay_helper::{
|
||||
messages_lane::{
|
||||
select_delivery_transaction_limits, MessagesRelayParams, StandaloneMessagesMetrics,
|
||||
@@ -196,12 +194,13 @@ pub async fn run(
|
||||
|
||||
let lane_id = params.lane_id;
|
||||
let source_client = params.source_client;
|
||||
let target_client = params.target_client;
|
||||
let lane = KusamaMessagesToPolkadot {
|
||||
message_lane: SubstrateMessageLaneToSubstrate {
|
||||
source_client: source_client.clone(),
|
||||
source_sign: params.source_sign,
|
||||
source_transactions_mortality: params.source_transactions_mortality,
|
||||
target_client: params.target_client.clone(),
|
||||
target_client: target_client.clone(),
|
||||
target_sign: params.target_sign,
|
||||
target_transactions_mortality: params.target_transactions_mortality,
|
||||
relayer_id_at_source: relayer_id_at_kusama,
|
||||
@@ -240,13 +239,10 @@ pub async fn run(
|
||||
stall_timeout,
|
||||
);
|
||||
|
||||
let (metrics_params, metrics_values) = add_standalone_metrics(
|
||||
Some(messages_relay::message_lane_loop::metrics_prefix::<
|
||||
<KusamaMessagesToPolkadot as SubstrateMessageLane>::MessageLane,
|
||||
>(&lane_id)),
|
||||
params.metrics_params,
|
||||
source_client.clone(),
|
||||
)?;
|
||||
let standalone_metrics = params
|
||||
.standalone_metrics
|
||||
.map(Ok)
|
||||
.unwrap_or_else(|| standalone_metrics(source_client.clone(), target_client.clone()))?;
|
||||
messages_relay::message_lane_loop::run(
|
||||
messages_relay::message_lane_loop::Params {
|
||||
lane: lane_id,
|
||||
@@ -272,41 +268,31 @@ pub async fn run(
|
||||
params.target_to_source_headers_relay,
|
||||
),
|
||||
PolkadotTargetClient::new(
|
||||
params.target_client,
|
||||
target_client,
|
||||
lane,
|
||||
lane_id,
|
||||
metrics_values,
|
||||
standalone_metrics.clone(),
|
||||
params.source_to_target_headers_relay,
|
||||
),
|
||||
metrics_params,
|
||||
standalone_metrics.register_and_spawn(params.metrics_params)?,
|
||||
futures::future::pending(),
|
||||
)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Add standalone metrics for the Kusama -> Polkadot messages loop.
|
||||
pub(crate) fn add_standalone_metrics(
|
||||
metrics_prefix: Option<String>,
|
||||
metrics_params: MetricsParams,
|
||||
/// Create standalone metrics for the Kusama -> Polkadot messages loop.
|
||||
pub(crate) fn standalone_metrics(
|
||||
source_client: Client<Kusama>,
|
||||
) -> anyhow::Result<(MetricsParams, StandaloneMessagesMetrics)> {
|
||||
let polkadot_to_kusama_conversion_rate_key = bp_runtime::storage_parameter_key(
|
||||
bp_kusama::POLKADOT_TO_KUSAMA_CONVERSION_RATE_PARAMETER_NAME,
|
||||
)
|
||||
.0;
|
||||
|
||||
substrate_relay_helper::messages_lane::add_standalone_metrics::<KusamaMessagesToPolkadot>(
|
||||
metrics_prefix,
|
||||
metrics_params,
|
||||
target_client: Client<Polkadot>,
|
||||
) -> anyhow::Result<StandaloneMessagesMetrics<Kusama, Polkadot>> {
|
||||
substrate_relay_helper::messages_lane::standalone_metrics(
|
||||
source_client,
|
||||
Some(crate::chains::polkadot::TOKEN_ID),
|
||||
target_client,
|
||||
Some(crate::chains::kusama::TOKEN_ID),
|
||||
Some((
|
||||
sp_core::storage::StorageKey(polkadot_to_kusama_conversion_rate_key),
|
||||
// starting relay before this parameter will be set to some value may cause troubles
|
||||
FixedU128::from_inner(FixedU128::DIV),
|
||||
)),
|
||||
Some(crate::chains::polkadot::TOKEN_ID),
|
||||
Some(crate::chains::polkadot::kusama_to_polkadot_conversion_rate_params()),
|
||||
Some(crate::chains::kusama::polkadot_to_kusama_conversion_rate_params()),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,17 @@ use bp_message_dispatch::{CallOrigin, MessagePayload};
|
||||
use codec::Decode;
|
||||
use frame_support::weights::{DispatchInfo, GetDispatchInfo, Weight};
|
||||
use relay_millau_client::Millau;
|
||||
use sp_core::storage::StorageKey;
|
||||
use sp_runtime::FixedU128;
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
// Millau/Rialto tokens have no any real value, so the conversion rate we use is always 1:1. But we
|
||||
// want to test our code that is intended to work with real-value chains. So to keep it close to
|
||||
// 1:1, we'll be treating Rialto as BTC and Millau as wBTC (only in relayer).
|
||||
|
||||
/// The identifier of token, which value is associated with Millau token value by relayer.
|
||||
pub(crate) const ASSOCIATED_TOKEN_ID: &str = crate::chains::kusama::TOKEN_ID;
|
||||
|
||||
impl CliEncodeCall for Millau {
|
||||
fn max_extrinsic_size() -> u32 {
|
||||
bp_millau::max_extrinsic_size()
|
||||
@@ -123,3 +132,11 @@ impl CliChain for Millau {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Storage key and initial value of Rialto -> Millau conversion rate.
|
||||
pub(crate) fn rialto_to_millau_conversion_rate_params() -> (StorageKey, FixedU128) {
|
||||
(
|
||||
StorageKey(millau_runtime::rialto_messages::RialtoToMillauConversionRate::key().to_vec()),
|
||||
millau_runtime::rialto_messages::INITIAL_RIALTO_TO_MILLAU_CONVERSION_RATE,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ use relay_rialto_client::{
|
||||
HeaderId as RialtoHeaderId, Rialto, SigningParams as RialtoSigningParams,
|
||||
};
|
||||
use relay_substrate_client::{Chain, Client, IndexOf, TransactionSignScheme, UnsignedTransaction};
|
||||
use relay_utils::metrics::MetricsParams;
|
||||
use substrate_relay_helper::{
|
||||
messages_lane::{
|
||||
select_delivery_transaction_limits, MessagesRelayParams, StandaloneMessagesMetrics,
|
||||
@@ -193,12 +192,13 @@ pub async fn run(
|
||||
|
||||
let lane_id = params.lane_id;
|
||||
let source_client = params.source_client;
|
||||
let target_client = params.target_client;
|
||||
let lane = MillauMessagesToRialto {
|
||||
message_lane: SubstrateMessageLaneToSubstrate {
|
||||
source_client: source_client.clone(),
|
||||
source_sign: params.source_sign,
|
||||
source_transactions_mortality: params.source_transactions_mortality,
|
||||
target_client: params.target_client.clone(),
|
||||
target_client: target_client.clone(),
|
||||
target_sign: params.target_sign,
|
||||
target_transactions_mortality: params.target_transactions_mortality,
|
||||
relayer_id_at_source: relayer_id_at_millau,
|
||||
@@ -234,13 +234,10 @@ pub async fn run(
|
||||
stall_timeout,
|
||||
);
|
||||
|
||||
let (metrics_params, metrics_values) = add_standalone_metrics(
|
||||
Some(messages_relay::message_lane_loop::metrics_prefix::<
|
||||
<MillauMessagesToRialto as SubstrateMessageLane>::MessageLane,
|
||||
>(&lane_id)),
|
||||
params.metrics_params,
|
||||
source_client.clone(),
|
||||
)?;
|
||||
let standalone_metrics = params
|
||||
.standalone_metrics
|
||||
.map(Ok)
|
||||
.unwrap_or_else(|| standalone_metrics(source_client.clone(), target_client.clone()))?;
|
||||
messages_relay::message_lane_loop::run(
|
||||
messages_relay::message_lane_loop::Params {
|
||||
lane: lane_id,
|
||||
@@ -266,37 +263,31 @@ pub async fn run(
|
||||
params.target_to_source_headers_relay,
|
||||
),
|
||||
RialtoTargetClient::new(
|
||||
params.target_client,
|
||||
target_client,
|
||||
lane,
|
||||
lane_id,
|
||||
metrics_values,
|
||||
standalone_metrics.clone(),
|
||||
params.source_to_target_headers_relay,
|
||||
),
|
||||
metrics_params,
|
||||
standalone_metrics.register_and_spawn(params.metrics_params)?,
|
||||
futures::future::pending(),
|
||||
)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Add standalone metrics for the Millau -> Rialto messages loop.
|
||||
pub(crate) fn add_standalone_metrics(
|
||||
metrics_prefix: Option<String>,
|
||||
metrics_params: MetricsParams,
|
||||
/// Create standalone metrics for the Millau -> Rialto messages loop.
|
||||
pub(crate) fn standalone_metrics(
|
||||
source_client: Client<Millau>,
|
||||
) -> anyhow::Result<(MetricsParams, StandaloneMessagesMetrics)> {
|
||||
substrate_relay_helper::messages_lane::add_standalone_metrics::<MillauMessagesToRialto>(
|
||||
metrics_prefix,
|
||||
metrics_params,
|
||||
target_client: Client<Rialto>,
|
||||
) -> anyhow::Result<StandaloneMessagesMetrics<Millau, Rialto>> {
|
||||
substrate_relay_helper::messages_lane::standalone_metrics(
|
||||
source_client,
|
||||
Some(crate::chains::MILLAU_ASSOCIATED_TOKEN_ID),
|
||||
Some(crate::chains::RIALTO_ASSOCIATED_TOKEN_ID),
|
||||
Some((
|
||||
sp_core::storage::StorageKey(
|
||||
millau_runtime::rialto_messages::RialtoToMillauConversionRate::key().to_vec(),
|
||||
),
|
||||
millau_runtime::rialto_messages::INITIAL_RIALTO_TO_MILLAU_CONVERSION_RATE,
|
||||
)),
|
||||
target_client,
|
||||
Some(crate::chains::millau::ASSOCIATED_TOKEN_ID),
|
||||
Some(crate::chains::rialto::ASSOCIATED_TOKEN_ID),
|
||||
Some(crate::chains::rialto::millau_to_rialto_conversion_rate_params()),
|
||||
Some(crate::chains::millau::rialto_to_millau_conversion_rate_params()),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -39,31 +39,16 @@ mod rococo;
|
||||
mod westend;
|
||||
mod wococo;
|
||||
|
||||
// Millau/Rialto tokens have no any real value, so the conversion rate we use is always 1:1. But we
|
||||
// want to test our code that is intended to work with real-value chains. So to keep it close to
|
||||
// 1:1, we'll be treating Rialto as BTC and Millau as wBTC (only in relayer).
|
||||
|
||||
/// The identifier of token, which value is associated with Rialto token value by relayer.
|
||||
pub(crate) const RIALTO_ASSOCIATED_TOKEN_ID: &str = polkadot::TOKEN_ID;
|
||||
/// The identifier of token, which value is associated with Millau token value by relayer.
|
||||
pub(crate) const MILLAU_ASSOCIATED_TOKEN_ID: &str = kusama::TOKEN_ID;
|
||||
|
||||
use relay_utils::metrics::MetricsParams;
|
||||
use relay_utils::metrics::{MetricsParams, StandaloneMetric};
|
||||
|
||||
pub(crate) fn add_polkadot_kusama_price_metrics<T: finality_relay::FinalitySyncPipeline>(
|
||||
prefix: Option<String>,
|
||||
params: MetricsParams,
|
||||
) -> anyhow::Result<MetricsParams> {
|
||||
// Polkadot/Kusama prices are added as metrics here, because atm we don't have Polkadot <->
|
||||
// Kusama relays, but we want to test metrics/dashboards in advance
|
||||
Ok(relay_utils::relay_metrics(prefix, params)
|
||||
.standalone_metric(|registry, prefix| {
|
||||
substrate_relay_helper::helpers::token_price_metric(registry, prefix, "polkadot")
|
||||
})?
|
||||
.standalone_metric(|registry, prefix| {
|
||||
substrate_relay_helper::helpers::token_price_metric(registry, prefix, "kusama")
|
||||
})?
|
||||
.into_params())
|
||||
substrate_relay_helper::helpers::token_price_metric(polkadot::TOKEN_ID)?
|
||||
.register_and_spawn(¶ms.registry)?;
|
||||
substrate_relay_helper::helpers::token_price_metric(kusama::TOKEN_ID)?
|
||||
.register_and_spawn(¶ms.registry)?;
|
||||
Ok(params)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
use codec::Decode;
|
||||
use frame_support::weights::{DispatchClass, DispatchInfo, Pays, Weight};
|
||||
use relay_polkadot_client::Polkadot;
|
||||
use sp_core::storage::StorageKey;
|
||||
use sp_runtime::{FixedPointNumber, FixedU128};
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
use crate::cli::{
|
||||
@@ -101,3 +103,14 @@ impl CliChain for Polkadot {
|
||||
anyhow::bail!("Sending messages from Polkadot is not yet supported.")
|
||||
}
|
||||
}
|
||||
|
||||
/// Storage key and initial value of Kusama -> Polkadot conversion rate.
|
||||
pub(crate) fn kusama_to_polkadot_conversion_rate_params() -> (StorageKey, FixedU128) {
|
||||
(
|
||||
bp_runtime::storage_parameter_key(
|
||||
bp_polkadot::KUSAMA_TO_POLKADOT_CONVERSION_RATE_PARAMETER_NAME,
|
||||
),
|
||||
// starting relay before this parameter will be set to some value may cause troubles
|
||||
FixedU128::from_inner(FixedU128::DIV),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -64,10 +64,7 @@ impl SubstrateFinalitySyncPipeline for PolkadotFinalityToKusama {
|
||||
type TargetChain = Kusama;
|
||||
|
||||
fn customize_metrics(params: MetricsParams) -> anyhow::Result<MetricsParams> {
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self::FinalitySyncPipeline>(
|
||||
Some(finality_relay::metrics_prefix::<Self::FinalitySyncPipeline>()),
|
||||
params,
|
||||
)
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self::FinalitySyncPipeline>(params)
|
||||
}
|
||||
|
||||
fn start_relay_guards(&self) {
|
||||
|
||||
@@ -32,8 +32,6 @@ use relay_polkadot_client::{
|
||||
HeaderId as PolkadotHeaderId, Polkadot, SigningParams as PolkadotSigningParams,
|
||||
};
|
||||
use relay_substrate_client::{Chain, Client, TransactionSignScheme, UnsignedTransaction};
|
||||
use relay_utils::metrics::MetricsParams;
|
||||
use sp_runtime::{FixedPointNumber, FixedU128};
|
||||
use substrate_relay_helper::{
|
||||
messages_lane::{
|
||||
select_delivery_transaction_limits, MessagesRelayParams, StandaloneMessagesMetrics,
|
||||
@@ -195,12 +193,13 @@ pub async fn run(
|
||||
|
||||
let lane_id = params.lane_id;
|
||||
let source_client = params.source_client;
|
||||
let target_client = params.target_client;
|
||||
let lane = PolkadotMessagesToKusama {
|
||||
message_lane: SubstrateMessageLaneToSubstrate {
|
||||
source_client: source_client.clone(),
|
||||
source_sign: params.source_sign,
|
||||
source_transactions_mortality: params.source_transactions_mortality,
|
||||
target_client: params.target_client.clone(),
|
||||
target_client: target_client.clone(),
|
||||
target_sign: params.target_sign,
|
||||
target_transactions_mortality: params.target_transactions_mortality,
|
||||
relayer_id_at_source: relayer_id_at_polkadot,
|
||||
@@ -239,13 +238,10 @@ pub async fn run(
|
||||
stall_timeout,
|
||||
);
|
||||
|
||||
let (metrics_params, metrics_values) = add_standalone_metrics(
|
||||
Some(messages_relay::message_lane_loop::metrics_prefix::<
|
||||
<PolkadotMessagesToKusama as SubstrateMessageLane>::MessageLane,
|
||||
>(&lane_id)),
|
||||
params.metrics_params,
|
||||
source_client.clone(),
|
||||
)?;
|
||||
let standalone_metrics = params
|
||||
.standalone_metrics
|
||||
.map(Ok)
|
||||
.unwrap_or_else(|| standalone_metrics(source_client.clone(), target_client.clone()))?;
|
||||
messages_relay::message_lane_loop::run(
|
||||
messages_relay::message_lane_loop::Params {
|
||||
lane: lane_id,
|
||||
@@ -271,41 +267,31 @@ pub async fn run(
|
||||
params.target_to_source_headers_relay,
|
||||
),
|
||||
KusamaTargetClient::new(
|
||||
params.target_client,
|
||||
target_client,
|
||||
lane,
|
||||
lane_id,
|
||||
metrics_values,
|
||||
standalone_metrics.clone(),
|
||||
params.source_to_target_headers_relay,
|
||||
),
|
||||
metrics_params,
|
||||
standalone_metrics.register_and_spawn(params.metrics_params)?,
|
||||
futures::future::pending(),
|
||||
)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Add standalone metrics for the Polkadot -> Kusama messages loop.
|
||||
pub(crate) fn add_standalone_metrics(
|
||||
metrics_prefix: Option<String>,
|
||||
metrics_params: MetricsParams,
|
||||
/// Create standalone metrics for the Polkadot -> Kusama messages loop.
|
||||
pub(crate) fn standalone_metrics(
|
||||
source_client: Client<Polkadot>,
|
||||
) -> anyhow::Result<(MetricsParams, StandaloneMessagesMetrics)> {
|
||||
let kusama_to_polkadot_conversion_rate_key = bp_runtime::storage_parameter_key(
|
||||
bp_polkadot::KUSAMA_TO_POLKADOT_CONVERSION_RATE_PARAMETER_NAME,
|
||||
)
|
||||
.0;
|
||||
|
||||
substrate_relay_helper::messages_lane::add_standalone_metrics::<PolkadotMessagesToKusama>(
|
||||
metrics_prefix,
|
||||
metrics_params,
|
||||
target_client: Client<Kusama>,
|
||||
) -> anyhow::Result<StandaloneMessagesMetrics<Polkadot, Kusama>> {
|
||||
substrate_relay_helper::messages_lane::standalone_metrics(
|
||||
source_client,
|
||||
Some(crate::chains::kusama::TOKEN_ID),
|
||||
target_client,
|
||||
Some(crate::chains::polkadot::TOKEN_ID),
|
||||
Some((
|
||||
sp_core::storage::StorageKey(kusama_to_polkadot_conversion_rate_key),
|
||||
// starting relay before this parameter will be set to some value may cause troubles
|
||||
FixedU128::from_inner(FixedU128::DIV),
|
||||
)),
|
||||
Some(crate::chains::kusama::TOKEN_ID),
|
||||
Some(crate::chains::kusama::polkadot_to_kusama_conversion_rate_params()),
|
||||
Some(crate::chains::polkadot::kusama_to_polkadot_conversion_rate_params()),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,17 @@ use bp_message_dispatch::{CallOrigin, MessagePayload};
|
||||
use codec::Decode;
|
||||
use frame_support::weights::{DispatchInfo, GetDispatchInfo, Weight};
|
||||
use relay_rialto_client::Rialto;
|
||||
use sp_core::storage::StorageKey;
|
||||
use sp_runtime::FixedU128;
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
// Millau/Rialto tokens have no any real value, so the conversion rate we use is always 1:1. But we
|
||||
// want to test our code that is intended to work with real-value chains. So to keep it close to
|
||||
// 1:1, we'll be treating Rialto as BTC and Millau as wBTC (only in relayer).
|
||||
|
||||
/// The identifier of token, which value is associated with Rialto token value by relayer.
|
||||
pub(crate) const ASSOCIATED_TOKEN_ID: &str = crate::chains::polkadot::TOKEN_ID;
|
||||
|
||||
impl CliEncodeCall for Rialto {
|
||||
fn max_extrinsic_size() -> u32 {
|
||||
bp_rialto::max_extrinsic_size()
|
||||
@@ -122,3 +131,11 @@ impl CliChain for Rialto {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Storage key and initial value of Millau -> Rialto conversion rate.
|
||||
pub(crate) fn millau_to_rialto_conversion_rate_params() -> (StorageKey, FixedU128) {
|
||||
(
|
||||
StorageKey(rialto_runtime::millau_messages::MillauToRialtoConversionRate::key().to_vec()),
|
||||
rialto_runtime::millau_messages::INITIAL_MILLAU_TO_RIALTO_CONVERSION_RATE,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ use relay_rialto_client::{
|
||||
HeaderId as RialtoHeaderId, Rialto, SigningParams as RialtoSigningParams,
|
||||
};
|
||||
use relay_substrate_client::{Chain, Client, IndexOf, TransactionSignScheme, UnsignedTransaction};
|
||||
use relay_utils::metrics::MetricsParams;
|
||||
use substrate_relay_helper::{
|
||||
messages_lane::{
|
||||
select_delivery_transaction_limits, MessagesRelayParams, StandaloneMessagesMetrics,
|
||||
@@ -193,12 +192,13 @@ pub async fn run(
|
||||
|
||||
let lane_id = params.lane_id;
|
||||
let source_client = params.source_client;
|
||||
let target_client = params.target_client;
|
||||
let lane = RialtoMessagesToMillau {
|
||||
message_lane: SubstrateMessageLaneToSubstrate {
|
||||
source_client: source_client.clone(),
|
||||
source_sign: params.source_sign,
|
||||
source_transactions_mortality: params.source_transactions_mortality,
|
||||
target_client: params.target_client.clone(),
|
||||
target_client: target_client.clone(),
|
||||
target_sign: params.target_sign,
|
||||
target_transactions_mortality: params.target_transactions_mortality,
|
||||
relayer_id_at_source: relayer_id_at_rialto,
|
||||
@@ -233,13 +233,10 @@ pub async fn run(
|
||||
stall_timeout,
|
||||
);
|
||||
|
||||
let (metrics_params, metrics_values) = add_standalone_metrics(
|
||||
Some(messages_relay::message_lane_loop::metrics_prefix::<
|
||||
<RialtoMessagesToMillau as SubstrateMessageLane>::MessageLane,
|
||||
>(&lane_id)),
|
||||
params.metrics_params,
|
||||
source_client.clone(),
|
||||
)?;
|
||||
let standalone_metrics = params
|
||||
.standalone_metrics
|
||||
.map(Ok)
|
||||
.unwrap_or_else(|| standalone_metrics(source_client.clone(), target_client.clone()))?;
|
||||
messages_relay::message_lane_loop::run(
|
||||
messages_relay::message_lane_loop::Params {
|
||||
lane: lane_id,
|
||||
@@ -265,37 +262,31 @@ pub async fn run(
|
||||
params.target_to_source_headers_relay,
|
||||
),
|
||||
MillauTargetClient::new(
|
||||
params.target_client,
|
||||
target_client,
|
||||
lane,
|
||||
lane_id,
|
||||
metrics_values,
|
||||
standalone_metrics.clone(),
|
||||
params.source_to_target_headers_relay,
|
||||
),
|
||||
metrics_params,
|
||||
standalone_metrics.register_and_spawn(params.metrics_params)?,
|
||||
futures::future::pending(),
|
||||
)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Add standalone metrics for the Rialto -> Millau messages loop.
|
||||
pub(crate) fn add_standalone_metrics(
|
||||
metrics_prefix: Option<String>,
|
||||
metrics_params: MetricsParams,
|
||||
/// Create standalone metrics for the Rialto -> Millau messages loop.
|
||||
pub(crate) fn standalone_metrics(
|
||||
source_client: Client<Rialto>,
|
||||
) -> anyhow::Result<(MetricsParams, StandaloneMessagesMetrics)> {
|
||||
substrate_relay_helper::messages_lane::add_standalone_metrics::<RialtoMessagesToMillau>(
|
||||
metrics_prefix,
|
||||
metrics_params,
|
||||
target_client: Client<Millau>,
|
||||
) -> anyhow::Result<StandaloneMessagesMetrics<Rialto, Millau>> {
|
||||
substrate_relay_helper::messages_lane::standalone_metrics(
|
||||
source_client,
|
||||
Some(crate::chains::RIALTO_ASSOCIATED_TOKEN_ID),
|
||||
Some(crate::chains::MILLAU_ASSOCIATED_TOKEN_ID),
|
||||
Some((
|
||||
sp_core::storage::StorageKey(
|
||||
rialto_runtime::millau_messages::MillauToRialtoConversionRate::key().to_vec(),
|
||||
),
|
||||
rialto_runtime::millau_messages::INITIAL_MILLAU_TO_RIALTO_CONVERSION_RATE,
|
||||
)),
|
||||
target_client,
|
||||
Some(crate::chains::rialto::ASSOCIATED_TOKEN_ID),
|
||||
Some(crate::chains::millau::ASSOCIATED_TOKEN_ID),
|
||||
Some(crate::chains::millau::rialto_to_millau_conversion_rate_params()),
|
||||
Some(crate::chains::rialto::millau_to_rialto_conversion_rate_params()),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -59,10 +59,7 @@ impl SubstrateFinalitySyncPipeline for RococoFinalityToWococo {
|
||||
type TargetChain = Wococo;
|
||||
|
||||
fn customize_metrics(params: MetricsParams) -> anyhow::Result<MetricsParams> {
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self::FinalitySyncPipeline>(
|
||||
Some(finality_relay::metrics_prefix::<Self::FinalitySyncPipeline>()),
|
||||
params,
|
||||
)
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self::FinalitySyncPipeline>(params)
|
||||
}
|
||||
|
||||
fn start_relay_guards(&self) {
|
||||
|
||||
@@ -29,7 +29,6 @@ use relay_rococo_client::{
|
||||
HeaderId as RococoHeaderId, Rococo, SigningParams as RococoSigningParams,
|
||||
};
|
||||
use relay_substrate_client::{Chain, Client, IndexOf, TransactionSignScheme, UnsignedTransaction};
|
||||
use relay_utils::metrics::MetricsParams;
|
||||
use relay_wococo_client::{
|
||||
HeaderId as WococoHeaderId, SigningParams as WococoSigningParams, Wococo,
|
||||
};
|
||||
@@ -193,12 +192,13 @@ pub async fn run(
|
||||
|
||||
let lane_id = params.lane_id;
|
||||
let source_client = params.source_client;
|
||||
let target_client = params.target_client;
|
||||
let lane = RococoMessagesToWococo {
|
||||
message_lane: SubstrateMessageLaneToSubstrate {
|
||||
source_client: source_client.clone(),
|
||||
source_sign: params.source_sign,
|
||||
source_transactions_mortality: params.source_transactions_mortality,
|
||||
target_client: params.target_client.clone(),
|
||||
target_client: target_client.clone(),
|
||||
target_sign: params.target_sign,
|
||||
target_transactions_mortality: params.target_transactions_mortality,
|
||||
relayer_id_at_source: relayer_id_at_rococo,
|
||||
@@ -237,13 +237,10 @@ pub async fn run(
|
||||
stall_timeout,
|
||||
);
|
||||
|
||||
let (metrics_params, metrics_values) = add_standalone_metrics(
|
||||
Some(messages_relay::message_lane_loop::metrics_prefix::<
|
||||
<RococoMessagesToWococo as SubstrateMessageLane>::MessageLane,
|
||||
>(&lane_id)),
|
||||
params.metrics_params,
|
||||
source_client.clone(),
|
||||
)?;
|
||||
let standalone_metrics = params
|
||||
.standalone_metrics
|
||||
.map(Ok)
|
||||
.unwrap_or_else(|| standalone_metrics(source_client.clone(), target_client.clone()))?;
|
||||
messages_relay::message_lane_loop::run(
|
||||
messages_relay::message_lane_loop::Params {
|
||||
lane: lane_id,
|
||||
@@ -269,29 +266,28 @@ pub async fn run(
|
||||
params.target_to_source_headers_relay,
|
||||
),
|
||||
WococoTargetClient::new(
|
||||
params.target_client,
|
||||
target_client,
|
||||
lane,
|
||||
lane_id,
|
||||
metrics_values,
|
||||
standalone_metrics.clone(),
|
||||
params.source_to_target_headers_relay,
|
||||
),
|
||||
metrics_params,
|
||||
standalone_metrics.register_and_spawn(params.metrics_params)?,
|
||||
futures::future::pending(),
|
||||
)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Add standalone metrics for the Rococo -> Wococo messages loop.
|
||||
pub(crate) fn add_standalone_metrics(
|
||||
metrics_prefix: Option<String>,
|
||||
metrics_params: MetricsParams,
|
||||
/// Create standalone metrics for the Rococo -> Wococo messages loop.
|
||||
pub(crate) fn standalone_metrics(
|
||||
source_client: Client<Rococo>,
|
||||
) -> anyhow::Result<(MetricsParams, StandaloneMessagesMetrics)> {
|
||||
substrate_relay_helper::messages_lane::add_standalone_metrics::<RococoMessagesToWococo>(
|
||||
metrics_prefix,
|
||||
metrics_params,
|
||||
target_client: Client<Wococo>,
|
||||
) -> anyhow::Result<StandaloneMessagesMetrics<Rococo, Wococo>> {
|
||||
substrate_relay_helper::messages_lane::standalone_metrics(
|
||||
source_client,
|
||||
target_client,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
|
||||
@@ -57,10 +57,7 @@ impl SubstrateFinalitySyncPipeline for WestendFinalityToMillau {
|
||||
type TargetChain = Millau;
|
||||
|
||||
fn customize_metrics(params: MetricsParams) -> anyhow::Result<MetricsParams> {
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self::FinalitySyncPipeline>(
|
||||
Some(finality_relay::metrics_prefix::<Self::FinalitySyncPipeline>()),
|
||||
params,
|
||||
)
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self::FinalitySyncPipeline>(params)
|
||||
}
|
||||
|
||||
fn transactions_author(&self) -> bp_millau::AccountId {
|
||||
|
||||
@@ -64,10 +64,7 @@ impl SubstrateFinalitySyncPipeline for WococoFinalityToRococo {
|
||||
type TargetChain = Rococo;
|
||||
|
||||
fn customize_metrics(params: MetricsParams) -> anyhow::Result<MetricsParams> {
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self::FinalitySyncPipeline>(
|
||||
Some(finality_relay::metrics_prefix::<Self::FinalitySyncPipeline>()),
|
||||
params,
|
||||
)
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self::FinalitySyncPipeline>(params)
|
||||
}
|
||||
|
||||
fn start_relay_guards(&self) {
|
||||
|
||||
@@ -29,7 +29,6 @@ use relay_rococo_client::{
|
||||
HeaderId as RococoHeaderId, Rococo, SigningParams as RococoSigningParams,
|
||||
};
|
||||
use relay_substrate_client::{Chain, Client, IndexOf, TransactionSignScheme, UnsignedTransaction};
|
||||
use relay_utils::metrics::MetricsParams;
|
||||
use relay_wococo_client::{
|
||||
HeaderId as WococoHeaderId, SigningParams as WococoSigningParams, Wococo,
|
||||
};
|
||||
@@ -192,12 +191,13 @@ pub async fn run(
|
||||
|
||||
let lane_id = params.lane_id;
|
||||
let source_client = params.source_client;
|
||||
let target_client = params.target_client;
|
||||
let lane = WococoMessagesToRococo {
|
||||
message_lane: SubstrateMessageLaneToSubstrate {
|
||||
source_client: source_client.clone(),
|
||||
source_sign: params.source_sign,
|
||||
source_transactions_mortality: params.source_transactions_mortality,
|
||||
target_client: params.target_client.clone(),
|
||||
target_client: target_client.clone(),
|
||||
target_sign: params.target_sign,
|
||||
target_transactions_mortality: params.target_transactions_mortality,
|
||||
relayer_id_at_source: relayer_id_at_wococo,
|
||||
@@ -236,13 +236,10 @@ pub async fn run(
|
||||
stall_timeout,
|
||||
);
|
||||
|
||||
let (metrics_params, metrics_values) = add_standalone_metrics(
|
||||
Some(messages_relay::message_lane_loop::metrics_prefix::<
|
||||
<WococoMessagesToRococo as SubstrateMessageLane>::MessageLane,
|
||||
>(&lane_id)),
|
||||
params.metrics_params,
|
||||
source_client.clone(),
|
||||
)?;
|
||||
let standalone_metrics = params
|
||||
.standalone_metrics
|
||||
.map(Ok)
|
||||
.unwrap_or_else(|| standalone_metrics(source_client.clone(), target_client.clone()))?;
|
||||
messages_relay::message_lane_loop::run(
|
||||
messages_relay::message_lane_loop::Params {
|
||||
lane: lane_id,
|
||||
@@ -268,29 +265,28 @@ pub async fn run(
|
||||
params.target_to_source_headers_relay,
|
||||
),
|
||||
RococoTargetClient::new(
|
||||
params.target_client,
|
||||
target_client,
|
||||
lane,
|
||||
lane_id,
|
||||
metrics_values,
|
||||
standalone_metrics.clone(),
|
||||
params.source_to_target_headers_relay,
|
||||
),
|
||||
metrics_params,
|
||||
standalone_metrics.register_and_spawn(params.metrics_params)?,
|
||||
futures::future::pending(),
|
||||
)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Add standalone metrics for the Wococo -> Rococo messages loop.
|
||||
pub(crate) fn add_standalone_metrics(
|
||||
metrics_prefix: Option<String>,
|
||||
metrics_params: MetricsParams,
|
||||
/// Create standalone metrics for the Wococo -> Rococo messages loop.
|
||||
pub(crate) fn standalone_metrics(
|
||||
source_client: Client<Wococo>,
|
||||
) -> anyhow::Result<(MetricsParams, StandaloneMessagesMetrics)> {
|
||||
substrate_relay_helper::messages_lane::add_standalone_metrics::<WococoMessagesToRococo>(
|
||||
metrics_prefix,
|
||||
metrics_params,
|
||||
target_client: Client<Rococo>,
|
||||
) -> anyhow::Result<StandaloneMessagesMetrics<Wococo, Rococo>> {
|
||||
substrate_relay_helper::messages_lane::standalone_metrics(
|
||||
source_client,
|
||||
target_client,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
use structopt::StructOpt;
|
||||
use strum::{EnumString, EnumVariantNames, VariantNames};
|
||||
|
||||
use relay_utils::metrics::{GlobalMetrics, StandaloneMetric};
|
||||
use substrate_relay_helper::finality_pipeline::SubstrateFinalitySyncPipeline;
|
||||
|
||||
use crate::cli::{
|
||||
@@ -121,6 +122,8 @@ impl RelayHeaders {
|
||||
let target_transactions_mortality = self.target_sign.target_transactions_mortality;
|
||||
let target_sign = self.target_sign.to_keypair::<Target>()?;
|
||||
let metrics_params = Finality::customize_metrics(self.prometheus_params.into())?;
|
||||
GlobalMetrics::new()?.register_and_spawn(&metrics_params.registry)?;
|
||||
|
||||
let finality = Finality::new(target_client.clone(), target_sign);
|
||||
finality.start_relay_guards();
|
||||
|
||||
|
||||
@@ -34,8 +34,7 @@ use relay_substrate_client::{
|
||||
use relay_utils::metrics::MetricsParams;
|
||||
use sp_core::{Bytes, Pair};
|
||||
use substrate_relay_helper::{
|
||||
messages_lane::{MessagesRelayParams, SubstrateMessageLane},
|
||||
on_demand_headers::OnDemandHeadersRelay,
|
||||
messages_lane::MessagesRelayParams, on_demand_headers::OnDemandHeadersRelay,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@@ -129,11 +128,6 @@ macro_rules! select_bridge {
|
||||
type RightToLeftFinality =
|
||||
crate::chains::rialto_headers_to_millau::RialtoFinalityToMillau;
|
||||
|
||||
type LeftToRightMessages =
|
||||
crate::chains::millau_messages_to_rialto::MillauMessagesToRialto;
|
||||
type RightToLeftMessages =
|
||||
crate::chains::rialto_messages_to_millau::RialtoMessagesToMillau;
|
||||
|
||||
type LeftAccountIdConverter = bp_millau::AccountIdConverter;
|
||||
type RightAccountIdConverter = bp_rialto::AccountIdConverter;
|
||||
|
||||
@@ -144,12 +138,11 @@ macro_rules! select_bridge {
|
||||
|
||||
use crate::chains::{
|
||||
millau_messages_to_rialto::{
|
||||
add_standalone_metrics as add_left_to_right_standalone_metrics,
|
||||
standalone_metrics as left_to_right_standalone_metrics,
|
||||
run as left_to_right_messages,
|
||||
update_rialto_to_millau_conversion_rate as update_right_to_left_conversion_rate,
|
||||
},
|
||||
rialto_messages_to_millau::{
|
||||
add_standalone_metrics as add_right_to_left_standalone_metrics,
|
||||
run as right_to_left_messages,
|
||||
update_millau_to_rialto_conversion_rate as update_left_to_right_conversion_rate,
|
||||
},
|
||||
@@ -184,11 +177,6 @@ macro_rules! select_bridge {
|
||||
type RightToLeftFinality =
|
||||
crate::chains::wococo_headers_to_rococo::WococoFinalityToRococo;
|
||||
|
||||
type LeftToRightMessages =
|
||||
crate::chains::rococo_messages_to_wococo::RococoMessagesToWococo;
|
||||
type RightToLeftMessages =
|
||||
crate::chains::wococo_messages_to_rococo::WococoMessagesToRococo;
|
||||
|
||||
type LeftAccountIdConverter = bp_rococo::AccountIdConverter;
|
||||
type RightAccountIdConverter = bp_wococo::AccountIdConverter;
|
||||
|
||||
@@ -199,11 +187,10 @@ macro_rules! select_bridge {
|
||||
|
||||
use crate::chains::{
|
||||
rococo_messages_to_wococo::{
|
||||
add_standalone_metrics as add_left_to_right_standalone_metrics,
|
||||
standalone_metrics as left_to_right_standalone_metrics,
|
||||
run as left_to_right_messages,
|
||||
},
|
||||
wococo_messages_to_rococo::{
|
||||
add_standalone_metrics as add_right_to_left_standalone_metrics,
|
||||
run as right_to_left_messages,
|
||||
},
|
||||
};
|
||||
@@ -253,11 +240,6 @@ macro_rules! select_bridge {
|
||||
type RightToLeftFinality =
|
||||
crate::chains::polkadot_headers_to_kusama::PolkadotFinalityToKusama;
|
||||
|
||||
type LeftToRightMessages =
|
||||
crate::chains::kusama_messages_to_polkadot::KusamaMessagesToPolkadot;
|
||||
type RightToLeftMessages =
|
||||
crate::chains::polkadot_messages_to_kusama::PolkadotMessagesToKusama;
|
||||
|
||||
type LeftAccountIdConverter = bp_kusama::AccountIdConverter;
|
||||
type RightAccountIdConverter = bp_polkadot::AccountIdConverter;
|
||||
|
||||
@@ -268,12 +250,11 @@ macro_rules! select_bridge {
|
||||
|
||||
use crate::chains::{
|
||||
kusama_messages_to_polkadot::{
|
||||
add_standalone_metrics as add_left_to_right_standalone_metrics,
|
||||
standalone_metrics as left_to_right_standalone_metrics,
|
||||
run as left_to_right_messages,
|
||||
update_polkadot_to_kusama_conversion_rate as update_right_to_left_conversion_rate,
|
||||
},
|
||||
polkadot_messages_to_kusama::{
|
||||
add_standalone_metrics as add_right_to_left_standalone_metrics,
|
||||
run as right_to_left_messages,
|
||||
update_kusama_to_polkadot_conversion_rate as update_left_to_right_conversion_rate,
|
||||
},
|
||||
@@ -378,31 +359,39 @@ impl RelayHeadersAndMessages {
|
||||
let relayer_mode = params.shared.relayer_mode.into();
|
||||
let relay_strategy = MixStrategy::new(relayer_mode);
|
||||
|
||||
const METRIC_IS_SOME_PROOF: &str =
|
||||
"it is `None` when metric has been already registered; \
|
||||
this is the command entrypoint, so nothing has been registered yet; \
|
||||
qed";
|
||||
|
||||
// create metrics registry and register standalone metrics
|
||||
let metrics_params: MetricsParams = params.shared.prometheus_params.into();
|
||||
let metrics_params = relay_utils::relay_metrics(None, metrics_params).into_params();
|
||||
let (metrics_params, left_to_right_metrics) =
|
||||
add_left_to_right_standalone_metrics(None, metrics_params, left_client.clone())?;
|
||||
let (metrics_params, right_to_left_metrics) =
|
||||
add_right_to_left_standalone_metrics(None, metrics_params, right_client.clone())?;
|
||||
let metrics_params = relay_utils::relay_metrics(metrics_params).into_params();
|
||||
let left_to_right_metrics =
|
||||
left_to_right_standalone_metrics(left_client.clone(), right_client.clone())?;
|
||||
let right_to_left_metrics = left_to_right_metrics.clone().reverse();
|
||||
|
||||
// start conversion rate update loops for left/right chains
|
||||
if let Some(left_messages_pallet_owner) = left_messages_pallet_owner {
|
||||
let left_client = left_client.clone();
|
||||
let format_err = || {
|
||||
anyhow::format_err!(
|
||||
"Cannon run conversion rate updater: {} -> {}",
|
||||
Right::NAME,
|
||||
Left::NAME
|
||||
)
|
||||
};
|
||||
substrate_relay_helper::conversion_rate_update::run_conversion_rate_update_loop(
|
||||
left_to_right_metrics
|
||||
.target_to_source_conversion_rate
|
||||
.expect(METRIC_IS_SOME_PROOF),
|
||||
.as_ref()
|
||||
.ok_or_else(format_err)?
|
||||
.shared_value_ref(),
|
||||
left_to_right_metrics
|
||||
.target_to_base_conversion_rate
|
||||
.clone()
|
||||
.expect(METRIC_IS_SOME_PROOF),
|
||||
.as_ref()
|
||||
.ok_or_else(format_err)?
|
||||
.shared_value_ref(),
|
||||
left_to_right_metrics
|
||||
.source_to_base_conversion_rate
|
||||
.clone()
|
||||
.expect(METRIC_IS_SOME_PROOF),
|
||||
.as_ref()
|
||||
.ok_or_else(format_err)?
|
||||
.shared_value_ref(),
|
||||
CONVERSION_RATE_ALLOWED_DIFFERENCE_RATIO,
|
||||
move |new_rate| {
|
||||
log::info!(
|
||||
@@ -423,16 +412,29 @@ impl RelayHeadersAndMessages {
|
||||
}
|
||||
if let Some(right_messages_pallet_owner) = right_messages_pallet_owner {
|
||||
let right_client = right_client.clone();
|
||||
let format_err = || {
|
||||
anyhow::format_err!(
|
||||
"Cannon run conversion rate updater: {} -> {}",
|
||||
Left::NAME,
|
||||
Right::NAME
|
||||
)
|
||||
};
|
||||
substrate_relay_helper::conversion_rate_update::run_conversion_rate_update_loop(
|
||||
right_to_left_metrics
|
||||
.target_to_source_conversion_rate
|
||||
.expect(METRIC_IS_SOME_PROOF),
|
||||
.as_ref()
|
||||
.ok_or_else(format_err)?
|
||||
.shared_value_ref(),
|
||||
left_to_right_metrics
|
||||
.source_to_base_conversion_rate
|
||||
.expect(METRIC_IS_SOME_PROOF),
|
||||
.as_ref()
|
||||
.ok_or_else(format_err)?
|
||||
.shared_value_ref(),
|
||||
left_to_right_metrics
|
||||
.target_to_base_conversion_rate
|
||||
.expect(METRIC_IS_SOME_PROOF),
|
||||
.as_ref()
|
||||
.ok_or_else(format_err)?
|
||||
.shared_value_ref(),
|
||||
CONVERSION_RATE_ALLOWED_DIFFERENCE_RATIO,
|
||||
move |new_rate| {
|
||||
log::info!(
|
||||
@@ -452,6 +454,7 @@ impl RelayHeadersAndMessages {
|
||||
);
|
||||
}
|
||||
|
||||
// optionally, create relayers fund account
|
||||
if params.shared.create_relayers_fund_accounts {
|
||||
let relayer_fund_acount_id = pallet_bridge_messages::relayer_fund_account_id::<
|
||||
AccountIdOf<Left>,
|
||||
@@ -490,6 +493,7 @@ impl RelayHeadersAndMessages {
|
||||
}
|
||||
}
|
||||
|
||||
// start on-demand header relays
|
||||
let left_to_right_on_demand_headers = OnDemandHeadersRelay::new(
|
||||
left_client.clone(),
|
||||
right_client.clone(),
|
||||
@@ -521,11 +525,8 @@ impl RelayHeadersAndMessages {
|
||||
source_to_target_headers_relay: Some(left_to_right_on_demand_headers.clone()),
|
||||
target_to_source_headers_relay: Some(right_to_left_on_demand_headers.clone()),
|
||||
lane_id: lane,
|
||||
metrics_params: metrics_params.clone().disable().metrics_prefix(
|
||||
messages_relay::message_lane_loop::metrics_prefix::<
|
||||
<LeftToRightMessages as SubstrateMessageLane>::MessageLane,
|
||||
>(&lane),
|
||||
),
|
||||
metrics_params: metrics_params.clone().disable(),
|
||||
standalone_metrics: Some(left_to_right_metrics.clone()),
|
||||
relay_strategy: relay_strategy.clone(),
|
||||
})
|
||||
.map_err(|e| anyhow::format_err!("{}", e))
|
||||
@@ -540,11 +541,8 @@ impl RelayHeadersAndMessages {
|
||||
source_to_target_headers_relay: Some(right_to_left_on_demand_headers.clone()),
|
||||
target_to_source_headers_relay: Some(left_to_right_on_demand_headers.clone()),
|
||||
lane_id: lane,
|
||||
metrics_params: metrics_params.clone().disable().metrics_prefix(
|
||||
messages_relay::message_lane_loop::metrics_prefix::<
|
||||
<RightToLeftMessages as SubstrateMessageLane>::MessageLane,
|
||||
>(&lane),
|
||||
),
|
||||
metrics_params: metrics_params.clone().disable(),
|
||||
standalone_metrics: Some(right_to_left_metrics.clone()),
|
||||
relay_strategy: relay_strategy.clone(),
|
||||
})
|
||||
.map_err(|e| anyhow::format_err!("{}", e))
|
||||
@@ -554,7 +552,7 @@ impl RelayHeadersAndMessages {
|
||||
message_relays.push(right_to_left_messages);
|
||||
}
|
||||
|
||||
relay_utils::relay_metrics(None, metrics_params)
|
||||
relay_utils::relay_metrics(metrics_params)
|
||||
.expose()
|
||||
.await
|
||||
.map_err(|e| anyhow::format_err!("{}", e))?;
|
||||
|
||||
@@ -95,6 +95,7 @@ impl RelayMessages {
|
||||
target_to_source_headers_relay: None,
|
||||
lane_id: self.lane.into(),
|
||||
metrics_params: self.prometheus_params.into(),
|
||||
standalone_metrics: None,
|
||||
relay_strategy,
|
||||
})
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user