0

When using this one, I get BadOrigin as in screenshot,

enter image description here

type ApproveOrigin = EitherOfDiverse<
        EnsureRoot<AccountId>,
        pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>,
    >;

vs

and when using this one transaction successfully executed.

type ApproveOrigin = EnsureSigned<AccountId>;

Can someone please tell me difference between using two of them inside pallet config?

2 Answers 2

1

The reason you're getting the BadOrigin error when sigining it as Alice is because you're not dispatching this call via sudo under the Developer tab. This is needed by polkadot-js to correctly craft a wrapped extrinsic.

The sudo call wraps a extrinsic and the sudo call itself must be signed by the superuser in order to pass the check for ensure_root(origin) in the pallet.

1

Both are different in which origin can call a specific function, in this case for the pallet_treasury is who can approve. Here's an example in the pallet_treasury

EnsureSigned only checks that the origin that is calling this function signed the message, so in this case if ApproveOrigin = EnsureSigned<AccountId> then anyone that sends a signed extrinsic could call this function.

Now EitherOfDiverse<L,R> works basically like an OR gate, meaning that this function can be called by either L or R, in the example you gave it would be either a root account (EnsureRoot<AccountId>) or by the council collective with a proportion equal or higher than 3/5 (pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>). This means that not anyone can call this function only the origin that meets either of those 2 requirements.

Edit: Even if an account is sudo account it will not work if you don't execute the extrinsic using the sudo pallet. This will send the request with a sudo origin. Here's an example.

enter image description here

1
  • hey @Valentin Fernandez, since Alice is root Account. I use Alice to approve proposal but I got BadOrigin issue here. Can you please tell me how to configure so that it works properly?
    – Ganesh11
    Jul 19 at 3:32

Your Answer

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

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