Why must this overhead be brought into frame system.
If you intend to have the logic which is:
let community_account_id = Pallet::<T>::get_community_account_id(&self.community_id);
Ok(frame_system::Origin::Signed(community_account_id))
What is the concern with just dispatching from this pallet with Signed(community_account_id)
?
It seems to me all of this could be solved by adding a single extrinsic into your pallet:
#[pallet::call]
pub fn convert_community_to_signed_call(origin: OriginFor<T>, call: Box<RuntimeCall>) -> DispatchResult {
let community_account_id = ensure_community_and_get_account(origin)?;
call.dispatch(frame_system::RawOrigin::Signed(community_account_id)?
}
Then users simply can dispatch their community
origin calls through this function to generate a signed origin call. In this case, there is less “magic” and you are not pushing further requirements or complexity up the FRAME stack.
For example, from a types perspective, it is not obvious to me that most origins should be convertible to a frame_system::RawOrigin
. This is probably why I didn’t understand your post to begin with. Having the origin represent a community, and that community having an account id seems very specific to certain scenarios, and ones you can support directly in your pallet.