-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Problem:
Currently, there is no straightforward way to execute a call with a signed origin when the call is initiated by a pallet origin (e.g., the Treasurer), unless the pallet origin is explicitly converted into a pallet’s sovereign account within the call function.
Details:
Entities such as the Treasury have associated origins, like Treasurer, MediumSpender, etc., as well as corresponding sovereign accounts. Currently, the only way for an entity to execute a general call with a signed origin is via the XCM executor using a Transact instruction with the origin type SovereignAccount. In this process, the entity’s origin is converted into a signed origin using the sovereign account associated with the original origin.
This approach requires XCM execution and multiple Transact instructions if some calls must be executed with the entity/pallet origin. Moreover, the XCM executor is not configured to convert local pallet locations or pallet origins into the desired sovereign accounts. Instead, it relies on general mechanisms that map a generic location to a sovereign account using a common approach (e.g., whereas for the Treasury we would want it converted into an account ID derived from the PalletId type).
Use Case:
Treasury adds liquidity to a liquidity pool and holds the LP tokens under its sovereign account.
Proposed Solution:
Introduce a new dispatch_as_signed call in the utility pallet. This call would convert the origin commanding the call into its associated sovereign account and dispatch the calls passed as arguments using a signed origin from that associated account. The introduced call and XCM executor uses the same covert type to facilitate the conversion.
API:
pub fn dispatch_as_signed(
origin: OriginFor<T>,
call: Box<<T as Config>::RuntimeCall>
) -> DispatchResult;