0

I'm trying to set another owner for the messages and GRANDPA pallets, but I'm not succeeding while using the sudo account. I'm getting a sudo.Sudid BadOrigin error as a result.

I've been told that this could be a permission error. What am I missing here?

Edit: It does work if I submit an extrinsic instead. I'd like to understand why it does though.

1
  • What do you mean by "It does work if I submit an extrinsic instead"? Instead of what? What is the other way that you are trying to set the owner?
    – Bruno
    Commented Aug 31, 2022 at 18:01

2 Answers 2

2

I am not sure what specific pallet you are calling, but likely the error here is due to the way the extrinsic is designed.

The extrinsic in question probably has:

// Check the origin is from an account.
let caller = ensure_signed(origin)?;

These kinds of dispatchable functions can only accept extrinsics which come from a signed origin, which is why you observe: "It does work if I submit an extrinsic instead".

When you perform an action with Sudo, the resulting origin is Root, which will not pass this check.

The solution here would be to call with a regular user account, which is expected to work, or, if you need to use Sudo because you do not have access to the account, you can use another utility to turn a Root call into a call from any user account:

pub fn dispatch_as(
    origin: OriginFor<T>,
    as_origin: Box<T::PalletsOrigin>,
    call: Box<<T as Config>::RuntimeCall>,
) -> DispatchResult {
    ensure_root(origin)?;

    let res = call.dispatch_bypass_filter((*as_origin).into());

    Self::deposit_event(Event::DispatchedAs {
        result: res.map(|_| ()).map_err(|e| e.error),
    });
    Ok(())
}

This is from the Utility Pallet.

So you want to do: Sudo -> Dispatch As -> Set Owner (with the right user account origin)

0

I don't which version you are using. Need more detail.

For the latest code.

https://github.com/paritytech/parity-bridges-common/blob/267babc79d6ee0f3c35e464383616a397b8c0ba7/primitives/runtime/src/lib.rs#L406-L415

You just need to go to PolkadotApps -> Sudo -> bridgeGrandpa -> set_owner.

Or, PolkadotApps -> Extrinsic -> bridgeGrandpa -> set_owner. (use the current owner account to sign this)

Your Answer

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