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

Polkadot v1.7.2 #74

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,3 @@ sp-npos-elections = { git = "https://github.com/paritytech/polkadot-sdk", branch
sp-session = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" }
sp-staking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" }
sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" }

#[patch."https://github.com/moonbeam-foundation/open-runtime-module-library"]
#orml-traits = { version = "0.8.0" }
#orml-utilities = { version = "0.8.0" }
4 changes: 1 addition & 3 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ cumulus-client-parachain-inherent = { git = "https://github.com/paritytech/polka
[dev-dependencies]
staging-parachain-info = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" }

#polkadot-runtime = { git = "https://github.com/polkadot-fellows/runtimes", tag = "v1.2.0" }
#polkadot-runtime = { git = "https://github.com/polkadot-fellows/runtimes", rev = "59172d5fb8feea2646490618bead3b2b4fb06220" }
polkadot-test-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.7.2" }
polkadot-test-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = true, branch = "release-polkadot-v1.7.2" }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" }
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" }
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" }
Expand Down
1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(associated_type_bounds)]
// TODO: Remove before release
#![allow(dead_code)]
// Copyright 2021 Centrifuge Foundation (centrifuge.io).
Expand Down
54 changes: 27 additions & 27 deletions core/src/tests/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ use pallet_xcm_transactor::{Currency, CurrencyPayment, TransactWeights};
use polkadot_core_primitives::Block as RTestBlock;
use polkadot_parachain_primitives::primitives::{Id, Sibling};
use polkadot_primitives::{AssignmentId, AuthorityDiscoveryId, ValidatorId};
use polkadot_runtime::{
use polkadot_runtime_parachains::{configuration, configuration::HostConfiguration, dmp};
use polkadot_test_runtime::{
Runtime as RRuntime, RuntimeApi as RTestRtApi, RuntimeOrigin as RRuntimeOrigin,
WASM_BINARY as RCODE,
};
use polkadot_runtime_parachains::{configuration, configuration::HostConfiguration, dmp};
use sc_service::{TFullBackend, TFullClient};
use sp_consensus_babe::SlotDuration;
use sp_core::{crypto::AccountId32, ByteArray, H256};
Expand All @@ -39,8 +39,8 @@ use sp_std::sync::Arc;
use tokio::runtime::Handle;
use xcm::{
prelude::XCM_VERSION,
v3::{Junction, Junctions, MultiLocation, Weight},
VersionedMultiLocation, VersionedXcm,
v4::{Junction, Junctions, Location, Weight},
VersionedLocation, VersionedXcm,
};

///! Test for the ParachainBuilder
Expand Down Expand Up @@ -89,7 +89,7 @@ fn default_para_builder(
.unwrap();
state
.insert_storage(
parachain_info::GenesisConfig::<PRuntime> {
staging_parachain_info::GenesisConfig::<PRuntime> {
_config: Default::default(),
parachain_id: Id::from(para_id),
}
Expand Down Expand Up @@ -226,14 +226,10 @@ fn default_relay_builder(
keys: vec![(
AccountId32::from_slice([0u8; 32].as_slice()).unwrap(),
AccountId32::from_slice([0u8; 32].as_slice()).unwrap(),
polkadot_runtime::SessionKeys {
polkadot_test_runtime::SessionKeys {
grandpa: pallet_grandpa::AuthorityId::from_slice([0u8; 32].as_slice())
.unwrap(),
babe: pallet_babe::AuthorityId::from_slice([0u8; 32].as_slice()).unwrap(),
im_online: pallet_im_online::sr25519::AuthorityId::from_slice(
[0u8; 32].as_slice(),
)
.unwrap(),
para_validator: ValidatorId::from_slice([0u8; 32].as_slice()).unwrap(),
para_assignment: AssignmentId::from_slice([0u8; 32].as_slice()).unwrap(),
authority_discovery: AuthorityDiscoveryId::from_slice([0u8; 32].as_slice())
Expand Down Expand Up @@ -563,7 +559,7 @@ async fn multi_parachains_can_send_xcm_messages() {
.with_mut_state(|| {
polkadot_runtime_parachains::hrmp::Pallet::<RRuntime>::force_process_hrmp_open(
RRuntimeOrigin::root(),
0,
lemunozm marked this conversation as resolved.
Show resolved Hide resolved
2,
)
.unwrap();
})
Expand Down Expand Up @@ -601,22 +597,22 @@ async fn multi_parachains_can_send_xcm_messages() {
remark: remark.clone(),
});

let para_1_location = VersionedMultiLocation::from(MultiLocation::new(
let para_1_location = VersionedLocation::from(Location::new(
1,
Junctions::X1(Junction::Parachain(PARA_ID_1)),
Junctions::X1(Arc::new([Junction::Parachain(PARA_ID_1)])),
lemunozm marked this conversation as resolved.
Show resolved Hide resolved
));
let para_2_location = VersionedMultiLocation::from(MultiLocation::new(
let para_2_location = VersionedLocation::from(Location::new(
1,
Junctions::X1(Junction::Parachain(PARA_ID_2)),
Junctions::X1(Arc::new([Junction::Parachain(PARA_ID_2)])),
));

para_1_builder
.with_mut_state(|| {
pallet_xcm::Pallet::<PRuntime>::force_xcm_version(
PRuntimeOrigin::root(),
Box::new(MultiLocation::new(
Box::new(Location::new(
1,
Junctions::X1(Junction::Parachain(PARA_ID_2)),
Junctions::X1(Arc::new([Junction::Parachain(PARA_ID_2)])),
)),
XCM_VERSION,
)
Expand All @@ -628,9 +624,9 @@ async fn multi_parachains_can_send_xcm_messages() {
.with_mut_state(|| {
pallet_xcm::Pallet::<PRuntime>::force_xcm_version(
PRuntimeOrigin::root(),
Box::new(MultiLocation::new(
Box::new(Location::new(
1,
Junctions::X1(Junction::Parachain(PARA_ID_1)),
Junctions::X1(Arc::new([Junction::Parachain(PARA_ID_1)])),
)),
XCM_VERSION,
)
Expand Down Expand Up @@ -721,10 +717,10 @@ async fn multi_parachains_can_send_xcm_messages() {
pallet_xcm_transactor::Pallet::<PRuntime>::transact_through_sovereign(
PRuntimeOrigin::root(),
Box::new(para_2_location),
Sibling::from(PARA_ID_1).into_account_truncating(),
None,
CurrencyPayment {
currency: Currency::AsMultiLocation(Box::new(VersionedMultiLocation::from(
MultiLocation::new(1, Junctions::X1(Junction::Parachain(PARA_ID_2))),
currency: Currency::AsMultiLocation(Box::new(VersionedLocation::from(
Location::new(1, Junctions::X1(Arc::new([Junction::Parachain(PARA_ID_2)]))),
))),
fee_amount: Some(1_000),
},
Expand Down Expand Up @@ -766,7 +762,9 @@ async fn multi_parachains_can_send_xcm_messages() {

para_2_builder
.with_state(|| {
frame_system::Pallet::<PRuntime>::events()
let events = frame_system::Pallet::<PRuntime>::events();

events
.into_iter()
.find(|e| match e.event {
PRuntimeEvent::System(frame_system::Event::<PRuntime>::Remarked {
Expand All @@ -786,10 +784,10 @@ async fn multi_parachains_can_send_xcm_messages() {
pallet_xcm_transactor::Pallet::<PRuntime>::transact_through_sovereign(
PRuntimeOrigin::root(),
Box::new(para_1_location),
Sibling::from(PARA_ID_2).into_account_truncating(),
None,
CurrencyPayment {
currency: Currency::AsMultiLocation(Box::new(VersionedMultiLocation::from(
MultiLocation::new(1, Junctions::X1(Junction::Parachain(PARA_ID_1))),
currency: Currency::AsMultiLocation(Box::new(VersionedLocation::from(
Location::new(1, Junctions::X1(Arc::new([Junction::Parachain(PARA_ID_1)]))),
))),
fee_amount: Some(1_000),
},
Expand Down Expand Up @@ -831,7 +829,9 @@ async fn multi_parachains_can_send_xcm_messages() {

para_1_builder
.with_state(|| {
frame_system::Pallet::<PRuntime>::events()
let events = frame_system::Pallet::<PRuntime>::events();

events
.into_iter()
.find(|e| match e.event {
PRuntimeEvent::System(frame_system::Event::<PRuntime>::Remarked {
Expand Down
2 changes: 1 addition & 1 deletion core/src/tests/relay_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// GNU General Public License for more details.

use fudge_test_runtime::WASM_BINARY as PARA_CODE;
use polkadot_core_primitives::BlockId;
use polkadot_parachain_primitives::primitives::{HeadData, Id, ValidationCode};
use polkadot_test_runtime::{
Block as TestBlock, Runtime, RuntimeApi as TestRtApi, WASM_BINARY as CODE,
Expand All @@ -20,6 +19,7 @@ use sc_service::{TFullBackend, TFullClient};
use sp_consensus_babe::SlotDuration;
use sp_core::H256;
use sp_inherents::CreateInherentDataProviders;
use sp_runtime::generic::BlockId;
use sp_runtime::{traits::Hash as _, Storage};
use sp_std::sync::Arc;
use tokio::runtime::Handle;
Expand Down
34 changes: 20 additions & 14 deletions core/src/tests/stand_alone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
use std::path::PathBuf;

use frame_benchmarking::account;
use polkadot_core_primitives::BlockId;
use polkadot_runtime::{Block as TestBlock, Runtime, RuntimeApi as TestRtApi, WASM_BINARY as CODE};
use frame_support::traits::{Currency, ExistenceRequirement};
use polkadot_test_runtime::{
Block as TestBlock, Runtime, RuntimeApi as TestRtApi, WASM_BINARY as CODE,
};
use sc_service::{TFullBackend, TFullClient};
use sp_consensus_babe::SlotDuration;
use sp_core::H256;
use sp_inherents::CreateInherentDataProviders;
use sp_runtime::{AccountId32, BuildStorage, MultiAddress, Storage};
use sp_runtime::generic::BlockId;
use sp_runtime::{AccountId32, BuildStorage, Storage};
use sp_std::sync::Arc;
use tokio::runtime::Handle;

Expand Down Expand Up @@ -132,10 +135,11 @@ async fn mutating_genesis_works() {
let mut builder = default_builder(Handle::current(), genesis);
let (send_data_pre, recv_data_pre) = builder
.with_mut_state(|| {
polkadot_runtime::Balances::transfer(
polkadot_runtime::RuntimeOrigin::signed(AccountId32::new([0u8; 32])),
MultiAddress::Id(account("test", 0, 0)),
polkadot_test_runtime::Balances::transfer(
&AccountId32::new([0u8; 32]),
&account("test", 0, 0),
1_000_000_000_000u128,
ExistenceRequirement::AllowDeath,
)
.unwrap();

Expand Down Expand Up @@ -224,7 +228,7 @@ async fn opening_state_from_db_path_works() {
.into_iter()
.map(|record| record.event.clone())
.collect::<Vec<_>>()
.contains(&polkadot_runtime::RuntimeEvent::Balances(
.contains(&polkadot_test_runtime::RuntimeEvent::Balances(
pallet_balances::Event::<Runtime>::Transfer {
from: AccountId32::new([0u8; 32]),
to: account::<AccountId32>("test", 0, 0),
Expand All @@ -234,10 +238,11 @@ async fn opening_state_from_db_path_works() {

let (send_data_post_20, recv_data_post_20) = builder
.with_mut_state(|| {
polkadot_runtime::Balances::transfer(
polkadot_runtime::RuntimeOrigin::signed(AccountId32::new([0u8; 32])),
MultiAddress::Id(account("test", 0, 0)),
polkadot_test_runtime::Balances::transfer(
&AccountId32::new([0u8; 32]),
&account("test", 0, 0),
1_000_000_000_000u128,
ExistenceRequirement::AllowDeath,
)
.unwrap();

Expand Down Expand Up @@ -266,7 +271,7 @@ async fn opening_state_from_db_path_works() {
.iter()
.map(|record| record.event.clone())
.collect::<Vec<_>>()
.contains(&polkadot_runtime::RuntimeEvent::Balances(
.contains(&polkadot_test_runtime::RuntimeEvent::Balances(
pallet_balances::Event::<Runtime>::Transfer {
from: AccountId32::new([0u8; 32]),
to: account::<AccountId32>("test", 0, 0),
Expand Down Expand Up @@ -343,10 +348,11 @@ async fn build_relay_block_works_and_mut_is_build_upon() {

let (send_data_pre, recv_data_pre) = builder
.with_mut_state(|| {
polkadot_runtime::Balances::transfer(
polkadot_runtime::RuntimeOrigin::signed(AccountId32::new([0u8; 32])),
MultiAddress::Id(account("test", 0, 0)),
polkadot_test_runtime::Balances::transfer(
&AccountId32::new([0u8; 32]),
&account("test", 0, 0),
1_000_000_000_000u128,
ExistenceRequirement::AllowDeath,
)
.unwrap();

Expand Down
1 change: 1 addition & 0 deletions core/src/tests/test-parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ construct_runtime!(
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 102,
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 103,
XcmTransactor: pallet_xcm_transactor::{Pallet, Call, Storage, Event<T>} = 104,
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 105,

// admin stuff
Sudo: pallet_sudo::{Pallet, Call, Config<T>, Storage, Event<T>} = 200,
Expand Down
Loading