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

People chain integration tests #6377

Merged
merged 20 commits into from
Nov 29, 2024
Merged

People chain integration tests #6377

merged 20 commits into from
Nov 29, 2024

Conversation

rockbmb
Copy link
Contributor

@rockbmb rockbmb commented Nov 6, 2024

Description

Made as a follow-up of polkadot-fellows/runtimes#499

Integration

N/A

Review Notes

N/A

@rockbmb rockbmb added R0-silent Changes should not be mentioned in any release notes T10-tests This PR/Issue is related to tests. T14-system_parachains This PR/Issue is related to system parachains. labels Nov 6, 2024
@rockbmb rockbmb self-assigned this Nov 6, 2024
@rockbmb rockbmb marked this pull request as ready for review November 6, 2024 14:14
@rockbmb rockbmb requested a review from acatangiu November 6, 2024 14:14
In Westend, `type UsernameAuthorityOrigin = EnsureRoot<Self::AccountId>;`,
so `add_username_authority/remove_username_authority` should fail
with regular signed and general admin origins.
Copy link
Contributor

@acatangiu acatangiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New tests look good, fyi need fixing issues after merging master (adapt for XCMv5) to get CI green.

@rockbmb rockbmb force-pushed the people-chain-integration-tests branch from 3308e96 to 12d8979 Compare November 11, 2024 15:20
@rockbmb
Copy link
Contributor Author

rockbmb commented Nov 12, 2024

@acatangiu thank you for the the feedback.

Before I put this in the merge queue, there's something I would like to understand.
Consider the governance::*_wrong_origin tests I added in this PR (which I also introduced to polkadot-fellows/runtimes#499).

At present,

  • The Polkadot and Kusama runtimes define RegistrarOrigin,ForceOrigin.UsernameAuthorityOrigin as
EitherOfDiverse<
	EnsureRoot<AccountId>,
	EnsureXcm<IsVoiceOfBody<GovernanceLocation, GeneralAdminBodyId>>,
>;

so an incorrect origin check can consist of just checking a SignedOrigin.

  • In the Rococo/Westend runtimes, those origins only include EnsureRoot<AccountId>, so the incorrect origin tests try GeneralAdmin and verify that extrinsics fail execution (e.g. see impl pallet_identity::Config for Westend's Runtime here.

The wrong origin tests that I added are: relay_commands_{add_registrar, kill_identity, add_remove_username_authority}_wrong_origin.
As expected, using a signed or general admin origin with those extrinsics fails, but how they fail differs based on:

  1. the network (Rococo vs. Westend),
  2. the extrinsic, and
  3. the origin

For Rococo:

Origin / Extrinsic add_registrar kill_identity {add, remove}_username_authority
Signed origin xcm.dispatch(origin).is_ok(), no parachain events xcm.dispatch(origin).is_ok(), no parachain events xcm.dispatch(origin).is_ok(), no parachain events
General admin origin xcm.dispatch(origin).is_err(), no parachain events xcm.dispatch(origin).is_err(), no parachain events xcm.dispatch(origin).is_err(), no parachain events

For Westend:

Origin / Extrinsic add_registrar kill_identity {add, remove}_username_authority
Signed origin Event::ProcessingFailed No parachain events No parachain events
General admin origin Event::Processed No parachain events No parachain events

Why is this the case? Before these tests, I would have hypothesized that when submitting an extrinsic with an insufficient origin, the mode of failure was to be the same, regardless of extrinsic, network, or origin.

@acatangiu
Copy link
Contributor

I only read diagonally, but first thing you should check is rococo/westend configs. Usually when they are different from prod networks they are simply outdated.

EitherOfDiverse<
EnsureRoot,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, GeneralAdminBodyId>>,

;

Looks right to me, check git blame for the Westend and rococo configs and you can figure out if they are different intentionally (some new feature added not yet reached prod networks), or if they are simply outdated.

Also, Rococo is deprecated/retired. It’s not deployed anywhere anymore. We still keep the code around for bridge emulated tests and zombienet tests, but everything else is deprecated. Aka, no need to add new governance tests on Rococo.

@rockbmb
Copy link
Contributor Author

rockbmb commented Nov 12, 2024

@acatangiu

Thank you for the reply!

Even before writing my previous comment, I had checked configs; you're correct that Kusama/Polkadot configs became different from Westend/Rococo.

My wall of text obscured the core of my question:

  1. some extrinsics on Westend require a root origin.
  2. when executing them from either a general admin origin or a signed origin, they fail, as expected
  3. however, the way in which each origin fails is different - unlike expected.

The origins being defined differently between networks is relevant - but a separate issue.
What I'm trying to understand is why each of the unallowed origins fails differently.

@acatangiu
Copy link
Contributor

  1. however, the way in which each origin fails is different - unlike expected.

The origins being defined differently between networks is relevant - but a separate issue. What I'm trying to understand is why each of the unallowed origins fails differently.

can you provide more details? how do they fail differently? what are the tracing logs saying?

I am guessing there are different validation functions (per origin type) that are failing, but we'd need to follow the code to figure out exactly - either way, I don't think this is a problem

@rockbmb
Copy link
Contributor Author

rockbmb commented Nov 26, 2024

@acatangiu Thanks for the feedback.

This PR fulfills its purpose and the underlying reason for the behavior I described is not problematic, just curious IMO; as you said:

either way, I don't think this is a problem

This can be looked into in a separate issue/PR. I'll merge this (with another approval).

@seadanda seadanda enabled auto-merge November 27, 2024 21:54
@seadanda seadanda added this pull request to the merge queue Nov 27, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 27, 2024
@seadanda seadanda enabled auto-merge November 29, 2024 15:27
@seadanda seadanda added this pull request to the merge queue Nov 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 29, 2024
@rockbmb rockbmb added this pull request to the merge queue Nov 29, 2024
Merged via the queue into master with commit 5ad8780 Nov 29, 2024
194 of 198 checks passed
@rockbmb rockbmb deleted the people-chain-integration-tests branch November 29, 2024 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T10-tests This PR/Issue is related to tests. T14-system_parachains This PR/Issue is related to system parachains.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants