mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 03:41:02 +00:00
Add missing parts to rialto parachain bridge (part 1) (#1454)
* add proper parameter names to bridge declaration * associate RialtoParachain token with DOT * RialtoParachain<>Millau message pallet owners * fix compilation
This commit is contained in:
committed by
Bastian Köcher
parent
4d36321e77
commit
2f9d8e33e0
@@ -15,7 +15,7 @@
|
|||||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use cumulus_primitives_core::ParaId;
|
use cumulus_primitives_core::ParaId;
|
||||||
use rialto_parachain_runtime::{AccountId, AuraId, Signature};
|
use rialto_parachain_runtime::{AccountId, AuraId, BridgeMillauMessagesConfig, Signature};
|
||||||
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
|
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
|
||||||
use sc_service::ChainType;
|
use sc_service::ChainType;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -82,6 +82,7 @@ fn endowed_accounts() -> Vec<AccountId> {
|
|||||||
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
|
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
|
||||||
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
|
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
|
||||||
get_account_id_from_seed::<sr25519::Public>("George//stash"),
|
get_account_id_from_seed::<sr25519::Public>("George//stash"),
|
||||||
|
get_account_id_from_seed::<sr25519::Public>("MillauMessagesOwner"),
|
||||||
pallet_bridge_messages::relayer_fund_account_id::<
|
pallet_bridge_messages::relayer_fund_account_id::<
|
||||||
bp_rialto_parachain::AccountId,
|
bp_rialto_parachain::AccountId,
|
||||||
bp_rialto_parachain::AccountIdConverter,
|
bp_rialto_parachain::AccountIdConverter,
|
||||||
@@ -172,7 +173,9 @@ fn testnet_genesis(
|
|||||||
parachain_info: rialto_parachain_runtime::ParachainInfoConfig { parachain_id: id },
|
parachain_info: rialto_parachain_runtime::ParachainInfoConfig { parachain_id: id },
|
||||||
aura: rialto_parachain_runtime::AuraConfig { authorities: initial_authorities },
|
aura: rialto_parachain_runtime::AuraConfig { authorities: initial_authorities },
|
||||||
aura_ext: Default::default(),
|
aura_ext: Default::default(),
|
||||||
bridge_millau_messages: Default::default(),
|
bridge_millau_messages: BridgeMillauMessagesConfig {
|
||||||
// parachain_system: Default::default(),
|
owner: Some(get_account_id_from_seed::<sr25519::Public>("MillauMessagesOwner")),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ use xcm_builder::{
|
|||||||
};
|
};
|
||||||
use xcm_executor::{Config, XcmExecutor};
|
use xcm_executor::{Config, XcmExecutor};
|
||||||
|
|
||||||
mod millau_messages;
|
pub mod millau_messages;
|
||||||
|
|
||||||
/// The address format for describing accounts.
|
/// The address format for describing accounts.
|
||||||
pub type Address = MultiAddress<AccountId, ()>;
|
pub type Address = MultiAddress<AccountId, ()>;
|
||||||
|
|||||||
@@ -282,9 +282,17 @@ frame_support::parameter_types! {
|
|||||||
pub const WITH_MILLAU_GRANDPA_PALLET_NAME: &str = "BridgeMillauGrandpa";
|
pub const WITH_MILLAU_GRANDPA_PALLET_NAME: &str = "BridgeMillauGrandpa";
|
||||||
/// Name of the With-Millau messages pallet instance that is deployed at bridged chains.
|
/// Name of the With-Millau messages pallet instance that is deployed at bridged chains.
|
||||||
pub const WITH_MILLAU_MESSAGES_PALLET_NAME: &str = "BridgeMillauMessages";
|
pub const WITH_MILLAU_MESSAGES_PALLET_NAME: &str = "BridgeMillauMessages";
|
||||||
|
/// Name of the transaction payment pallet at the Millau runtime.
|
||||||
|
pub const TRANSACTION_PAYMENT_PALLET_NAME: &str = "TransactionPayment";
|
||||||
|
|
||||||
/// Name of the Rialto->Millau (actually DOT->KSM) conversion rate stored in the Millau runtime.
|
/// Name of the Rialto->Millau (actually DOT->KSM) conversion rate stored in the Millau runtime.
|
||||||
pub const RIALTO_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME: &str = "RialtoToMillauConversionRate";
|
pub const RIALTO_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME: &str = "RialtoToMillauConversionRate";
|
||||||
|
/// Name of the RialtoParachain->Millau (actually DOT->KSM) conversion rate stored in the Millau
|
||||||
|
/// runtime.
|
||||||
|
pub const RIALTO_PARACHAIN_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME: &str =
|
||||||
|
"RialtoParachainToMillauConversionRate";
|
||||||
|
/// Name of the RialtoParachain fee multiplier parameter, stored in the Millau runtime.
|
||||||
|
pub const RIALTO_PARACHAIN_FEE_MULTIPLIER_PARAMETER_NAME: &str = "RialtoParachainFeeMultiplier";
|
||||||
|
|
||||||
/// Name of the `MillauFinalityApi::best_finalized` runtime method.
|
/// Name of the `MillauFinalityApi::best_finalized` runtime method.
|
||||||
pub const BEST_FINALIZED_MILLAU_HEADER_METHOD: &str = "MillauFinalityApi_best_finalized";
|
pub const BEST_FINALIZED_MILLAU_HEADER_METHOD: &str = "MillauFinalityApi_best_finalized";
|
||||||
|
|||||||
@@ -195,10 +195,15 @@ frame_support::parameter_types! {
|
|||||||
|
|
||||||
/// Name of the With-Rialto-Parachain messages pallet instance that is deployed at bridged chains.
|
/// Name of the With-Rialto-Parachain messages pallet instance that is deployed at bridged chains.
|
||||||
pub const WITH_RIALTO_PARACHAIN_MESSAGES_PALLET_NAME: &str = "BridgeRialtoParachainMessages";
|
pub const WITH_RIALTO_PARACHAIN_MESSAGES_PALLET_NAME: &str = "BridgeRialtoParachainMessages";
|
||||||
|
/// Name of the transaction payment pallet at the Rialto parachain runtime.
|
||||||
|
pub const TRANSACTION_PAYMENT_PALLET_NAME: &str = "TransactionPayment";
|
||||||
|
|
||||||
/// Name of the Millau->Rialto (actually KSM->DOT) conversion rate stored in the Rialto parachain
|
/// Name of the Millau->RialtoParachain (actually KSM->DOT) conversion rate stored in the Rialto
|
||||||
/// runtime.
|
/// parachain runtime.
|
||||||
pub const MILLAU_TO_RIALTO_CONVERSION_RATE_PARAMETER_NAME: &str = "MillauToRialtoConversionRate";
|
pub const MILLAU_TO_RIALTO_PARACHAIN_CONVERSION_RATE_PARAMETER_NAME: &str =
|
||||||
|
"MillauToRialtoParachainConversionRate";
|
||||||
|
/// Name of the Millau fee multiplier parameter, stored in the Rialto parachain runtime.
|
||||||
|
pub const MILLAU_FEE_MULTIPLIER_PARAMETER_NAME: &str = "MillauFeeMultiplier";
|
||||||
|
|
||||||
/// Name of the `RialtoParachainFinalityApi::best_finalized` runtime method.
|
/// Name of the `RialtoParachainFinalityApi::best_finalized` runtime method.
|
||||||
pub const BEST_FINALIZED_RIALTO_PARACHAIN_HEADER_METHOD: &str =
|
pub const BEST_FINALIZED_RIALTO_PARACHAIN_HEADER_METHOD: &str =
|
||||||
|
|||||||
@@ -27,17 +27,29 @@ use substrate_relay_helper::messages_lane::{
|
|||||||
/// Description of Millau -> RialtoParachain messages bridge.
|
/// Description of Millau -> RialtoParachain messages bridge.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct MillauMessagesToRialtoParachain;
|
pub struct MillauMessagesToRialtoParachain;
|
||||||
|
substrate_relay_helper::generate_direct_update_conversion_rate_call_builder!(
|
||||||
|
Millau,
|
||||||
|
MillauMessagesToRialtoParachainUpdateConversionRateCallBuilder,
|
||||||
|
millau_runtime::Runtime,
|
||||||
|
millau_runtime::WithRialtoParachainMessagesInstance,
|
||||||
|
millau_runtime::rialto_parachain_messages::MillauToRialtoParachainMessagesParameter::RialtoParachainToMillauConversionRate
|
||||||
|
);
|
||||||
|
|
||||||
impl SubstrateMessageLane for MillauMessagesToRialtoParachain {
|
impl SubstrateMessageLane for MillauMessagesToRialtoParachain {
|
||||||
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
|
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
|
||||||
Some(bp_rialto_parachain::MILLAU_TO_RIALTO_CONVERSION_RATE_PARAMETER_NAME);
|
Some(bp_rialto_parachain::MILLAU_TO_RIALTO_PARACHAIN_CONVERSION_RATE_PARAMETER_NAME);
|
||||||
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
|
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
|
||||||
Some(bp_millau::RIALTO_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME);
|
Some(bp_millau::RIALTO_PARACHAIN_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME);
|
||||||
|
|
||||||
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
|
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> =
|
||||||
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
|
Some(bp_rialto_parachain::MILLAU_FEE_MULTIPLIER_PARAMETER_NAME);
|
||||||
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
|
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> =
|
||||||
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
|
Some(bp_millau::RIALTO_PARACHAIN_FEE_MULTIPLIER_PARAMETER_NAME);
|
||||||
|
|
||||||
|
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> =
|
||||||
|
Some(bp_millau::TRANSACTION_PAYMENT_PALLET_NAME);
|
||||||
|
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> =
|
||||||
|
Some(bp_rialto_parachain::TRANSACTION_PAYMENT_PALLET_NAME);
|
||||||
|
|
||||||
type SourceChain = Millau;
|
type SourceChain = Millau;
|
||||||
type TargetChain = RialtoParachain;
|
type TargetChain = RialtoParachain;
|
||||||
@@ -56,7 +68,8 @@ impl SubstrateMessageLane for MillauMessagesToRialtoParachain {
|
|||||||
millau_runtime::WithRialtoParachainMessagesInstance,
|
millau_runtime::WithRialtoParachainMessagesInstance,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
type TargetToSourceChainConversionRateUpdateBuilder = ();
|
type TargetToSourceChainConversionRateUpdateBuilder =
|
||||||
|
MillauMessagesToRialtoParachainUpdateConversionRateCallBuilder;
|
||||||
|
|
||||||
type RelayStrategy = MixStrategy;
|
type RelayStrategy = MixStrategy;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,17 +27,29 @@ use substrate_relay_helper::messages_lane::{
|
|||||||
/// Description of RialtoParachain -> Millau messages bridge.
|
/// Description of RialtoParachain -> Millau messages bridge.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct RialtoParachainMessagesToMillau;
|
pub struct RialtoParachainMessagesToMillau;
|
||||||
|
substrate_relay_helper::generate_direct_update_conversion_rate_call_builder!(
|
||||||
|
RialtoParachain,
|
||||||
|
RialtoParachainMessagesToMillauUpdateConversionRateCallBuilder,
|
||||||
|
rialto_parachain_runtime::Runtime,
|
||||||
|
rialto_parachain_runtime::WithMillauMessagesInstance,
|
||||||
|
rialto_parachain_runtime::millau_messages::RialtoParachainToMillauMessagesParameter::MillauToRialtoParachainConversionRate
|
||||||
|
);
|
||||||
|
|
||||||
impl SubstrateMessageLane for RialtoParachainMessagesToMillau {
|
impl SubstrateMessageLane for RialtoParachainMessagesToMillau {
|
||||||
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
|
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
|
||||||
Some(bp_millau::RIALTO_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME);
|
Some(bp_millau::RIALTO_PARACHAIN_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME);
|
||||||
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
|
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
|
||||||
Some(bp_rialto_parachain::MILLAU_TO_RIALTO_CONVERSION_RATE_PARAMETER_NAME);
|
Some(bp_rialto_parachain::MILLAU_TO_RIALTO_PARACHAIN_CONVERSION_RATE_PARAMETER_NAME);
|
||||||
|
|
||||||
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
|
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> =
|
||||||
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
|
Some(bp_millau::RIALTO_PARACHAIN_FEE_MULTIPLIER_PARAMETER_NAME);
|
||||||
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
|
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> =
|
||||||
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
|
Some(bp_rialto_parachain::MILLAU_FEE_MULTIPLIER_PARAMETER_NAME);
|
||||||
|
|
||||||
|
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> =
|
||||||
|
Some(bp_rialto_parachain::TRANSACTION_PAYMENT_PALLET_NAME);
|
||||||
|
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> =
|
||||||
|
Some(bp_millau::TRANSACTION_PAYMENT_PALLET_NAME);
|
||||||
|
|
||||||
type SourceChain = RialtoParachain;
|
type SourceChain = RialtoParachain;
|
||||||
type TargetChain = Millau;
|
type TargetChain = Millau;
|
||||||
|
|||||||
@@ -57,9 +57,8 @@ impl ChainBase for RialtoParachain {
|
|||||||
|
|
||||||
impl Chain for RialtoParachain {
|
impl Chain for RialtoParachain {
|
||||||
const NAME: &'static str = "RialtoParachain";
|
const NAME: &'static str = "RialtoParachain";
|
||||||
const TOKEN_ID: Option<&'static str> = None;
|
// RialtoParachain token has no value, but we associate it with DOT token
|
||||||
// should be fixed/changed in https://github.com/paritytech/parity-bridges-common/pull/1199
|
const TOKEN_ID: Option<&'static str> = Some("polkadot");
|
||||||
// should be removed in https://github.com/paritytech/parity-bridges-common/issues/1246
|
|
||||||
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str =
|
||||||
bp_rialto_parachain::BEST_FINALIZED_RIALTO_PARACHAIN_HEADER_METHOD;
|
bp_rialto_parachain::BEST_FINALIZED_RIALTO_PARACHAIN_HEADER_METHOD;
|
||||||
const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_secs(5);
|
const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_secs(5);
|
||||||
|
|||||||
Reference in New Issue
Block a user