2

I am building custom XCM pallet.

While executing specific call:

The destination is of ParaId type.

      match send_xcm::<T::XcmSender>(
          (Parent, Junction::Parachain(destination.into())).into(),
          Xcm(vec![Transact {
              origin_kind: OriginKind::Native,
              require_weight_at_most: Weight::from_parts(1_000, 1_000),
              call: <T as Config>::RuntimeCall::from(Call::<T>::mint_collection_received {
                  collection_name,
                  collection_description,
                  origin_parachain_id: 2000.into(),
                  owner: recipient.clone(),
              })
              .encode()
              .into(),
          }]),            ) {
          Ok((hash, cost)) => Self::deposit_event(Event::CollectionCreatedAndTransferedXCM {
              collection_hash,
              owner: recipient.clone(),
              destination,
          }),
          Err(e) => Self::deposit_event(Event::CollectionFailedToXCM {
              e,
              collection_hash,
              owner: recipient.clone(),
              destination,
          }),             }

I receive error Bad Origin. enter image description here I execute it with sudo.

Any answer as to why?

Thanks

Once executed with normal test account I receive following output: enter image description here Any idea what "Transport" error mean?

4
  • can you provide: 1. the full sudo call screen? 2. xnftPallet extrinsic code? 3. your xcm_executor::Config details? 4. where (from which chain) are you trying to execute that sudo call? Feb 5 at 8:49
  • Hey Branislav, I use the standard Parachain template so xcm_executor is default. I am calling this instruction from a locally launched parachain template via Zombienet. Do you mean the entire call of the xnft function? The part I sent handles XCM, there is no other code to regard XCM in that function. Looking forward to your answer. Thanks!
    – Dudo
    Feb 6 at 17:18
  • > I execute it with sudo. I just wanted to now "how and what did you execute exactly"? I mean, e.g. could you add screenshot with full extrinsic call from polkadot.js.org/apps or unit-test code snippet? > "Transport" error My guess is that you need to open HRMP channel to the Parachain(2000) at first. E.g,. you can check hrmp channels like this: polkadot.js.org/apps/… parachainSystem -> relevantMessagingState. Feb 7 at 12:18
  • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
    – Simson
    Feb 9 at 13:22

3 Answers 3

0

Maybe if you could share your Zombienet, I could help better.

You can open HRMP channel but you need also sudo account on your local relay chain (I guess you have rococo-local?).

We have also some scripts for opening HRMP channel for our local testing with zombienet: https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/scripts/bridges_rococo_westend.sh#L211-L214 https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/scripts/bridges_common.sh#L165-L190

or with PJS:

enter image description here

2
  • Hey Branislav, here is code: github.com/ParaSpell-Research-Foundation/…
    – Dudo
    Feb 8 at 14:37
  • To test code pull the repo, then compile parachain template using "cargo b -r -p parachain-template-node" then compile polkadot node using "cd Polkadot && cargo build --release" , then launch via Zombienet: Navigate to binaries via "cd binaries" add your zombienet binary and run the command: "./zombienet-macos -p native -c 1 spawn config.toml"
    – Dudo
    Feb 8 at 14:37
0

thanks for the links, the problem with sudo is now clear, you need to change ensure_signed -> ensure_signed_or_root here: https://github.com/ParaSpell-Research-Foundation/polkadot-sdk-nft-pallet/blob/master/cumulus/parachain-template/pallets/xnft/src/lib.rs#L260C14-L260C27

0

@dudo, can you please point me to the valid/compilable code, because I don't see setting XcmSender here, but here it is expected.

Without valid XcmConfig I cannot check that second isssue with Transact. I need to see XcmSender code :)

2
  • Hey @Branislav, I have not yet implemented XcmSender to mock.rs only to Runtime. You can compile the Parachain template with the commands I sent in a comment where I sent a link for the code.
    – Dudo
    Feb 12 at 11:06
  • I see, ok, so you are starting zombienet with two parachains (1000 and 1001) here github.com/ParaSpell-Research-Foundation/…. But in your example you use destination=2000. Also the runtime uses XcmRouter with XcmpQueue. So, if you want send XCM between parachain from 1000 -> 1001 you need to open HRMP channel between paras (as I said in the previous comments) and change destination to 2000. Feb 12 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.