-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Westend governance authorize_upgrade integration tests #8787
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
68f4dc2
Westend governance integration tests
karolk91 a58654f
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] 5a8f815
Update pr_8787.prdoc
karolk91 32ed621
Add missing file
karolk91 1a2b020
Merge branch 'master' into kk-westend-gov-tests
karolk91 4746923
Update pr_8787.prdoc
karolk91 4746bfd
Merge branch 'master' into kk-westend-gov-tests
karolk91 0c40981
Merge remote-tracking branch 'origin/master' into kk-westend-gov-tests
karolk91 265771c
Introduce assert_whitelisted macro
karolk91 46f4c1e
remove pallet-preimage dep
karolk91 b95bfdc
Merge branch 'master' into kk-westend-gov-tests
karolk91 86e81e1
pub getter for CodeUpgradeAuthorization gated for testing/benchmarks
karolk91 6e8f188
improve other occurences of authorized_upgrade().is_some()
karolk91 d4a3ebb
Merge branch 'master' into kk-westend-gov-tests
karolk91 b3a89f0
Apply suggestions from code review
karolk91 ba3334a
Merge branch 'master' into kk-westend-gov-tests
karolk91 e8ec368
rename whitelist_call -> send_whitelist_call
karolk91 c1bc35a
Merge remote-tracking branch 'origin/master' into kk-westend-gov-tests
karolk91 64ba936
Set fallback_max_weight to None
karolk91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
32 changes: 32 additions & 0 deletions
32
cumulus/parachains/integration-tests/emulated/tests/governance/westend/Cargo.toml
This file contains hidden or 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,32 @@ | ||
| [package] | ||
| name = "governance-westend-integration-tests" | ||
| version = "0.0.0" | ||
| authors.workspace = true | ||
| edition.workspace = true | ||
| license = "Apache-2.0" | ||
| description = "Westend governance integration tests with xcm-emulator" | ||
| publish = false | ||
|
|
||
| [lints] | ||
| workspace = true | ||
|
|
||
| [dependencies] | ||
| codec = { workspace = true, default-features = true } | ||
|
|
||
| # Substrate | ||
| frame-support = { workspace = true, default-features = true } | ||
| frame-system = { workspace = true, default-features = true } | ||
| pallet-utility = { workspace = true, default-features = true } | ||
| pallet-whitelist = { workspace = true, default-features = true } | ||
| sp-core = { workspace = true, default-features = true } | ||
| sp-runtime = { workspace = true, default-features = true } | ||
|
|
||
| pallet-xcm = { workspace = true, default-features = true } | ||
| xcm = { workspace = true, default-features = true } | ||
|
|
||
| emulated-integration-tests-common = { workspace = true } | ||
|
|
||
| # Local | ||
| collectives-westend-runtime = { workspace = true } | ||
| westend-runtime = { workspace = true } | ||
| westend-system-emulated-network = { workspace = true } |
54 changes: 54 additions & 0 deletions
54
cumulus/parachains/integration-tests/emulated/tests/governance/westend/src/common.rs
This file contains hidden or 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,54 @@ | ||
| // Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md | ||
| // for a list of specific contributors. | ||
| // 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::imports::*; | ||
|
|
||
| /// CollectivesWestend dispatches `pallet_xcm::send` with `OriginKind:Xcm` to the dest with encoded | ||
| /// whitelist call. | ||
| #[cfg(test)] | ||
| pub fn collectives_send_whitelist( | ||
| dest: Location, | ||
| encoded_whitelist_call: impl FnOnce() -> Vec<u8>, | ||
| ) { | ||
| CollectivesWestend::execute_with(|| { | ||
| type RuntimeEvent = <CollectivesWestend as Chain>::RuntimeEvent; | ||
| type RuntimeCall = <CollectivesWestend as Chain>::RuntimeCall; | ||
| type RuntimeOrigin = <CollectivesWestend as Chain>::RuntimeOrigin; | ||
| type Runtime = <CollectivesWestend as Chain>::Runtime; | ||
|
|
||
| let send_whitelist_call = RuntimeCall::PolkadotXcm(pallet_xcm::Call::<Runtime>::send { | ||
| dest: bx!(VersionedLocation::from(dest)), | ||
| message: bx!(VersionedXcm::from(Xcm(vec![ | ||
| UnpaidExecution { weight_limit: Unlimited, check_origin: None }, | ||
| Transact { | ||
| origin_kind: OriginKind::Xcm, | ||
| fallback_max_weight: None, | ||
| call: encoded_whitelist_call().into(), | ||
| } | ||
| ]))), | ||
| }); | ||
|
|
||
| use collectives_westend_runtime::fellowship::pallet_fellowship_origins::Origin::Fellows as FellowsOrigin; | ||
| let fellows_origin: RuntimeOrigin = FellowsOrigin.into(); | ||
| assert_ok!(send_whitelist_call.dispatch(fellows_origin)); | ||
| assert_expected_events!( | ||
| CollectivesWestend, | ||
| vec![ | ||
| RuntimeEvent::PolkadotXcm(pallet_xcm::Event::Sent { .. }) => {}, | ||
| ] | ||
| ); | ||
| }); | ||
| } |
33 changes: 33 additions & 0 deletions
33
cumulus/parachains/integration-tests/emulated/tests/governance/westend/src/lib.rs
This file contains hidden or 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,33 @@ | ||
| // Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md | ||
| // for a list of specific contributors. | ||
| // 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. | ||
|
|
||
| #[cfg(test)] | ||
| mod imports { | ||
| pub(crate) use emulated_integration_tests_common::{ | ||
| impls::{assert_expected_events, bx, TestExt}, | ||
| xcm_emulator::Chain, | ||
| }; | ||
| pub(crate) use frame_support::assert_ok; | ||
| pub(crate) use sp_runtime::traits::Dispatchable; | ||
| pub(crate) use westend_system_emulated_network::CollectivesWestendPara as CollectivesWestend; | ||
| pub(crate) use xcm::{latest::prelude::*, VersionedLocation, VersionedXcm}; | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod common; | ||
|
|
||
| #[cfg(test)] | ||
| mod open_gov_on_relay; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karolk91 I think it should be ready and okay, but please double-check and confirm that all the newly added common components will work without any changes for the
open_gov_on_asset_hub.rstests (to avoid any backports later).(Other words, when we merge this, we will just add tests for AHM cfg setup.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean AHM tests on Westend or Polkadot/Kusama ?
I will port/sync these changes right away to both when we merge this, or I can modify PRs above before we merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karolk91 I am thinking about extracting all these changes for
integration-tests/emulated/commonto the separate PR on master and when merged, just backport it to stable2503 / stable2506 - because it is a new stuff, so after the next patch-release we can use them directly in fellows, we don't need to wait for master stable releaseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry @bkontur , maybe I misunderstood something - this PR here is targeting
master. We can add backport labels since these are only minor and patchThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, sorry, sorry, my bad, I though it is PR to some ahm branch :D,
no need to do anything :)