5

I'm currently exploring the possibility of having one solochain governed by another solochain using XCM and a trustless bridge. From my understanding, XCM is a communication standard used to facilitate cross-consensus communication, and a trustless bridge enables interoperability between chains without requiring any trust between them.

However, I'm not entirely sure how this would work in practice. Can anyone shed some light on how one solochain can govern another in this way? Are there any potential limitations or downsides to this approach?

Thank you in advance for your help!

1 Answer 1

2

Yes, you can do this. Actually the system parachains on Polkadot already do allow governance from another chain: the Relay Chain.

To separate things, XCM is a messaging format, and a bridge is a transport protocol. So you can see how system parachains delegate governance power (the Superuser or Root origin) to another chain by looking at the system parachains.

The specific example to follow here is ParentAsSuperuser. This is a utility in xcm_builder that implements ConvertOrigin for this specific use case. And it gets used here in Statemint.

You will have to make your own ConvertOrigin that is related to the bridged location. That could look something like:

pub struct SomeOtherChainAsSuperuser<RuntimeOrigin>(PhantomData<RuntimeOrigin>);
impl<RuntimeOrigin: OriginTrait> ConvertOrigin<RuntimeOrigin> for SomeOtherChainAsSuperuser<RuntimeOrigin> {
    fn convert_origin(
        origin: impl Into<MultiLocation>,
        kind: OriginKind,
    ) -> Result<RuntimeOrigin, MultiLocation> {
        let origin = origin.into();
        log::trace!(target: "xcm::origin_conversion", "SomeOtherChainAsSuperuser origin: {:?}, kind: {:?}", origin, kind);

        // Set the conditions here that map to your bridge/message specifics:
        if kind == OriginKind::Superuser && /* set location conditions here */ {
            Ok(RuntimeOrigin::root())
        } else {
            Err(origin)
        }
    }
}

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.