Proxy real can pay fee on behalf of delegate#2470
Open
l0r1s wants to merge 11 commits intodevnet-readyfrom
Open
Proxy real can pay fee on behalf of delegate#2470l0r1s wants to merge 11 commits intodevnet-readyfrom
l0r1s wants to merge 11 commits intodevnet-readyfrom
Conversation
sam0x17
previously approved these changes
Feb 27, 2026
gztensor
reviewed
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
With the upcoming 10x fee increase shipping in the same release, delegates operating on behalf of real accounts would need to maintain significantly larger balances just to cover fees. This change lets the real account absorb those costs directly.
Summary
set_real_pays_feeextrinsic andRealPaysFeestorage, letting a real account opt in to paying fees for a delegate. Benchmarked.ChargeTransactionPaymentWrapperto inspectproxycalls duringvalidateand charge the opted-in real account instead of the signer. Supports nested proxy and batch-of-proxy patterns up to 2 levels deep. Extension weight accounts for the additional storage reads.Today, the delegate (signer) always pays the fee for proxy calls. With this change, the fee can be pushed to the real account — or even deeper into nested proxy structures — based on the
RealPaysFeeopt-in.How it works
When a
proxy(real, call)extrinsic entersvalidate, the wrapper inspects the call to determine who should pay the fee:proxy(real=A, call)withRealPaysFee<A, signer>setproxy(real=A, call)without opt-inproxy(real=B, proxy(real=A, call))with both<B, signer>and<A, B>setproxy(real=B, proxy(real=A, call))with only<B, signer>setproxy(real=B, batch([proxy(real=A, ..), ..]))with<B, signer>and<A, B>set, all batch items sharing the same real Aproxy(real=B, batch([proxy(real=A, ..), ..]))with only<B, signer>setThe resolved fee payer is used to create a synthetic origin for the inner
ChargeTransactionPayment::validatecall. The original signer is always preserved as the dispatch origin.Design decisions
proxycalls are handled —proxy_announcedis intentionally excluded to keep the logic simple. Fee propagation relies on the delegate being the implicit caller, which is always the case forproxybut not forproxy_announced.proxycall with the same real account. Mixed reals or non-proxy items cause the fee to stay at the outer real.RealPaysFeeis checked once per batch — since the delegate is always the outer real for innerproxycalls, a single storage read on the first batch item covers the entire batch.Test plan
runtime/tests/transaction_payment_wrapper.rscovering:proxy_announcedalways charges signerType of Change
Breaking Change
If this PR introduces a breaking change, please provide a detailed description of the impact and the migration path for existing applications.
Checklist
./scripts/fix_rust.shto ensure my code is formatted and linted correctlyScreenshots (if applicable)
Please include any relevant screenshots or GIFs that demonstrate the changes made.
Additional Notes
Please provide any additional information or context that may be helpful for reviewers.