diff --git a/integration-tests/bridges/environments/polkadot-kusama/bridges_polkadot_kusama.sh b/integration-tests/bridges/environments/polkadot-kusama/bridges_polkadot_kusama.sh index 040db39db3..8d66d8241d 100755 --- a/integration-tests/bridges/environments/polkadot-kusama/bridges_polkadot_kusama.sh +++ b/integration-tests/bridges/environments/polkadot-kusama/bridges_polkadot_kusama.sh @@ -207,7 +207,7 @@ case "$1" in "//Alice" \ 1000 \ "ws://127.0.0.1:9910" \ - "$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Kusama" } } }')" \ + "$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": "Kusama" }] } }')" \ "$GLOBAL_CONSENSUS_KUSAMA_SOVEREIGN_ACCOUNT" \ $AHP_KSM_ED \ true @@ -266,7 +266,7 @@ case "$1" in "//Alice" \ 1000 \ "ws://127.0.0.1:9010" \ - "$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Polkadot" } } }')" \ + "$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": "Polkadot" }] } }')" \ "$GLOBAL_CONSENSUS_POLKADOT_SOVEREIGN_ACCOUNT" \ $AHK_DOT_ED \ true diff --git a/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/dot-reaches-kusama.zndsl b/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/dot-reaches-kusama.zndsl index 13db4cca35..5b3084275f 100644 --- a/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/dot-reaches-kusama.zndsl +++ b/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/dot-reaches-kusama.zndsl @@ -6,7 +6,7 @@ Creds: config asset-hub-kusama-collator-1: run {{ENV_PATH}}/helper.sh with "reserve-transfer-assets-from-asset-hub-polkadot-local 50000000000" within 120 seconds # check that //Alice received at least 4.8 DOT on Kusama AH -asset-hub-kusama-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,48000000000,Polkadot" within 300 seconds +asset-hub-kusama-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with '{ "accountAddress": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", "expectedAssetBalance": 48000000000, "expectedAssetId": { "parents": 2, "interior": { "X1": [{ "GlobalConsensus": "Polkadot" }] }}}' within 300 seconds # check that the relayer //Charlie is rewarded by Kusama AH bridge-hub-kusama-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000001,0x62687064,ThisChain,0" within 30 seconds diff --git a/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/ksm-reaches-polkadot.zndsl b/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/ksm-reaches-polkadot.zndsl index c07bfa9732..ec97ad3286 100644 --- a/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/ksm-reaches-polkadot.zndsl +++ b/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/ksm-reaches-polkadot.zndsl @@ -6,7 +6,7 @@ Creds: config asset-hub-polkadot-collator-1: run {{ENV_PATH}}/helper.sh with "reserve-transfer-assets-from-asset-hub-kusama-local 5000000000000" within 120 seconds # check that //Alice received at least 4.8 KSM on Polkadot AH -asset-hub-polkadot-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,4800000000000,Kusama" within 300 seconds +asset-hub-polkadot-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with '{ "accountAddress": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", "expectedAssetBalance": 4800000000000, "expectedAssetId": { "parents": 2, "interior": { "X1": [{ "GlobalConsensus": "Kusama" }] }}}' within 300 seconds # check that the relayer //Charlie is rewarded by Polkadot AH bridge-hub-polkadot-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000001,0x62686b73,ThisChain,0" within 30 seconds diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs index d40ff9e449..a05f4a4b51 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs @@ -27,6 +27,7 @@ fn bridge_hub_kusama_genesis( invulnerables: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, + opened_bridges: Vec<(Location, InteriorLocation, Option)>, ) -> serde_json::Value { serde_json::json!({ "balances": BalancesConfig { @@ -61,19 +62,12 @@ fn bridge_hub_kusama_genesis( "polkadotXcm": { "safeXcmVersion": Some(SAFE_XCM_VERSION), }, + "xcmOverBridgeHubPolkadot": XcmOverBridgeHubPolkadotConfig { opened_bridges, ..Default::default() }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` }) } -pub fn bridge_hub_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_kusama_genesis(invulnerables(), testnet_accounts(), para_id) -} - -fn bridge_hub_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_kusama_local_testnet_genesis(para_id) -} - /// Provides the names of the predefined genesis configs for this runtime. pub fn preset_names() -> Vec { vec![PresetId::from("development"), PresetId::from("local_testnet")] @@ -82,8 +76,22 @@ pub fn preset_names() -> Vec { /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { - Ok("development") => bridge_hub_kusama_development_genesis(1002.into()), - Ok("local_testnet") => bridge_hub_kusama_local_testnet_genesis(1002.into()), + Ok("development") => bridge_hub_kusama_genesis( + invulnerables(), + testnet_accounts(), + 1002.into(), + vec![] + ), + Ok("local_testnet") => bridge_hub_kusama_genesis( + invulnerables(), + testnet_accounts(), + 1002.into(), + vec![( + Location::new(1, [Parachain(1000)]), + Junctions::from([GlobalConsensus(Polkadot), Parachain(1000)]), + Some(bp_messages::LegacyLaneId([0, 0, 0, 1])), + )], + ), _ => return None, }; Some( diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs index f9975ea649..639e120c70 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs @@ -93,7 +93,7 @@ parameter_types! { pub type RelayersForLegacyLaneIdsMessagesInstance = (); /// Allows collect and claim rewards for relayers. -impl pallet_bridge_relayers::Config for Runtime { +impl pallet_bridge_relayers::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Reward = Balance; type PaymentProcedure = bp_relayers::PayRewardFromAccount< diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs index 20b5409148..eac1428a38 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs @@ -27,6 +27,7 @@ fn bridge_hub_polkadot_genesis( invulnerables: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, + opened_bridges: Vec<(Location, InteriorLocation, Option)>, ) -> serde_json::Value { serde_json::json!({ "balances": BalancesConfig { @@ -61,6 +62,7 @@ fn bridge_hub_polkadot_genesis( "polkadotXcm": { "safeXcmVersion": Some(SAFE_XCM_VERSION), }, + "xcmOverBridgeHubKusama": XcmOverBridgeHubKusamaConfig { opened_bridges, ..Default::default() }, "ethereumSystem": EthereumSystemConfig { para_id: id, asset_hub_para_id: polkadot_runtime_constants::system_parachain::ASSET_HUB_ID.into(), @@ -71,14 +73,6 @@ fn bridge_hub_polkadot_genesis( }) } -pub fn bridge_hub_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_polkadot_genesis(invulnerables(), testnet_accounts(), para_id) -} - -fn bridge_hub_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_polkadot_local_testnet_genesis(para_id) -} - /// Provides the names of the predefined genesis configs for this runtime. pub fn preset_names() -> Vec { vec![PresetId::from("development"), PresetId::from("local_testnet")] @@ -87,8 +81,19 @@ pub fn preset_names() -> Vec { /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { - Ok("development") => bridge_hub_polkadot_development_genesis(1002.into()), - Ok("local_testnet") => bridge_hub_polkadot_local_testnet_genesis(1002.into()), + Ok("development") => { + bridge_hub_polkadot_genesis(invulnerables(), testnet_accounts(), 1002.into(), vec![]) + }, + Ok("local_testnet") => bridge_hub_polkadot_genesis( + invulnerables(), + testnet_accounts(), + 1002.into(), + vec![( + Location::new(1, [Parachain(1000)]), + Junctions::from([GlobalConsensus(Kusama), Parachain(1000)]), + Some(bp_messages::LegacyLaneId([0, 0, 0, 1])), + )], + ), _ => return None, }; Some(