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

Introduce Tinkernet multisig XCM configs #961

Closed
wants to merge 4 commits into from

Conversation

arrudagates
Copy link
Contributor

This PR adds the XCM configs necessary to allow Tinkernet multisigs to transact on Bifrost Kusama.

Tinkernet multisigs have the following MultiLocation pattern:

MultiLocation {
    parents: _, // ancestry depends on the point of reference. 0 if from parent, 1 if from sibling.
    interior: Junctions::X3(
        Junction::Parachain(2125), // Tinkernet ParaId in Kusama/Rococo.
        Junction::PalletInstance(71), // Pallet INV4, from which the multisigs originate.
        Junction::GeneralIndex(_) // Index from which the multisig account is derived.
    )
}

The following are the configs added by this PR to give the multisigs accounts and origins in Bifrost Kusama:

In Barrier

WithComputedOrigin<
  AllowTopLevelPaidExecutionFrom<invarch_xcm_builder::TinkernetMultisigMultiLocation>,
  UniversalLocation,
  ConstU32<1>,
>,

This is a barrier from the official xcm-builder crate that computes descended origins and by using AllowTopLevelPaidExecution<TinkernetMultisigMultiLocation>> within it allows for our multisig XCM messages to pass through.

In LocationToAccountId

invarch_xcm_builder::TinkernetMultisigAsAccountId<AccountId>,

This MultiLocation converter derives an AccountId for locations matching the one described above, it does so by using the same exact derivation function used in Tinkernet, this is important to make sure the multisigs maintain the same address across all chains, providing the best UX possible.
Because this derivation happens in Bifrost Kusama, it means the whole process is trustless and removes any possibility of account impersonation!

In XcmOriginToTransactDispatchOrigin

invarch_xcm_builder::DeriveOriginFromTinkernetMultisig<RuntimeOrigin>,

Same as explained above, except here we need to derive the AccountId and wrap it with a RawOrigin::Signed origin so this account can use the Transact XCM instruction and thus call extrinsics in the Bifrost Kusama runtime's pallets.

@hqwangningbo
Copy link
Member

@arrudagates hello , I would like to ask, what method does InvArch want to call using the transact instruction?

@arrudagates
Copy link
Contributor Author

@arrudagates hello , I would like to ask, what method does InvArch want to call using the transact instruction?

The goal is for the multisigs to be able to transact natively like any other user or local multisig. So any extrinsics a user can call, the XCM Multisig should be able to call too.

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.

2 participants