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

Add more integrations tests to People chains #499

Conversation

rockbmb
Copy link
Contributor

@rockbmb rockbmb commented Nov 4, 2024

https://github.com/open-web3-stack/polkadot-ecosystem-tests relies on chopsticks to create E2E tests using periodically (roughly daily) obtained runtimes from production relay chains/system parachains.

In particular, open-web3-stack/polkadot-ecosystem-tests#63 does this for the People chains.
In writing those tests, I was unable to use XCM to test pallet_identity::{kill_identity/add_username_authority/remove_username_authority}.
I wrote this PR to replicate those tests at this layer, whose passing status falsify the hypothesis that there may have been an issue with the runtimes, and confirm that it was a problem with the way I wrote those tests.

  • Does not require a CHANGELOG entry

@rockbmb rockbmb changed the title Add Add more integrations tests to People chains Nov 4, 2024
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.

Tests look good! 👍

Please add the same to https://github.com/paritytech/polkadot-sdk/tree/master/cumulus/parachains/integration-tests/emulated/tests/people to keep the covered functionality in sync.

@rockbmb
Copy link
Contributor Author

rockbmb commented Nov 5, 2024

@acatangiu certainly.

Thanks for the review!

@bkchr
Copy link
Contributor

bkchr commented Nov 5, 2024

In writing those tests, I was unable to use XCM to test pallet_identity::{kill_identity/add_username_authority/remove_username_authority}.

Why?

@rockbmb rockbmb force-pushed the pallet-identity-root-extrinsics branch from fec09e0 to a780f51 Compare November 7, 2024 14:28
@github-actions github-actions bot requested a review from acatangiu November 7, 2024 14:30
Copy link

github-actions bot commented Nov 7, 2024

Review required! Latest push from author must always be reviewed

1 similar comment
Copy link

github-actions bot commented Nov 7, 2024

Review required! Latest push from author must always be reviewed

@rockbmb
Copy link
Contributor Author

rockbmb commented Nov 12, 2024

In writing those tests, I was unable to use XCM to test pallet_identity::{kill_identity/add_username_authority/remove_username_authority}.

Why?

To test the following example, you'll need to:

  1. have https://github.com/AcalaNetwork/chopsticks available locally
  2. create a local network with a relay chain and people parachain:
cd chopsticks
npx @acala-network/chopsticks@latest xcm -r configs/polkadot.yml -p configs/polkadot-people.yml
  1. Open each of them in PJS

Consider the following encoded call: 0x630004000100b10f040406020700aea68f0282841e008c320a0078a302c5370300ab2bd8a65469a5061220cd07b3b3a17e5e3233d283e2ad46f0.

  1. Decoding it from the relay chain, you'll see it consists of a V4 XCM with a Transact instruction, to be sent to the people chain with a SuperUser origin, containing the encoded call: 0x320a0078a302c5370300ab2bd8a65469a5061220cd07b3b3a17e5e3233d283e2ad46f0.
  2. If you were to subsequently decode this in the people chain's tab, you would see a pallet_identity::kill_identity call on 13jBAtYJar4xujPaEx41FxjSt9PqU7LqJRbySJiVdMtuWN42, which is my DOT address. There should be an associated identity.

Now either

  1. sign and send it using the Alice development account, or
  2. Paste and run this in the relay chain's JavaScript tab:
const call = '0x630004000100b10f040406020700aea68f0282841e008c320a0078a302c5370300ab2bd8a65469a5061220cd07b3b3a17e5e3233d283e2ad46f0'

const number = (await api.rpc.chain.getHeader()).number.toNumber()

await api.rpc('dev_setStorage', {
  scheduler: {
    agenda: [
      [
        [number + 1], [
          {
            call: {
              Inline: call
            },
            origin: {
              system: 'Root'
            }
          }
        ]
      ]
    ]
  }
})
// Make a block to include the extrinsic
await api.rpc('dev_newBlock', { count: 1 })

