Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@
"pluginVersion": "7.1.3",
"targets": [
{
"expr": "avg_over_time(Millau_to_Rialto_MessageLane_00000000_process_cpu_usage_percentage[1m])",
"expr": "avg_over_time(process_cpu_usage_percentage{instance='relay-millau-rialto:9616'}[1m])",
"instant": true,
"interval": "",
"legendFormat": "1 CPU = 100",
Expand Down Expand Up @@ -1499,7 +1499,7 @@
"steppedLine": false,
"targets": [
{
"expr": "Millau_to_Rialto_MessageLane_00000000_system_average_load",
"expr": "system_average_load{instance='relay-millau-rialto:9616'}",
"interval": "",
"legendFormat": "Average system load in last {{over}}",
"refId": "A"
Expand Down Expand Up @@ -1592,7 +1592,7 @@
"steppedLine": false,
"targets": [
{
"expr": "Millau_to_Rialto_MessageLane_00000000_process_memory_usage_bytes / 1024 / 1024",
"expr": "process_memory_usage_bytes{instance='relay-millau-rialto:9616'} / 1024 / 1024",
"interval": "",
"legendFormat": "Process memory, MB",
"refId": "A"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@
"pluginVersion": "7.1.3",
"targets": [
{
"expr": "avg_over_time(Rialto_to_Millau_MessageLane_00000000_process_cpu_usage_percentage[1m])",
"expr": "avg_over_time(process_cpu_usage_percentage{instance='relay-millau-rialto:9616'}[1m])",
"instant": true,
"interval": "",
"legendFormat": "1 CPU = 100",
Expand Down Expand Up @@ -1248,7 +1248,7 @@
"steppedLine": false,
"targets": [
{
"expr": "Rialto_to_Millau_MessageLane_00000000_system_average_load",
"expr": "system_average_load{instance='relay-millau-rialto:9616'}",
"interval": "",
"legendFormat": "Average system load in last {{over}}",
"refId": "A"
Expand Down Expand Up @@ -1341,7 +1341,7 @@
"steppedLine": false,
"targets": [
{
"expr": "Rialto_to_Millau_MessageLane_00000000_process_memory_usage_bytes / 1024 / 1024",
"expr": "process_memory_usage_bytes{instance='relay-millau-rialto:9616'} / 1024 / 1024",
"interval": "",
"legendFormat": "Process memory, MB",
"refId": "A"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"targets": [
{
"exemplar": true,
"expr": "Rialto_to_Millau_MessageLane_00000000_rialto_storage_proof_overhead",
"expr": "rialto_storage_proof_overhead{instance='relay-millau-rialto:9616'}",
"interval": "",
"legendFormat": "Actual overhead",
"refId": "A"
Expand Down Expand Up @@ -169,14 +169,14 @@
"targets": [
{
"exemplar": true,
"expr": "Westend_to_Millau_Sync_kusama_to_base_conversion_rate / Westend_to_Millau_Sync_polkadot_to_base_conversion_rate",
"expr": "kusama_to_base_conversion_rate{instance='relay-millau-rialto:9616'} / polkadot_to_base_conversion_rate{instance='relay-millau-rialto:9616'}",
"interval": "",
"legendFormat": "Outside of runtime (actually Polkadot -> Kusama)",
"refId": "A"
},
{
"exemplar": true,
"expr": "Rialto_to_Millau_MessageLane_00000000_rialto_millau_to_rialto_conversion_rate",
"expr": "Millau_Rialto_to_Millau_conversion_rate{instance='relay-millau-rialto:9616'}",
Comment thread
svyatonik marked this conversation as resolved.
"hide": false,
"interval": "",
"legendFormat": "At runtime",
Expand All @@ -187,7 +187,7 @@
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Rialto: Millau -> Rialto conversion rate",
"title": "Millau: Rialto -> Millau conversion rate",
"tooltip": {
"shared": true,
"sort": 0,
Expand Down Expand Up @@ -273,7 +273,7 @@
"targets": [
{
"exemplar": true,
"expr": "Millau_to_Rialto_MessageLane_00000000_millau_storage_proof_overhead",
"expr": "millau_storage_proof_overhead{instance='relay-millau-rialto:9616'}",
"interval": "",
"legendFormat": "Actual overhead",
"refId": "A"
Expand Down Expand Up @@ -377,14 +377,14 @@
"targets": [
{
"exemplar": true,
"expr": "Westend_to_Millau_Sync_polkadot_to_base_conversion_rate / Westend_to_Millau_Sync_kusama_to_base_conversion_rate",
"expr": "polkadot_to_base_conversion_rate{instance='relay-millau-rialto:9616'} / kusama_to_base_conversion_rate{instance='relay-millau-rialto:9616'}",
"interval": "",
"legendFormat": "Outside of runtime (actually Kusama -> Polkadot)",
"refId": "A"
},
{
"exemplar": true,
"expr": "Millau_to_Rialto_MessageLane_00000000_millau_rialto_to_millau_conversion_rate",
"expr": "Rialto_Millau_to_Rialto_conversion_rate{instance='relay-millau-rialto:9616'}",
"hide": false,
"interval": "",
"legendFormat": "At runtime",
Expand All @@ -395,7 +395,7 @@
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Millau: Rialto -> Millau conversion rate",
"title": "Rialto: Millau -> Rialto conversion rate",
"tooltip": {
"shared": true,
"sort": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
"steppedLine": false,
"targets": [
{
"expr": "Westend_to_Millau_Sync_system_average_load",
"expr": "system_average_load{instance='relay-headers-westend-to-millau:9616'}",
"interval": "",
"legendFormat": "Average system load in last {{over}}",
"refId": "A"
Expand Down Expand Up @@ -500,7 +500,7 @@
"pluginVersion": "7.1.3",
"targets": [
{
"expr": "avg_over_time(Westend_to_Millau_Sync_process_cpu_usage_percentage[1m])",
"expr": "avg_over_time(process_cpu_usage_percentage{instance='relay-headers-westend-to-millau:9616'}[1m])",
"instant": true,
"interval": "",
"legendFormat": "1 CPU = 100",
Expand Down Expand Up @@ -615,7 +615,7 @@
"steppedLine": false,
"targets": [
{
"expr": "Westend_to_Millau_Sync_process_memory_usage_bytes / 1024 / 1024",
"expr": "process_memory_usage_bytes{instance='relay-headers-westend-to-millau:9616'} / 1024 / 1024",
"interval": "",
"legendFormat": "Process memory, MB",
"refId": "A"
Expand Down
2 changes: 1 addition & 1 deletion primitives/chain-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: sp_version::create_runtime_str!("rococo"),
impl_name: sp_version::create_runtime_str!("parity-rococo-v1.6"),
authoring_version: 0,
spec_version: 9004,
spec_version: 9100,
impl_version: 0,
apis: sp_version::create_apis_vec![[]],
transaction_version: 0,
Expand Down
13 changes: 13 additions & 0 deletions relays/bin-substrate/src/chains/kusama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
50 changes: 18 additions & 32 deletions relays/bin-substrate/src/chains/kusama_messages_to_polkadot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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()),
)
}

Expand Down
17 changes: 17 additions & 0 deletions relays/bin-substrate/src/chains/millau.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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,
)
}
Loading