mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
Refactor message relay helpers (#1234)
* refactor message relay helpers * single standalone_metrics function * fixed tests * clippy + fmt * removed commented code * add calls tracing * fix spelling * cargo fmt * -commented code * fix build again * post-merge build fix * clippy + fmt
This commit is contained in:
committed by
Bastian Köcher
parent
90f2b3c365
commit
4cdd959057
@@ -26,24 +26,11 @@ use crate::cli::{
|
||||
use anyhow::anyhow;
|
||||
use bp_message_dispatch::{CallOrigin, MessagePayload};
|
||||
use codec::Decode;
|
||||
use frame_support::weights::{DispatchInfo, GetDispatchInfo, Weight};
|
||||
use frame_support::weights::{DispatchInfo, GetDispatchInfo};
|
||||
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()
|
||||
}
|
||||
|
||||
fn encode_call(call: &Call) -> anyhow::Result<Self::Call> {
|
||||
Ok(match call {
|
||||
Call::Raw { data } => Decode::decode(&mut &*data.0)?,
|
||||
@@ -96,10 +83,6 @@ impl CliChain for Rialto {
|
||||
rialto_runtime::SS58Prefix::get() as u16
|
||||
}
|
||||
|
||||
fn max_extrinsic_weight() -> Weight {
|
||||
bp_rialto::max_extrinsic_weight()
|
||||
}
|
||||
|
||||
fn encode_message(
|
||||
message: encode_message::MessagePayload,
|
||||
) -> anyhow::Result<Self::MessagePayload> {
|
||||
@@ -131,11 +114,3 @@ 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,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user