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

Collectives tests: Teleports and Whitelist Call #251

Merged

Conversation

muharem
Copy link
Contributor

@muharem muharem commented Mar 21, 2024

Introduce teleport and whitelist call tests for Polkadot Collectives.

Based on #233

  • Does not require a CHANGELOG entry

@@ -123,6 +123,184 @@ macro_rules! test_parachain_is_trusted_teleporter {
};
}

#[macro_export]
macro_rules! test_relay_is_trusted_teleporter {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the analogy with test_parachain_is_trusted_teleporter macro from above.
There are two different ways now to test teleports, using the macro from above and using xcm-emulator::Test. I find the macro option more clear and easy to read compered to the Test.
I propose to rename the existing test_parachain_is_trusted_teleporter to test_sibling_is_trusted_teleporter, and have two additional test_relay_is_trusted_teleporter and test_parachain_is_trusted_teleporter

Copy link
Contributor

@bkontur bkontur Mar 22, 2024

Choose a reason for hiding this comment

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

Actually, iirc, the plan is/was to remove this crate from the fellows and re-use macros from polkadot-sdk to avoid unnecessary duplications.
I don't remember exactly what was missing in 1.7.0, but @acatangiu just temporary added it here.
See the comment https://github.com/polkadot-fellows/runtimes/pull/251/files#diff-7346706278168c97dfec9e73bec1a115274a2be89a3147b914dd2eedec9f6269R31-R32,

/// TODO: when bumping to polkadot-sdk v1.8.0,
/// remove this crate altogether and get the macros from `emulated-integration-tests-common`.

also I can see test_chain_can_claim_assets was added here also... @franciscoaguirre Cisco, do we need/want to move it to polkadot-sdk and setup those tests there or maybe do we have an issue for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

From what I see, test_parachain_is_trusted_teleporter and test_sibling_is_trusted_teleporter do almost exactly the same. Besides multi-receiver support, the only significant difference I can see is just asset construction: let assets: Assets = (Parent, $amount).into();. I like your multi-receiver support and assets as input parameters, it makes it much more generic.

So, I would vote here for keeping just one macro (temporarily, one nice generic macro here and port it asynchronously to polkadot-sdk for later removal from fellows) with multi-receiver support + the possibility to set assets as input parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree. But until we have it in polkadot-sdk we can keep this, and remove when we have macro to replace it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, so at least TODO+issue maybe?
Well, I suggest to pimp that macro to its final version here, and then backport it to polkadot-sdk. This way, when bumping with polkadot-sdk later, we'll only need to just change imports without causing much disruption. However, please feel free to disregard this suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried and I do not like the result. I have to remove some event asserts and leave only the ones which relevant for all cases. Also I have to pass some argument and resolve the xcm pallet's name from it, because they are different on Relay and Paras. Probably it can be still improved, but I think it's good enough for now. Having separate macro also leaves some flexibility for later changes.

@joepetrowski joepetrowski mentioned this pull request Apr 25, 2024
10 tasks
@github-actions github-actions bot requested a review from joepetrowski May 15, 2024 09:08
Copy link

Review required! Latest push from author must always be reviewed

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
use frame_support::{assert_ok, sp_runtime::traits::Dispatchable};

#[test]
fn fellows_whitelist_call() {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice! 👍

@acatangiu
Copy link
Contributor

needs a clippy fix and a CHANGELOG entry and is good to go

@joepetrowski
Copy link
Contributor

/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) May 17, 2024 12:44
@fellowship-merge-bot fellowship-merge-bot bot merged commit c2886b9 into polkadot-fellows:main May 17, 2024
36 checks passed
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