-
Notifications
You must be signed in to change notification settings - Fork 648
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
Added foreign locations to local accounts converter to all the parachains #5765
base: master
Are you sure you want to change the base?
Conversation
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.
Request changes
Do not remove existing converters to maintain backwards compatibility (see following comments)
Testing
For each chain/runtime, please add unit tests (faster/easier than emulated tests) that cover the newly supported conversions.
E.g. you can add new test for asset-hub-westend here, then run it with cargo test -r -p asset-hub-westend-runtime
. Do the same for other runtimes too.
In terms of how to test, very easy way is using LocationToAccountHelper::convert_location()` and pass it locations that use to fail conversion, but with your change now succeed.
You can see an example of how to call LocationToAccountHelper
here.
cumulus/parachains/runtimes/people/people-rococo/src/xcm_config.rs
Outdated
Show resolved
Hide resolved
cumulus/parachains/runtimes/people/people-westend/src/xcm_config.rs
Outdated
Show resolved
Hide resolved
cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs
Show resolved
Hide resolved
cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs
Outdated
Show resolved
Hide resolved
bot fmt |
Review required! Latest push from author must always be reviewed |
…xcm_config.rs Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Added the tests. Additionally removed my change and made sure that the tests fail. |
let alice_on_bh = Location::new( | ||
1, | ||
[ | ||
Parachain(1111), | ||
Junction::AccountId32 { network: None, id: AccountId::from(ALICE).into() }, | ||
], | ||
); |
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.
alice_on_bh
implies BH para id will be used, so either the right para id (not 1111) or change name to sibling_alice
or something similar.
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.
fixed
assert_ok!(LocationToAccountHelper::<AccountId, LocationToAccountId>::convert_location( | ||
alice_on_bh.into() | ||
)); |
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.
This location_conversion_works
test currently checks one single location conversion: that of an AccountId32
on a sibling parachain.
The test should verify multiple location types conversions. At the very least to completely cover regression testing for the changes in this PR it should cover all branches of DescribeFamily<DescribeAllTerminal>
.
That means: 3 valid branches in DescribeFamiliy x 6 valid types of location terminals defined in DescribeAllTerminal = 18 valid locations types to verify.
Also, instead of assert_ok!()
, you should check assert_eq!()
against the hardcoded converted account, so that we know in the future this conversion doesn't accidentally change (breaking existing derived accounts).
Same comment applies for all the other runtimes tests.
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.
Applied requested changes to a single runtime.
PTAL.
Added
HashedDescription<AccountId, DescribeFamily<DescribeAllTerminal>>
foreign locations to local accounts converter to all the parachains.