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

fix: coretime integration tests #157

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use emulated_integration_tests_common::{
impls::Parachain, xcm_emulator::decl_test_parachains,
};

// CollectivesPolkadot Parachain declaration
// CoretimePolkadot Parachain declaration
decl_test_parachains! {
pub struct CoretimePaseo {
genesis = genesis::genesis(),
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/emulated/chains/relays/paseo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use emulated_integration_tests_common::{
xcm_emulator::decl_test_relay_chains,
};

// Polkadot declaration
// Paseo declaration
decl_test_relay_chains! {
#[api_version(11)]
pub struct Paseo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ pub use emulated_integration_tests_common::{
pub use parachains_common::{AccountId, Balance};
pub use paseo_system_emulated_network::{
coretime_paseo_emulated_chain::{
genesis::ED as CORETIME_POLKADOT_ED, CoretimePaseoParaPallet as CoretimePaseoPallet,
genesis::ED as CORETIME_POLKADOT_ED, CoretimePaseoParaPallet as CoretimePolkadotPallet,
},
paseo_emulated_chain::{genesis::ED as POLKAPAS_ED, PaseoRelayPallet as PaseoPallet},
paseo_emulated_chain::{genesis::ED as POLKADOT_ED, PaseoRelayPallet as PaseoPallet},
CoretimePaseoPara as CoretimePolkadot,
CoretimePaseoParaReceiver as CoretimePolkadotReceiver,
CoretimePaseoParaSender as CoretimePaseoSender, PenpalAPara as PenpalA,
CoretimePaseoParaSender as CoretimePolkadotSender, PenpalAPara as PenpalA,
PaseoRelay as Paseo, PaseoRelayReceiver as PaseoReceiver,
PaseoRelaySender as PaseoSender,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn transact_hardcoded_weights_are_sane() {
CoretimePolkadot::execute_with(|| {
// Hooks don't run in emulated tests - workaround as we need `on_initialize` to tick things
// along and have no concept of time passing otherwise.
<CoretimePolkadot as CoretimePaseoPallet>::Broker::on_initialize(
<CoretimePolkadot as CoretimePolkadotPallet>::Broker::on_initialize(
<CoretimePolkadot as Chain>::System::block_number(),
);

Expand All @@ -53,7 +53,7 @@ fn transact_hardcoded_weights_are_sane() {
})
}

assert_ok!(<CoretimePolkadot as CoretimePaseoPallet>::Broker::reserve(
assert_ok!(<CoretimePolkadot as CoretimePolkadotPallet>::Broker::reserve(
coretime_root_origin.clone(),
schedule.try_into().expect("Vector is within bounds."),
));
Expand All @@ -69,11 +69,11 @@ fn transact_hardcoded_weights_are_sane() {
renewal_bump: Perbill::from_percent(2),
contribution_timeout: 1,
};
assert_ok!(<CoretimePolkadot as CoretimePaseoPallet>::Broker::configure(
assert_ok!(<CoretimePolkadot as CoretimePolkadotPallet>::Broker::configure(
coretime_root_origin.clone(),
config
));
assert_ok!(<CoretimePolkadot as CoretimePaseoPallet>::Broker::start_sales(
assert_ok!(<CoretimePolkadot as CoretimePolkadotPallet>::Broker::start_sales(
coretime_root_origin,
100,
0
Expand Down Expand Up @@ -129,7 +129,7 @@ fn transact_hardcoded_weights_are_sane() {
while block_number_cursor < TIMESLICE_PERIOD - config.advance_notice - 1 {
CoretimePolkadot::execute_with(|| {
// Hooks don't run in emulated tests - workaround.
<CoretimePolkadot as CoretimePaseoPallet>::Broker::on_initialize(
<CoretimePolkadot as CoretimePolkadotPallet>::Broker::on_initialize(
<CoretimePolkadot as Chain>::System::block_number(),
);
});
Expand All @@ -142,7 +142,7 @@ fn transact_hardcoded_weights_are_sane() {
// In this block we trigger assign core.
CoretimePolkadot::execute_with(|| {
// Hooks don't run in emulated tests - workaround.
<CoretimePolkadot as CoretimePaseoPallet>::Broker::on_initialize(
<CoretimePolkadot as CoretimePolkadotPallet>::Broker::on_initialize(
<CoretimePolkadot as Chain>::System::block_number(),
);

Expand All @@ -165,7 +165,7 @@ fn transact_hardcoded_weights_are_sane() {
// In this block we trigger request revenue.
CoretimePolkadot::execute_with(|| {
// Hooks don't run in emulated tests - workaround.
<CoretimePolkadot as CoretimePaseoPallet>::Broker::on_initialize(
<CoretimePolkadot as CoretimePolkadotPallet>::Broker::on_initialize(
<CoretimePolkadot as Chain>::System::block_number(),
);

Expand Down Expand Up @@ -203,7 +203,7 @@ fn transact_hardcoded_weights_are_sane() {
// Here we receive and process the notify_revenue XCM with zero revenue.
CoretimePolkadot::execute_with(|| {
// Hooks don't run in emulated tests - workaround.
<CoretimePolkadot as CoretimePaseoPallet>::Broker::on_initialize(
<CoretimePolkadot as CoretimePolkadotPallet>::Broker::on_initialize(
<CoretimePolkadot as Chain>::System::block_number(),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// limitations under the License.

use crate::*;
use coretime_paseo_runtime::xcm_config::XcmConfig;
use frame_support::{
dispatch::RawOrigin, sp_runtime::traits::Dispatchable, traits::fungible::Mutate,
};
Expand All @@ -28,20 +29,20 @@ use xcm_runtime_apis::{

#[test]
fn teleport_from_and_to_relay() {
let amount = POLKADOT_ED * 1000;
let amount = CORETIME_POLKADOT_ED * 1000;
let native_asset: Assets = (Here, amount).into();

test_relay_is_trusted_teleporter!(
Polkadot,
PolkadotXcmConfig,
Paseo,
PaseoXcmConfig,
vec![CoretimePolkadot],
(native_asset, amount)
);

test_parachain_is_trusted_teleporter_for_relay!(
CoretimePolkadot,
CoretimePolkadotXcmConfig,
Polkadot,
CoretimePaseoXcmConfig,
Paseo,
amount
);
}