Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into oty-fix-clippy-nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
ggwpez committed May 15, 2024
2 parents f521c64 + d63ed88 commit 70b7e91
Show file tree
Hide file tree
Showing 26 changed files with 204 additions and 1,120 deletions.
43 changes: 42 additions & 1 deletion .github/workflows/review-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,58 @@ on:

jobs:
trigger-review-bot:
# (It is not a draft) && (it is not a review || it is an approving review)
if: ${{ github.event.pull_request.draft != true && (github.event_name != 'pull_request_review' || (github.event.review && github.event.review.state == 'APPROVED')) }}
runs-on: ubuntu-latest
name: trigger review bot
steps:
- name: Get PR data
id: comments
run: |
echo "bodies=$(gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --json comments --jq '[.comments[].body]')" >> "$GITHUB_OUTPUT"
echo "reviews=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews --jq '[.[].state]')" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
- name: Get the GitHub handle of the fellows
uses: paritytech/[email protected]
id: fellows
# Require new reviews when the author is pushing and he is not a fellow
- name: Fail when author pushes new code
# if (contains approved reviews && it's a synchronize event && was triggered by the author (who is not a fellow))
if: |
contains(fromJson(steps.comments.outputs.reviews), 'APPROVED') &&
github.event_name == 'pull_request_target' &&
github.event.action == 'synchronize' &&
github.event.sender.login == github.event.pull_request.user.login &&
contains(steps.fellows.outputs.github-handles, github.event.pull_request.user.login)
run: |
# We get the list of reviewers who approved the PR
REVIEWERS=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \
--jq '{reviewers: [.[] | select(.state == "APPROVED") | .user.login]}')
# We request them to review again
echo $REVIEWERS | gh api --method POST repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers --input -
echo "::error::Project needs to be reviewed again"
exit 1
env:
GH_TOKEN: ${{ github.token }}
- name: Comment requirements
# If the previous step failed and github-actions hasn't commented yet we comment instructions
if: failure() && !contains(fromJson(steps.comments.outputs.bodies), 'Review required! Latest push from author must always be reviewed')
run: |
gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "Review required! Latest push from author must always be reviewed"
env:
GH_TOKEN: ${{ github.token }}
COMMENTS: ${{ steps.comments.outputs.users }}
- name: Get PR number
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
echo "Saving PR number: $PR_NUMBER"
mkdir -p ./pr
echo $PR_NUMBER > ./pr/pr_number
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
name: Save PR number
with:
name: pr_number
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
shared-key: "fellowship-cache-tests"

- name: Test ${{ matrix.runtime.name }}
run: cargo test -p ${{ matrix.runtime.package }} --release --locked -q --features=try-runtime
run: cargo test -p ${{ matrix.runtime.package }} --release --locked -q
env:
RUSTFLAGS: "-C debug-assertions -D warnings"

Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/up-to-date.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- main
workflow_run:
workflows: [Auto Merge Bot]
types: [completed]

jobs:
updatePullRequests:
Expand All @@ -13,11 +16,11 @@ jobs:
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v1
uses: actions/create-github-app-token@v1.9.3
with:
app_id: ${{ secrets.MERGE_APP_ID }}
private_key: ${{ secrets.MERGE_APP_KEY }}
app-id: ${{ secrets.MERGE_APP_ID }}
private-key: ${{ secrets.MERGE_APP_KEY }}
- name: Update all the PRs
uses: paritytech/[email protected].0
uses: paritytech/[email protected].1
with:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Changed

