Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate new xcm-emulator #1324

Merged
112 changes: 94 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
try-runtime-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
xcm-simulator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }

# Substrate (wasm)
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
Expand All @@ -186,6 +185,7 @@ pallet-contracts-primitives = { git = "https://github.com/paritytech/polkadot-sd
pallet-democracy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-identity = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-im-online = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-insecure-randomness-collective-flip = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-membership = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
Expand All @@ -203,8 +203,11 @@ parity-scale-codec = { version = "3.6.9", default-features = false }
scale-info = { version = "2.11.1", default-features = false }
sp-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-arithmetic = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-consensus-babe = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-consensus-beefy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
sp-debug-derive = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
Expand All @@ -222,6 +225,7 @@ substrate-fixed = { git = "https://github.com/encointer/substrate-fixed", defaul
polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
polkadot-test-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
xcm-emulator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }

# Polkadot / XCM (wasm)
pallet-message-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
Expand All @@ -231,6 +235,7 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", bran
polkadot-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
rococo-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
rococo-runtime-constants = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
Expand Down Expand Up @@ -352,6 +357,10 @@ panic = "unwind"
# Commits:
# - cb803be8cdc52d020890308a2076d752a8c4ce5c
pallet-assets = { git = "https://github.com/zeitgeistpm/polkadot-sdk", branch = "zeitgeist-polkadot-v1.1.0" }
# xcm-emulator incompatible block number type fixed
# Commits:
# -
Comment on lines +360 to +362
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this comment mean?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it's missing the commit hash of the changes. The comments should indicate what the patch is for and which commits deviate from the original repository.

xcm-emulator = { git = "https://github.com/zeitgeistpm/polkadot-sdk", branch = "release-polkadot-v1.1.0-xcm-emulator-type-fix" }

[patch."https://github.com/galacticcouncil/HydraDX-node"]
# Ensure same Substrate dependencies are used everywhere
Expand Down
7 changes: 6 additions & 1 deletion runtime/battery-station/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,13 @@ zrml-swaps-runtime-api = { workspace = true }

[dev-dependencies]
env_logger = { workspace = true }
pallet-im-online = { workspace = true, features = ["default"] }
sp-authority-discovery = { workspace = true, features = ["default"] }
sp-consensus-babe = { workspace = true, features = ["default"] }
sp-consensus-beefy = { workspace = true, features = ["default"] }
sp-io = { workspace = true, features = ["default"] }
test-case = { workspace = true }
xcm-simulator = { workspace = true }
xcm-emulator = { workspace = true }

[features]
default = ["std"]
Expand Down Expand Up @@ -333,6 +337,7 @@ std = [
# Zeitgeist

"zeitgeist-primitives/std",
"zrml-asset-router/std",
"zrml-authorized/std",
"zrml-court/std",
"zrml-hybrid-router/std",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright 2024 Forecasting Technologies LTD.
//
// This file is part of Zeitgeist.
//
// Zeitgeist is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at
// your option) any later version.
//
// Zeitgeist is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Zeitgeist. If not, see <https://www.gnu.org/licenses/>.

use crate::{
integration_tests::xcm::setup::{
accounts, ztg, BTC_ID, FOREIGN_PARENT_ID, FOREIGN_SIBLING_ID, FOREIGN_ZTG_ID,
},
parachain_params::MinCandidateStk,
parameters::ZeitgeistTreasuryAccount,
Asset,
};
use nimbus_primitives::NimbusId;
use sp_core::storage::Storage;
use sp_runtime::BuildStorage;

const ENDOWMENT: u128 = ztg(1_000_000);
const SAFE_XCM_VERSION: u32 = 2;

pub(crate) fn genesis(parachain_id: u32) -> Storage {
let genesis_config = crate::RuntimeGenesisConfig {
author_mapping: crate::AuthorMappingConfig {
mappings: vec![(
accounts::get_from_seed::<NimbusId>(accounts::ALICE),
accounts::alice(),
)],
},
balances: crate::BalancesConfig {
balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
},
parachain_info: crate::ParachainInfoConfig {
parachain_id: parachain_id.into(),
..Default::default()
},
parachain_staking: crate::ParachainStakingConfig {
candidates: vec![(accounts::alice(), MinCandidateStk::get())],
..Default::default()
},
polkadot_xcm: crate::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
system: crate::SystemConfig {
code: crate::WASM_BINARY.unwrap().to_vec(),
..Default::default()
},
tokens: crate::TokensConfig {
balances: accounts::init_balances()
.iter()
.chain(vec![(ZeitgeistTreasuryAccount::get())].iter())
.map(|k| {
vec![
(k.clone(), Asset::from(FOREIGN_PARENT_ID).try_into().unwrap(), ENDOWMENT),
(k.clone(), Asset::from(FOREIGN_SIBLING_ID).try_into().unwrap(), ENDOWMENT),
(k.clone(), Asset::from(FOREIGN_ZTG_ID).try_into().unwrap(), ENDOWMENT),
(k.clone(), Asset::from(BTC_ID).try_into().unwrap(), ENDOWMENT),
]
})
.flatten()
.collect::<Vec<_>>(),
},
..Default::default()
};

genesis_config.build_storage().unwrap()
}
19 changes: 19 additions & 0 deletions runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2024 Forecasting Technologies LTD.
//
// This file is part of Zeitgeist.
//
// Zeitgeist is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at
// your option) any later version.
//
// Zeitgeist is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Zeitgeist. If not, see <https://www.gnu.org/licenses/>.

pub(super) mod battery_station;
pub(super) mod rococo;
Loading
Loading