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

Rococo & Westend People Chain #2281

Merged
merged 87 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
7c147e5
people node
joepetrowski Sep 11, 2023
da57ca2
fmt
joepetrowski Sep 11, 2023
5f247a9
runtimes
joepetrowski Sep 12, 2023
245b0bf
with trailing topic
joepetrowski Sep 12, 2023
5379f08
add identity pallet
joepetrowski Sep 12, 2023
5307a34
use fn deposit
joepetrowski Sep 12, 2023
97e8da4
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Sep 14, 2023
75f6f3d
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Sep 16, 2023
329fc60
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Sep 16, 2023
d48df8f
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Sep 20, 2023
475d4f0
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Sep 27, 2023
2904475
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Oct 24, 2023
4c828df
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Oct 26, 2023
d14c6a3
add chainspec generation scripts
joepetrowski Oct 26, 2023
c5bf431
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Nov 1, 2023
195f209
remove polkadot and kusama
joepetrowski Nov 1, 2023
e2f1b1b
fix build after merge
joepetrowski Nov 1, 2023
ba6e778
add new identity info
joepetrowski Nov 1, 2023
1a62aee
fix
joepetrowski Nov 2, 2023
c2f0728
merge master
joepetrowski Nov 3, 2023
83d0d60
updates for Message Queue and charging for IdentityInfo bytes
joepetrowski Nov 5, 2023
6ee265f
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Nov 5, 2023
b5c9ca5
update for chain spec changes (1256)
joepetrowski Nov 5, 2023
ffe049e
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Nov 11, 2023
eada8b3
add new config to westend
joepetrowski Nov 11, 2023
fa4e4e6
teleport slashed funds to relay treasury account
joepetrowski Nov 11, 2023
316d16b
remove kusama and polkadot chainspecs
joepetrowski Nov 12, 2023
d1a50b1
apache 2 license in runtime
joepetrowski Nov 12, 2023
7ad3273
zepter
joepetrowski Nov 12, 2023
fbefc83
add sp_std prelude
joepetrowski Nov 12, 2023
3ad640f
Get for benchmarks
joepetrowski Nov 12, 2023
5e9a6bf
Apply suggestions from code review
joepetrowski Nov 14, 2023
91bf984
remove TypeInfo, block calls for migration, set trusted teleporters t…
joepetrowski Nov 14, 2023
6af48da
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Nov 15, 2023
939448d
add migrator
joepetrowski Nov 15, 2023
d609846
merge master
joepetrowski Nov 15, 2023
affa9cd
move ToParentTreasury
joepetrowski Nov 15, 2023
7a29719
benchmark xcm updates
joepetrowski Nov 15, 2023
5cd43d1
merge master
joepetrowski Nov 24, 2023
b6e7ec5
clippy
joepetrowski Nov 24, 2023
1101a48
combine match arms
joepetrowski Nov 25, 2023
24a952f
merge master again
joepetrowski Nov 26, 2023
46c6939
add chain spec files
joepetrowski Nov 26, 2023
3005ab3
fix build
joepetrowski Nov 27, 2023
080c964
sp-genesis-builder implemented for runtimes
michalkucharczyk Nov 27, 2023
7ee3270
use right GenericChainSpec
michalkucharczyk Nov 27, 2023
b663874
chain specs fields paths corrected in script
michalkucharczyk Nov 27, 2023
805e238
chain specs fields paths corrected in script (westend)
michalkucharczyk Nov 27, 2023
4652729
merge michal's fix
joepetrowski Nov 27, 2023
f0156d4
lock
joepetrowski Nov 27, 2023
a310f50
Update cumulus/scripts/create_people_rococo_spec.sh
joepetrowski Nov 27, 2023
0ce870d
make chain specs
joepetrowski Nov 27, 2023
ecd18a1
Merge branch 'master' into joe-people-chain
joepetrowski Nov 28, 2023
9be05ed
delete chainspecs that should have been symlinks
joepetrowski Nov 28, 2023
1219feb
add symlinks
joepetrowski Nov 28, 2023
2110e45
delete again
joepetrowski Nov 28, 2023
c070173
relative
joepetrowski Nov 28, 2023
3bfd0bc
Merge branch 'master' into joe-people-chain
seadanda Nov 29, 2023
406548b
Merge branch 'master' into joe-people-chain
joepetrowski Nov 30, 2023
07e3d3e
donal's feedback
joepetrowski Nov 30, 2023
456f2f3
merge master
joepetrowski Dec 1, 2023
11de1c2
taplo
joepetrowski Dec 1, 2023
f46d8a0
make westend relay work with people
joepetrowski Dec 5, 2023
38e6b97
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Dec 5, 2023
2ae94b1
fix authority-discovery toml
joepetrowski Dec 5, 2023
39e7e45
prdoc
joepetrowski Dec 5, 2023
d186f73
Create xcm emulator tests for People-Rococo (#2373)
0xmovses Dec 5, 2023
ec2be5b
add emulator tests for westend
joepetrowski Dec 5, 2023
d1baffd
Merge remote-tracking branch 'origin' into joe-people-chain (rust 1.74)
joepetrowski Dec 7, 2023
c32b5e3
new xcm weight
joepetrowski Dec 7, 2023
cfd3977
fix ah tests
joepetrowski Dec 7, 2023
bd06c79
merge master
joepetrowski Dec 14, 2023
837ce6c
Merge remote-tracking branch 'origin' into joe-people-chain
joepetrowski Dec 18, 2023
79397d3
update to master
joepetrowski Dec 18, 2023
c773a32
fix clippy
joepetrowski Dec 18, 2023
cd9624d
make clippy happy (i think)
joepetrowski Dec 18, 2023
50ef8df
merge master
joepetrowski Dec 20, 2023
16d233c
weights
joepetrowski Dec 20, 2023
46e8aa6
check interior sibling is para
joepetrowski Dec 21, 2023
cf9ca22
add real FeeManager impl
joepetrowski Dec 21, 2023
8ff8262
unpaid ToParentTreasury
joepetrowski Dec 21, 2023
ed93d11
merge master
joepetrowski Dec 21, 2023
7adfb26
format
joepetrowski Dec 21, 2023
15808f5
remove xcm-emulator-testing feature
muharem Dec 22, 2023
b641048
remove debug code
muharem Dec 22, 2023
8c6a82e
merge master
joepetrowski Dec 22, 2023
6508782
fix build
joepetrowski Dec 22, 2023
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
219 changes: 219 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ members = [
"cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-rococo",
"cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-westend",
"cumulus/parachains/integration-tests/emulated/chains/parachains/collectives/collectives-westend",
"cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-rococo",
"cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-westend",
"cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal",
"cumulus/parachains/integration-tests/emulated/chains/relays/rococo",
"cumulus/parachains/integration-tests/emulated/chains/relays/westend",
Expand All @@ -78,6 +80,8 @@ members = [
"cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend",
"cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo",
"cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend",
"cumulus/parachains/integration-tests/emulated/tests/people/people-rococo",
"cumulus/parachains/integration-tests/emulated/tests/people/people-westend",
"cumulus/parachains/pallets/collective-content",
"cumulus/parachains/pallets/parachain-info",
"cumulus/parachains/pallets/ping",
Expand All @@ -93,6 +97,8 @@ members = [
"cumulus/parachains/runtimes/coretime/coretime-rococo",
"cumulus/parachains/runtimes/coretime/coretime-westend",
"cumulus/parachains/runtimes/glutton/glutton-westend",
"cumulus/parachains/runtimes/people/people-rococo",
"cumulus/parachains/runtimes/people/people-westend",
"cumulus/parachains/runtimes/starters/seedling",
"cumulus/parachains/runtimes/starters/shell",
"cumulus/parachains/runtimes/test-utils",
Expand Down
82 changes: 82 additions & 0 deletions cumulus/parachains/chain-specs/people-rococo.json

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions cumulus/parachains/chain-specs/people-westend.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions cumulus/parachains/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ sp-runtime = { path = "../../../substrate/primitives/runtime", default-features
sp-std = { path = "../../../substrate/primitives/std", default-features = false }

# Polkadot
pallet-xcm = { path = "../../../polkadot/xcm/pallet-xcm", default-features = false }
rococo-runtime-constants = { path = "../../../polkadot/runtime/rococo/constants", default-features = false }
westend-runtime-constants = { path = "../../../polkadot/runtime/westend/constants", default-features = false }
polkadot-core-primitives = { path = "../../../polkadot/core-primitives", default-features = false }
Expand Down Expand Up @@ -70,6 +71,7 @@ std = [
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-message-queue/std",
"pallet-xcm/std",
"parachain-info/std",
"polkadot-core-primitives/std",
"polkadot-primitives/std",
Expand All @@ -95,6 +97,7 @@ runtime-benchmarks = [
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
Expand Down
57 changes: 54 additions & 3 deletions cumulus/parachains/common/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@

use frame_support::traits::{
fungibles::{self, Balanced, Credit},
Contains, ContainsPair, Currency, Get, Imbalance, OnUnbalanced,
Contains, ContainsPair, Currency, Get, Imbalance, OnUnbalanced, OriginTrait,
};
use pallet_asset_tx_payment::HandleCredit;
use sp_runtime::traits::Zero;
use sp_std::marker::PhantomData;
use xcm::latest::{AssetId, Fungibility::Fungible, MultiAsset, MultiLocation};
use sp_std::{marker::PhantomData, prelude::*};
use xcm::latest::{
AssetId, Fungibility, Fungibility::Fungible, Junction, MultiAsset, MultiLocation, Parent,
};

/// Type alias to conveniently refer to the `Currency::NegativeImbalance` associated type.
pub type NegativeImbalance<T> = <pallet_balances::Pallet<T> as Currency<
Expand Down Expand Up @@ -118,6 +120,55 @@ impl<T: Get<MultiLocation>> ContainsPair<MultiAsset, MultiLocation> for AssetsFr
}
}

/// Type alias to conveniently refer to the `Currency::Balance` associated type.
pub type BalanceOf<T> =
<pallet_balances::Pallet<T> as Currency<<T as frame_system::Config>::AccountId>>::Balance;

/// Implements `OnUnbalanced::on_unbalanced` to teleport slashed assets to relay chain treasury
/// account.
pub struct ToParentTreasury<TreasuryAccount, PalletAccount, T>(
PhantomData<(TreasuryAccount, PalletAccount, T)>,
);

impl<TreasuryAccount, PalletAccount, T> OnUnbalanced<NegativeImbalance<T>>
for ToParentTreasury<TreasuryAccount, PalletAccount, T>
where
T: pallet_balances::Config + pallet_xcm::Config + frame_system::Config,
<<T as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId: From<AccountIdOf<T>>,
[u8; 32]: From<<T as frame_system::Config>::AccountId>,
TreasuryAccount: Get<AccountIdOf<T>>,
PalletAccount: Get<AccountIdOf<T>>,
BalanceOf<T>: Into<Fungibility>,
{
fn on_unbalanced(amount: NegativeImbalance<T>) {
let amount = match amount.drop_zero() {
Ok(..) => return,
Err(amount) => amount,
};
let imbalance = amount.peek();
let pallet_acc: AccountIdOf<T> = PalletAccount::get();
let treasury_acc: AccountIdOf<T> = TreasuryAccount::get();

<pallet_balances::Pallet<T>>::resolve_creating(&pallet_acc, amount);

let result = <pallet_xcm::Pallet<T>>::teleport_assets(
<<T as frame_system::Config>::RuntimeOrigin>::signed(pallet_acc.into()),
joepetrowski marked this conversation as resolved.
Show resolved Hide resolved
Box::new(Parent.into()),
Box::new(
Junction::AccountId32 { network: None, id: treasury_acc.into() }
.into_location()
.into(),
),
Box::new((Parent, imbalance).into()),
0,
);

if let Err(err) = result {
log::warn!("Failed to teleport slashed assets: {:?}", err);
}
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
Loading