-
Notifications
You must be signed in to change notification settings - Fork 1.2k
FRAME: Syntax for marking calls "feeless" #1725
Copy link
Copy link
Closed
Labels
T1-FRAMEThis PR/Issue is related to core FRAME, the framework.This PR/Issue is related to core FRAME, the framework.
Description
Moving an internal FRAME team discussion to a Github issue.
Motivation
@gavofyork suggested a new syntax which can be used before a call and have it mean that it can skip all normal transaction fee and account existence requirements.
#[pallet::feeless_if(|origin: &OriginFor<T>, ticket: &Ticket| -> bool {
let account = ensure_signed(origin.clone())?;
some_conditions_here(&account, &ticket)
})]@gupnik volunteered to work on it.
Solution
@gupnik suggested a solution and requested feedback:
- Pallet Call enum can optionally have a feeless conditional.
- Construct Runtime creates a
RuntimeSignedExtensionthat takesOnChargeTransaction. - In
post_dispatch, we check if the current call has a feeless conditional. If so, the fee is never charged (bypassing the requirement the caller has any balance).
A couple of questions
- How can
RuntimeSignedExtensionknow the amount that was charged originally? - Is there a way to test the entire flow using a unit test? Any references that I could use?
Other questions
- @KiChjang suggested rather than an attribute macro this could be implemented in a way more 'rustic'.
- @liamaharon considered rather than the method returning a
bool, it returning aBalancewhich could be used to modify the fee in more than a single way way.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
T1-FRAMEThis PR/Issue is related to core FRAME, the framework.This PR/Issue is related to core FRAME, the framework.
Type
Projects
Status
Done
Status
Done