When determining whether a submission origin should be allowed, it is useful to be able to inspect the track they are submitting for, since it may be desired to have less-privileged origins be valid for some tracks but not others.
This alters the type bound accordingly. To minimise breakage across the ecosystem, all type bounders in Substrate are updated to support the EnsureOriginWithArg trait as well as the EnsureOrigin trait. To facilitate this support both in Substrate and downstream repos, a macro allowing EnsureOrigin implementors to naively support EnsureOriginWithArg is introduced.
🚨 Code Changes
If you are using Referenda pallet and find a build error around the SubmitOrigin (which is probably a custom origin), then simply wrap the type with frame_support::AsEnsureOriginWithArg to get an EnsureOriginWithArg impl. E.g.
impl pallet_referenda::Config for Runtime {
type SubmitOrigin = MyEnsureOriginImpl;
// snip
}
Would become:
impl pallet_referenda::Config for Runtime {
type SubmitOrigin = frame_support::AsEnsureOriginWithArg<MyEnsureOriginImpl>;
// snip
}
When determining whether a submission origin should be allowed, it is useful to be able to inspect the track they are submitting for, since it may be desired to have less-privileged origins be valid for some tracks but not others.
This alters the type bound accordingly. To minimise breakage across the ecosystem, all type bounders in Substrate are updated to support the
EnsureOriginWithArg
trait as well as theEnsureOrigin
trait. To facilitate this support both in Substrate and downstream repos, a macro allowingEnsureOrigin
implementors to naively supportEnsureOriginWithArg
is introduced.🚨 Code Changes
If you are using Referenda pallet and find a build error around the
SubmitOrigin
(which is probably a custom origin), then simply wrap the type withframe_support::AsEnsureOriginWithArg
to get anEnsureOriginWithArg
impl. E.g.Would become: