-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AIP-39][Discussion] Separate gas payer #173
Comments
Before this proposal, I had built the following wrapping functions that pays the transaction fee instread of our user. After this is implemented, we do not need this kinds of functions anymore, right?
|
Awesome work! I have some questions.
|
This makes a lot of sense. As I was reading through I had the idea that it might be useful to consider supporting multiple gas providers on a single transaction. It's not uncommon for a lot of wallets to end up with dust in them which can't basically be used for anything. It might potentially be (I don't have any quantitative data on this) a way for people or groups of people that have tiny amount of dust (stagnant economic power) to utilize it for something? |
I didn't read the AIP to be deep, Question, do the AIP will affect to Gas Payer of account sequence number? if so, it sounds not useful when you are going to send a bunch of transactions at once time. |
This makes a lot of sensé |
Sounds great! BTW, there would be typos. In Extending multi-agent transactions
Thanks! |
I have a question. As I understand, the normal transaction (from one account) has the rate limit in terms of TPS as 100. Thanks! |
Yep that's correct. You'd be able to call coin::transfer directly with just the signer of the main sender. The signer for the gas payer account will not be instantiated at all |
|
No the limit will still be enforced on a per-sender basis and not gas payer |
oyee |
Summary
This AIP proposes a mechanism for specifying a different gas payer account from the transaction sender. The gas for the transaction is deducted from the gas payer account while not giving access to its signer for any other purposes - the transaction would be executed exactly the same regardless of who pays for gas.
Motivation
It’s a common use case where an app can pay for gas on behalf of their users. Currently, transactions on Aptos always deduct gas from the sender from normal single-sender transactions or primary sender for multi-agent transactions. There is no direct support for specifying a different account where gas should be deducted from. Users can currently construct multi-agent transactions and call a custom proxy Move function so that:
Although this could achieve the desired effect of a separate gas payer, this approach is cumbersome and requires both custom on-chain and off-chain code. Furthermore, this would use the gas payer’s nonce, which creates a bottleneck for scaling gas paying operations where the gas payer account could be paying gas for many transactions from many different users.
Proposal
We can properly support separating the gas payer account from the sender while preserving the same effects as if the sender sends the transaction themselves. This means:
The cleanest solution proposed here is to extend the multi-agent transaction semantics to allow appending an extra gas payer address to the list of sender addresses. Gas can be deducted from this address without a signer being constructed when the destination code (entry function call or script) is invoked. In the future we can also extend the Authenticator part of a transaction to add more metadata if we want to further enrich gas paying functionalities.
Extending multi-agent transactions
The main benefit of this approach is minimal code changes required both in the Aptos VM (where gas is charged) and in SDK. This approach is more of an extension to multi-agent transactions than a new transaction type. The developer flow works as below:
The implementation is relatively straightforward:
Impact on indexing
In either approach, the coin processor/model would need to be updated to correctly attribute gas burn events (currently hardcoded to be the sender). Indexing service providers and ecosystem projects who run their own indexing would need to upgrade their code to get this change.
Reference Implementation
WIP
Risks and Drawbacks
The primary risk is smart contract risk where there can be bugs or vulnerabilities in the VM (gas charging) and Move (transaction prologue/epilogue) changes
Future Potential
Gas payer paves the way for many exciting extensions in the future, such as:
The text was updated successfully, but these errors were encountered: