frequency icon indicating copy to clipboard operation
frequency copied to clipboard

[PassKey]: invoke post_dispatch for weight check

Open aramikm opened this issue 7 months ago • 0 comments

Feature Description

It looks like that having the post_disptach constraints is not compatible with the constraints on the pallet extrinsic. There might be a way to accomplish this by pulling all checks outside of the pallet and into the runtime and just call them from Config.

Details

CheckWeight implement post_dispatch which needs to be executed on passkey proxy call

some related code


	/// Post dispatch call
	/// WARNING: It is dangerous to return an error here. To do so will fundamentally invalidate the
	/// transaction and any block that it is included in, causing the block author to not be
	/// compensated for their work in validating the transaction or producing the block so far.
	pub fn post_dispatch(
		payload: &PasskeyPayload<T>,
		post_info: &PostDispatchInfoOf<<T as frame_system::Config>::RuntimeCall>,
	) -> Result<(), TransactionValidityError> {
		let some_call: Box<<T as Config>::RuntimeCall> = payload.clone().passkey_call.call;
		// we are only using the dispatch info for the inner call since the overhead would always be
		// the same, and we don't need to include it here
		let info = &some_call.get_dispatch_info();
		CheckWeight::<T>::post_dispatch(None, &info, post_info, 0, &DispatchResult::Ok(()))
	}

Searched for Related Issues

  • [X] I have done a search for related issues and either found none, or noted them

aramikm avatar Jul 08 '24 20:07 aramikm