- Kusama chains: allow arbitrary XCM execution ([polkadot-fellows/runtimes#261](https://github.com/polkadot-fellows/runtimes/pull/261))
- Allow everything through XCM SafeCallFilter ([polkadot-fellows/runtimes#285](https://github.com/polkadot-fellows/runtimes/pull/285))

### Added

- Add `pallet-vesting` to Asset Hubs ([polkadot-fellows/runtimes#269](https://github.com/polkadot-fellows/runtimes/pull/269))
- Add Pay Salary Collectives test ([polkadot-fellows/runtimes#260](https://github.com/polkadot-fellows/runtimes/pull/260))

### Removed

- Remove one-shot migrations from Kusama Coretime ([polkadot-fellows/runtimes#300](https://github.com/polkadot-fellows/runtimes/pull/300))
- Remove DMP queue and allow `system::authorize_upgrade` in XCM's call filter ([polkadot-fellows/runtimes#280](https://github.com/polkadot-fellows/runtimes/pull/280))

### Fixed

- Include patch to release stuck collator bonds ([polkadot-fellows/runtimes#289](https://github.com/polkadot-fellows/runtimes/pull/289))
- Safeguard pallet-balances against consumer ref underflow ([polkadot-fellows/runtimes#309](https://github.com/polkadot-fellows/runtimes/pull/309))

## [1.2.3] 29.04.2024

### Added
Expand Down
11 changes: 7 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pallet-bridge-parachains = { version = "0.8.0", default-features = false }
pallet-bridge-relayers = { version = "0.8.0", default-features = false }
pallet-broker = { version = "0.7.1", default-features = false }
pallet-child-bounties = { version = "28.0.0", default-features = false }
pallet-collator-selection = { version = "10.0.0", default-features = false }
pallet-collator-selection = { version = "10.0.2", default-features = false }
pallet-collective = { version = "29.0.0", default-features = false }
pallet-conviction-voting = { version = "29.0.0", default-features = false }
pallet-core-fellowship = { version = "13.0.0", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ codec = { package = "parity-scale-codec", version = "3.6.9" }
assert_matches = { workspace = true }

# Substrate
sp-core ={ workspace = true, default-features = true }
sp-runtime = { workspace = true, default-features = true }
frame-support = { workspace = true, default-features = true }
pallet-balances = { workspace = true, default-features = true }
Expand All @@ -37,6 +38,7 @@ cumulus-pallet-parachain-system = { features = ["parameterized-consensus-hook"],
# Local
asset-hub-polkadot-runtime = { path = "../../../../../system-parachains/asset-hubs/asset-hub-polkadot" }
collectives-polkadot-runtime = { path = "../../../../../system-parachains/collectives/collectives-polkadot" }
collectives-polkadot-runtime-constants = { path = "../../../../../system-parachains/collectives/collectives-polkadot/constants" }
integration-tests-helpers = { path = "../../../helpers" }
polkadot-runtime = { path = "../../../../../relay/polkadot" }
polkadot-runtime-constants = { path = "../../../../../relay/polkadot/constants" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
pub use xcm::{prelude::*, v3};

// Cumulus
pub use emulated_integration_tests_common::xcm_emulator::{
assert_expected_events, bx, Chain, RelayChain as Relay, TestExt,
pub use emulated_integration_tests_common::{
accounts::ALICE,
xcm_emulator::{assert_expected_events, bx, Chain, Parachain, RelayChain as Relay, TestExt},
};
pub use polkadot_system_emulated_network::{
asset_hub_polkadot_emulated_chain::AssetHubPolkadotParaPallet as AssetHubPolkadotPallet,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// 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.

use crate::*;
use asset_hub_polkadot_runtime::xcm_config::LocationToAccountId;
use collectives_polkadot_runtime::fellowship::FellowshipSalaryPaymaster;
use frame_support::{
assert_ok,
traits::{
fungibles::{Create, Mutate},
tokens::Pay,
},
};
use xcm_executor::traits::ConvertLocation;

const FELLOWSHIP_SALARY_PALLET_ID: u8 =
collectives_polkadot_runtime_constants::FELLOWSHIP_SALARY_PALLET_INDEX;

#[test]
fn pay_salary() {
let asset_id: u32 = 1984;
let fellowship_salary = (
Parent,
Parachain(CollectivesPolkadot::para_id().into()),
PalletInstance(FELLOWSHIP_SALARY_PALLET_ID),
);
let pay_from = LocationToAccountId::convert_location(&fellowship_salary.into()).unwrap();
let pay_to = Polkadot::account_id_of(ALICE);
let pay_amount = 9000;

AssetHubPolkadot::execute_with(|| {
type AssetHubAssets = <AssetHubPolkadot as AssetHubPolkadotPallet>::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));
});

CollectivesPolkadot::execute_with(|| {
type RuntimeEvent = <CollectivesPolkadot as Chain>::RuntimeEvent;

assert_ok!(FellowshipSalaryPaymaster::pay(&pay_to, (), pay_amount));
assert_expected_events!(
CollectivesPolkadot,
vec![
RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) => {},
]
);
});

AssetHubPolkadot::execute_with(|| {
type RuntimeEvent = <AssetHubPolkadot as Chain>::RuntimeEvent;
assert_expected_events!(
AssetHubPolkadot,
vec![
RuntimeEvent::Assets(pallet_assets::Event::Transferred { .. }) => {},
RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: true ,.. }) => {},
]
);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
// See the License for the specific language governing permissions and
// limitations under the License.

mod fellowship_salary;
mod fellowship_treasury;
1 change: 1 addition & 0 deletions system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ parameter_types! {
/// Migrations to apply on runtime upgrade.
pub type Migrations = (
frame_support::migrations::RemovePallet<DmpQueueName, RocksDbWeight>,
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
// permanent
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
);
Expand Down
Loading

0 comments on commit 70b7e91

Please sign in to comment.