In either instance, you will find, in the people chain's "recent events" list, messageQueue.ProcessingFailed.

@bkchr in conclusion, and to answer your question: I don't know why this happens, but I suspect it shouldn't.
The above process is exactly how I tested add_registrar in open-web3-stack/polkadot-ecosystem-tests#63, and it worked then.

I've been working to understand why, and this PR, as well as paritytech/polkadot-sdk#6377 (comment) are how.

@rockbmb
Copy link
Contributor Author

rockbmb commented Nov 12, 2024

@seadanda also, apologies for the delay: the above comment contains the snippet I mentioned in DMs.

My identity should exist when you fork the chain.

@github-actions github-actions bot requested a review from acatangiu November 19, 2024 13:47
github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this pull request Nov 27, 2024
# Description

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

## Integration

N/A

## Review Notes

N/A

---------

Co-authored-by: Dónal Murray <[email protected]>
@rockbmb
Copy link
Contributor Author

rockbmb commented Nov 29, 2024

Like I said in paritytech/polkadot-sdk#6377 (comment), knowing the reason for the differential failures in the wrong origin tests does not impact their immediate usefulness, so this can be merged, and that matter considered in another issue/PR.

@github-actions github-actions bot requested a review from acatangiu November 29, 2024 17:44
github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this pull request Nov 29, 2024
# Description

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

## Integration

N/A

## Review Notes

N/A

---------

Co-authored-by: Dónal Murray <[email protected]>
@fellowship-merge-bot
Copy link
Contributor

There was a problem running the action.

❌😵❌

Please find more information in the logs.

github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this pull request Nov 29, 2024
# Description

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

## Integration

N/A

## Review Notes

N/A

---------

Co-authored-by: Dónal Murray <[email protected]>
Comment on lines 481 to 483
// I mistakenly assumed that to test the removal of an authority would need one to exist.
// However, since the origin check is the very first extrinsic in `remove_username_authority`,
// an authority need not exist to test the safety of the origin check.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// I mistakenly assumed that to test the removal of an authority would need one to exist.
// However, since the origin check is the very first extrinsic in `remove_username_authority`,
// an authority need not exist to test the safety of the origin check.
// Since the origin check is the very first extrinsic in `remove_username_authority`, an
// authority need not exist to test the safety of the origin check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The dreaded first-person slip. Thanks for noticing.

UnpaidExecution { weight_limit: Unlimited, check_origin: None },
Transact {
origin_kind,
// Making the weight's ref time any lower will prevent the XCM from triggering
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be removed when we update to XCM v5 in this repo

);
});

// Now, remove the username authority with another priviledged XCM call.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Now, remove the username authority with another priviledged XCM call.
// Now, remove the username authority with another privileged XCM call.

);
});

// Now, remove the username authority with another priviledged XCM call.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Now, remove the username authority with another priviledged XCM call.
// Now, remove the username authority with another privileged XCM call.

@rockbmb
Copy link
Contributor Author

rockbmb commented Dec 12, 2024

/merge

@fellowship-merge-bot
Copy link
Contributor

Enabled auto-merge in Pull Request

Available commands
  • /merge: Enables auto-merge for Pull Request
  • /merge cancel: Cancels auto-merge for Pull Request
  • /merge help: Shows this menu

For more information see the documentation

@fellowship-merge-bot fellowship-merge-bot bot enabled auto-merge (squash) December 12, 2024 21:05
@fellowship-merge-bot fellowship-merge-bot bot merged commit 46dcafc into polkadot-fellows:main Dec 13, 2024
47 of 48 checks passed
@rockbmb rockbmb deleted the pallet-identity-root-extrinsics branch December 13, 2024 12:34
Krayt78 pushed a commit to Krayt78/polkadot-sdk that referenced this pull request Dec 18, 2024
# Description

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

## Integration

N/A

## Review Notes

N/A

---------

Co-authored-by: Dónal Murray <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants