forked from polkadot-fellows/runtimes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add XcmPaymentApi and DryRunApi to all runtimes (polkadot-fellows#380)
Adds the paritytech/polkadot-sdk#3607 and paritytech/polkadot-sdk#3872 to all runtimes. These APIs work together to allow dry running and estimating execution and delivery fees for XCMs. This PR doesn't allow querying the price in assets different than the relay token for asset hubs. Can be done in a following PR. Also tracking polkadot-fellows#388 and polkadot-fellows#389 for future improvemens. Old PR was polkadot-fellows#359, this one targets main already updated to Polkadot SDK 1.13. ## Dear reviewer Although there are a lot of changes, the main one is the addition of the two aforementioned APIs to all relays and system parachains. The rest of the files are tests, which all have the same format.
- Loading branch information
1 parent
d0855a4
commit 7723274
Showing
56 changed files
with
1,950 additions
and
377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
integration-tests/emulated/chains/parachains/coretime/coretime-kusama/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "coretime-kusama-emulated-chain" | ||
version = "0.0.0" | ||
authors.workspace = true | ||
edition.workspace = true | ||
license = "Apache-2.0" | ||
description = "Coretime Kusama emulated chain used for integration tests" | ||
publish = false | ||
|
||
[dependencies] | ||
|
||
# Substrate | ||
sp-core = { workspace = true, default-features = true } | ||
frame-support = { workspace = true, default-features = true } | ||
|
||
# Cumulus | ||
parachains-common = { workspace = true, default-features = true } | ||
cumulus-primitives-core = { workspace = true, default-features = true } | ||
emulated-integration-tests-common = { workspace = true } | ||
|
||
# Runtimes | ||
coretime-kusama-runtime = { workspace = true } |
66 changes: 66 additions & 0 deletions
66
integration-tests/emulated/chains/parachains/coretime/coretime-kusama/src/genesis.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Substrate | ||
use sp_core::storage::Storage; | ||
|
||
// Cumulus | ||
use emulated_integration_tests_common::{ | ||
accounts, build_genesis_storage, collators, SAFE_XCM_VERSION, | ||
}; | ||
use parachains_common::Balance; | ||
|
||
pub const PARA_ID: u32 = 1001; | ||
pub const ED: Balance = coretime_kusama_runtime::ExistentialDeposit::get(); | ||
|
||
pub fn genesis() -> Storage { | ||
let genesis_config = coretime_kusama_runtime::RuntimeGenesisConfig { | ||
system: coretime_kusama_runtime::SystemConfig::default(), | ||
balances: coretime_kusama_runtime::BalancesConfig { | ||
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), | ||
}, | ||
parachain_info: coretime_kusama_runtime::ParachainInfoConfig { | ||
parachain_id: PARA_ID.into(), | ||
..Default::default() | ||
}, | ||
collator_selection: coretime_kusama_runtime::CollatorSelectionConfig { | ||
invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), | ||
candidacy_bond: ED * 16, | ||
..Default::default() | ||
}, | ||
session: coretime_kusama_runtime::SessionConfig { | ||
keys: collators::invulnerables() | ||
.into_iter() | ||
.map(|(acc, aura)| { | ||
( | ||
acc.clone(), // account id | ||
acc, // validator id | ||
coretime_kusama_runtime::SessionKeys { aura }, // session keys | ||
) | ||
}) | ||
.collect(), | ||
}, | ||
polkadot_xcm: coretime_kusama_runtime::PolkadotXcmConfig { | ||
safe_xcm_version: Some(SAFE_XCM_VERSION), | ||
..Default::default() | ||
}, | ||
..Default::default() | ||
}; | ||
|
||
build_genesis_storage( | ||
&genesis_config, | ||
coretime_kusama_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"), | ||
) | ||
} |
50 changes: 50 additions & 0 deletions
50
integration-tests/emulated/chains/parachains/coretime/coretime-kusama/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
pub mod genesis; | ||
|
||
// Substrate | ||
use frame_support::traits::OnInitialize; | ||
|
||
// Cumulus | ||
use emulated_integration_tests_common::{ | ||
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain, | ||
impls::Parachain, xcm_emulator::decl_test_parachains, | ||
}; | ||
|
||
// CollectivesPolkadot Parachain declaration | ||
decl_test_parachains! { | ||
pub struct CoretimeKusama { | ||
genesis = genesis::genesis(), | ||
on_init = { | ||
coretime_kusama_runtime::AuraExt::on_initialize(1); | ||
}, | ||
runtime = coretime_kusama_runtime, | ||
core = { | ||
XcmpMessageHandler: coretime_kusama_runtime::XcmpQueue, | ||
LocationToAccountId: coretime_kusama_runtime::xcm_config::LocationToAccountId, | ||
ParachainInfo: coretime_kusama_runtime::ParachainInfo, | ||
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin, | ||
}, | ||
pallets = { | ||
PolkadotXcm: coretime_kusama_runtime::PolkadotXcm, | ||
Balances: coretime_kusama_runtime::Balances, | ||
} | ||
}, | ||
} | ||
|
||
// CoretimeKusama implementation | ||
impl_accounts_helpers_for_parachain!(CoretimeKusama); | ||
impl_assert_events_helpers_for_parachain!(CoretimeKusama); |
Oops, something went wrong.