This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Runtime: Polkadot Fellowship promotion/demotion periods, members acti…
…vity and salaries (#2607) * core fellowship * core fellowship weights * salary * weights * fellowship pot * registration period 15 days * use treasury account for salary pay, promotion origin * decision period for tracks 30 days * docs * comment * Couple of fixes and some refactoring * Alter curves to be a bit more conservative * Use `PayOverXcm` for fellowship salary payments * Docs and remove unneeded code * Fixes * Move Fellowship stuff in line with whitepaper * fix: induction by a single Fellow (not proficient) * doc fix * renames, pallet index, allow unpaid for salary pallet * Fix budget units * Fixes * Test sovereign account for Fellowship salaries * Nice address test * Fixes * test for PayOverXcm setup * Update parachains/runtimes/collectives/collectives-polkadot/src/fellowship/mod.rs Co-authored-by: Bastian Köcher <[email protected]> --------- Co-authored-by: Gav <[email protected]> Co-authored-by: Bastian Köcher <[email protected]>
- Loading branch information
1 parent
473569e
commit f2d66a2
Showing
19 changed files
with
1,177 additions
and
177 deletions.
There are no files selected for viewing
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
39 changes: 39 additions & 0 deletions
39
parachains/integration-tests/emulated/collectives/collectives-polkadot/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,39 @@ | ||
[package] | ||
name = "collectives-polkadot-it" | ||
version = "0.1.0" | ||
authors = ["Parity Technologies <[email protected]>"] | ||
edition = "2021" | ||
description = "Polkadot Collectives parachain runtime integration tests based on xcm-emulator" | ||
|
||
[dev-dependencies] | ||
codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } | ||
|
||
# Substrate | ||
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } | ||
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } | ||
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } | ||
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } | ||
sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } | ||
pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } | ||
pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } | ||
pallet-core-fellowship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } | ||
pallet-salary = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } | ||
|
||
# Polkadot | ||
polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } | ||
polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } | ||
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } | ||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } | ||
xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } | ||
xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } | ||
pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } | ||
|
||
# Cumulus | ||
parachains-common = { path = "../../../../common" } | ||
cumulus-pallet-xcmp-queue = { default-features = false, path = "../../../../../pallets/xcmp-queue" } | ||
collectives-polkadot-runtime = { path = "../../../../runtimes/collectives/collectives-polkadot" } | ||
asset-hub-polkadot-runtime = { path = "../../../../runtimes/assets/asset-hub-polkadot" } | ||
|
||
# Local | ||
xcm-emulator = { default-features = false, path = "../../../../../xcm/xcm-emulator" } | ||
integration-tests-common = { default-features = false, path = "../../common" } |
30 changes: 30 additions & 0 deletions
30
parachains/integration-tests/emulated/collectives/collectives-polkadot/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,30 @@ | ||
// Copyright Parity Technologies (UK) Ltd. | ||
// This file is part of Cumulus. | ||
|
||
// Cumulus 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. | ||
|
||
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Collectives Parachain integration tests based on xcm-emulator. | ||
#![cfg(test)] | ||
|
||
pub use frame_support::assert_ok; | ||
pub use integration_tests_common::{ | ||
constants::accounts::ALICE, AccountId, AssetHubPolkadot as AssetHub, | ||
AssetHubPolkadotPallet as AssetHubPallet, Collectives, CollectivesPallet, Polkadot, | ||
PolkadotMockNet, | ||
}; | ||
pub use xcm::prelude::*; | ||
pub use xcm_emulator::{assert_expected_events, Parachain}; | ||
|
||
mod tests; |
80 changes: 80 additions & 0 deletions
80
...hains/integration-tests/emulated/collectives/collectives-polkadot/src/tests/fellowship.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,80 @@ | ||
// Copyright Parity Technologies (UK) Ltd. | ||
// This file is part of Cumulus. | ||
|
||
// Cumulus 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. | ||
|
||
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Integration tests concerning the Fellowship. | ||
use crate::*; | ||
use collectives_polkadot_runtime::fellowship::FellowshipSalaryPaymaster; | ||
use frame_support::traits::{ | ||
fungibles::{Create, Mutate}, | ||
tokens::Pay, | ||
}; | ||
use sp_core::crypto::Ss58Codec; | ||
use xcm_emulator::{Network, TestExt}; | ||
|
||
#[test] | ||
fn pay_salary() { | ||
let asset_id: u32 = 1984; | ||
let pay_from: AccountId = | ||
<AccountId as Ss58Codec>::from_string("13w7NdvSR1Af8xsQTArDtZmVvjE8XhWNdL4yed3iFHrUNCnS") | ||
.unwrap(); | ||
let pay_to = Polkadot::account_id_of(ALICE); | ||
let pay_amount = 9000; | ||
|
||
PolkadotMockNet::_init(); | ||
PolkadotMockNet::reset(); | ||
|
||
AssetHub::execute_with(|| { | ||
type AssetHubAssets = <AssetHub as AssetHubPallet>::Assets; | ||
|
||
assert_ok!(<AssetHubAssets as Create<_>>::create( | ||
asset_id, | ||
pay_to.clone(), | ||
true, | ||
pay_amount / 2 | ||
)); | ||
assert_ok!(<AssetHubAssets as Mutate<_>>::mint_into(asset_id, &pay_from, pay_amount * 2)); | ||
}); | ||
|
||
Collectives::execute_with(|| { | ||
type RuntimeEvent = <Collectives as Parachain>::RuntimeEvent; | ||
|
||
assert_ok!(FellowshipSalaryPaymaster::pay(&pay_to, (), pay_amount)); | ||
assert_expected_events!( | ||
Collectives, | ||
vec![ | ||
RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) => {}, | ||
] | ||
); | ||
}); | ||
|
||
AssetHub::execute_with(|| { | ||
type RuntimeEvent = <AssetHub as Parachain>::RuntimeEvent; | ||
|
||
assert_expected_events!( | ||
AssetHub, | ||
vec![ | ||
RuntimeEvent::Assets(pallet_assets::Event::Transferred { asset_id: id, from, to, amount }) => { | ||
asset_id: id == &asset_id, | ||
from: from == &pay_from, | ||
to: to == &pay_to, | ||
amount: amount == &pay_amount, | ||
}, | ||
RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Success { .. }) => {}, | ||
] | ||
); | ||
}); | ||
} |
17 changes: 17 additions & 0 deletions
17
parachains/integration-tests/emulated/collectives/collectives-polkadot/src/tests/mod.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,17 @@ | ||
// Copyright Parity Technologies (UK) Ltd. | ||
// This file is part of Cumulus. | ||
|
||
// Cumulus 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. | ||
|
||
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
mod fellowship; |
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
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
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
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
Oops, something went wrong.