Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Cancel Schedule - AuctionAdmin results on BadOrigin #7541

Closed
SBalaguer opened this issue Jul 24, 2023 · 2 comments
Closed

Cancel Schedule - AuctionAdmin results on BadOrigin #7541

SBalaguer opened this issue Jul 24, 2023 · 2 comments

Comments

@SBalaguer
Copy link
Contributor

Recently Referendum 56 passed on Polkadot, intending to cancel the previously scheduled auctions with the wrong origins for OpenGov and also scheduling new ones with the right auction origin. Scheduling of the new auctions worked just fine, however the canceling of the previously scheduled auctions failed with BadOrigin, as stated here: https://polkadot.subscan.io/block/16477742?tab=event.

Both canceling and scheduling have been done through a batch call with the same origin, AuctionAdmin. The call can be found on the submission linked before.

On Polkadot, scheduler has as a defined origin of EitherOf<EnsureRoot<AccountId>, AuctionAdmin>;, therefore the expected result is for the cancellation to work. On top of this, I couldn't see anything special on the cancel_named extrinsic, that might override the origin.

Right now, the expected behaviour to happen on Polkadot is that the scheduling of an auction will fail, and the scheduling of the same auction under the new origin will work. This does not seem like a huge risk for the network, however it would be better to cancel the wrongly schedule auctions.

@SBalaguer SBalaguer changed the title Cancel Schedule - AuctionAdmin yields BadOrigin Cancel Schedule - AuctionAdmin results on BadOrigin Jul 24, 2023
@bkchr
Copy link
Member

bkchr commented Aug 21, 2023

This is not a bug, more the system preventing an origin (the AuctionAdmin) to cancel a scheduled item that was scheduled by an origin (RootOrigin) with higher privileges. The scheduler is using the following code to decide on which origin has higher privileges:

pub struct OriginPrivilegeCmp;
impl PrivilegeCmp<OriginCaller> for OriginPrivilegeCmp {
fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option<Ordering> {
if left == right {
return Some(Ordering::Equal)
}
match (left, right) {
// Root is greater than anything.
(OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater),
// For every other origin we don't care, as they are not used for `ScheduleOrigin`.
_ => None,
}
}
}

I would not want to change this to make AuctionAdmin have the same privilege as root.

I propose that we do a whitelisted call by the fellowship to cancel them. The whitelisted call will use root and that will be able to cancel the scheduled item.

Given that this works as expected, I would close this issue.

@bkchr bkchr closed this as completed Aug 21, 2023
@SBalaguer
Copy link
Contributor Author

Ref 130 is up for vote following the suggestion: https://polkadot.polkassembly.io/referenda/130.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants