Skip to content
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

[review] MIP-52: Aptos Gas Pool #52

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions MIP/mip-n/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# MIP-52: Aptos Gas Pool
- **Description**: Introduces implementation specification for the Gas Pool in Aptos.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why "in Aptos" ? do you mean "in Aptos-core"?

- **Authors**: [Liam Monninger](mailto:[email protected])
- **Reviewer**: Andreas Penzkofer
- **Desiderata**: [MD-38](https://github.com/movementlabsxyz/MIP/pulls)

## Abstract

We propose a means of implementing a Gas Pool in Aptos to satisfy the token recirculation requirements indicated in [MD-38](https://github.com/movementlabsxyz/MIP/pulls). This solution will allow for gas used to be stored in the pool. The re-use of said gas is not a subject of this MIP. However, [MIP-44](https://github.com/movementlabsxyz/MIP/pull/44), [MIP-41](https://github.com/movementlabsxyz/MIP/pull/41), et al. provide suggestions to this end.

## Motivation

The introduction of a Gas Pool in Aptos will allow for the recirculation of gas used in the Aptos ecosystem. This ensures the supply can remain fixed and the gas can be re-used for purposes such as rewarding.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean "used in the Aptos-core system"?

also why ecosystem?


## Specification

Aptos pays gas in the [epilogue](https://github.com/movementlabsxyz/aptos-core/blob/70be3926ff79ff4cdb0cee928f717fafcd41ecdd/aptos-move/aptos-vm/src/transaction_validation.rs#L194) of a transaction [dispatching](https://github.com/movementlabsxyz/aptos-core/blob/70be3926ff79ff4cdb0cee928f717fafcd41ecdd/aptos-move/aptos-vm/src/transaction_validation.rs#L34) to [`epilogue_gas_payer`](https://github.com/movementlabsxyz/aptos-core/blob/70be3926ff79ff4cdb0cee928f717fafcd41ecdd/aptos-move/framework/aptos-framework/sources/transaction_validation.move#L274). Depending on the [validator reward setting](https://github.com/movementlabsxyz/aptos-core/blob/70be3926ff79ff4cdb0cee928f717fafcd41ecdd/aptos-move/framework/aptos-framework/sources/transaction_validation.move#L305), [`epilogue_gas_payer`](https://github.com/movementlabsxyz/aptos-core/blob/70be3926ff79ff4cdb0cee928f717fafcd41ecdd/aptos-move/framework/aptos-framework/sources/transaction_validation.move#L274) will either call `transaction_fee::collect_fee` or `transaction_fee::burn_fee`.

At the time of writing the `transaction_fee::collect_fee` path is still experimental.

[`transaction_fee::burn_fee`](https://github.com/movementlabsxyz/aptos-core/blob/70be3926ff79ff4cdb0cee928f717fafcd41ecdd/aptos-move/framework/aptos-framework/sources/transaction_fee.move#L218) internally calls [`coin::burn_from`](https://github.com/movementlabsxyz/aptos-core/blob/70be3926ff79ff4cdb0cee928f717fafcd41ecdd/aptos-move/framework/aptos-framework/sources/transaction_fee.move#L229C17-L233C19) which can be replaced with a transfer.

We thus suggest two paths to implement the Gas Pool in Aptos:
- **Custom Rewards Collection**
- **Burn Replacement**

### Custom Rewards Collection
The custom rewards collection approach replaces Aptos' experimental `transaction_fee::collect_fee` with a custom rewards collection mechanism. This mechanism calls `coin::transfer_from` to move the gas to the Gas Pool at a known address.

Coin burning logic can be kept in place and a similar features-based approach can be used to determine ensure the `transaction_fee::collect_fee` approach is used.

### Burn Replacement
The burn replacement approach replaces the `coin::burn_from` call in `transaction_fee::burn_fee` with a `coin::transfer_from` call to the Gas Pool.

## Verification
**Outstanding**:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this MIP be approved or should we await this outstanding points to be clarified @l-monninger ?

- Verify that the AptosVM does not validate burns. Otherwise, there may be logic outside of the framework `epilogue_gas_payer` path which needs to be updated.
- Identify any sponsorship or other gas payment mechanisms which may need to be updated to use the Gas Pool.

## Errata


## Appendix