Conversation
| use $crate::impls::{bx, Chain, RelayChain}; | ||
|
|
||
| <Self as $crate::impls::TestExt>::execute_with(|| { | ||
| let root_origin = <Self as Chain>::RuntimeOrigin::root(); |
There was a problem hiding this comment.
Why are we assuming that is going to be always root? Someone would like to test sending a Transact with different origin. I think we should either accept origin as an extra argument for send_transact_to_parachain or rename method to send_transact_to_parachain_as_sudo (better the first option)
There was a problem hiding this comment.
Well, this is meant for governance-like calls from relay to para with RuntimeOrigin::root() and UnpaidExecution not to repeat the same code everywhere:
/// A root origin (as governance) sends `xcm::Transact` with encoded `call` to child parachain.
If we want it make it more general, then yes origin and also some "switch" for UnpaidExecution/BuyExecution wrapper should be added as a parameter. Then we should add it as a generic helper function for Chain trait.
I think, for me, send_transact_to_parachain_as_sudo means more like there is pallet_sudo which is not the case.
I am inclined to keep it as it is :).
Anyway, anybody else can still create whatever scenario with [<$chain Pallet>]>::XcmPallet::send.
@NachoPal wdyt?
There was a problem hiding this comment.
Didn't realise about the hardcoded UnpaidExcution. Are there cases where an UnpaidExecution is going to work with a different origin than Superuser? If not then I do not see it necessary to have it as function argument.
Sorry, I sometimes use sudo and root interchangeably. If it is meant to be for governance-like calls (root) then we can do:
pub fn send_transact_to_parachain_as_root(
recipient: $crate::impls::ParaId,
call: $crate::impls::DoubleEncoded<()>
)What I am trying to avoid is to impl a method that is only meant to work for root, UnpaidExecution and Origin::Superuser with a so generic name - send_transact_to_parachain - (even if it is properly documented)
There was a problem hiding this comment.
ok, I renamed to send_unpaid_transact_to_parachain_as_root, please, check here: c30119c
I also was able to reuse do_force_create_asset_from_relay_as_root for force_create_and_mint_asset, which looks also much clear now
cumulus/parachains/integration-tests/emulated/assets/asset-hub-westend/src/tests/mod.rs
Outdated
Show resolved
Hide resolved
...parachains/integration-tests/emulated/assets/asset-hub-westend/src/tests/set_xcm_versions.rs
Show resolved
Hide resolved
NachoPal
left a comment
There was a problem hiding this comment.
Just small nit to keep consistent with naming
cumulus/parachains/integration-tests/emulated/common/src/impls.rs
Outdated
Show resolved
Hide resolved
cumulus/parachains/integration-tests/emulated/common/src/impls.rs
Outdated
Show resolved
Hide resolved
* master: (33 commits) ci: set CI_IMAGE back to (now updated) .ci-unified (#1854) ci: bump ci image to rust 1.73.0 (#1830) Refactor Identity to benchmark v2 (#1838) PVF worker: bump landlock, update ABI docs (#1850) Xcm emulator nits (#1649) Fixes path issue in derive-impl (#1823) upgrade to macro_magic 0.4.3 (#1832) Use safe math when pruning statuses (#1835) remote-ext: fix state download stall on slow connections and reduce memory usage (#1295) Update testnet bootnode dns name (#1712) [FRAME] Warn on unchecked weight witness (#1818) [xcm] Use `Weight::MAX` for `reserve_asset_deposited`, `receive_teleported_asset` benchmarks (#1726) Update bridges subtree (#1803) Check for parent of first ready block being on chain (#1812) Make CheckNonce refuse transactions signed by accounts with no providers (#1578) Fix Asset Hub collator crashing when starting from genesis (#1788) Mixnet integration (#1346) [xcm-emulator] Decouple the `AccountId` type from `AccountId32` (#1458) Treasury spends various asset kinds (#1333) chore: bump zombienter version (#1806) ...
* remove callbacks * clippy * fmt
Desription
Summary
This PR introduces several nits and tweaks to xcm emulator tests for system parachains.
Explanation
Deduplicate
XcmPallet::send(with root origin codesend_transact_to_parachainwhich could be easily reuse for scenarios like governance call from relay chain to parachain.Refactor
send_transact_sudo_from_relay_to_system_para_worksdo_force_create_asset_from_relay_to_system_para, so now we can extend this test with more governance-like senarios.send_transact_as_superuser_from_relay_to_system_para_works.Remove
send_transact_native_from_relay_to_system_para_failstestRelayChainAsNativewith correct xcm origin.Future directions
Check restructure parachains integration tests issue and PR with more TODOs.