diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 783b6b59..23b285ee 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -11,6 +11,7 @@ /MIP/mip-15/ @l-monninger @apenzk /MD/md-15/ @l-monninger @apenzk /MIP/mip-39/ @franck44 +/MIP/mip-52/ @l-monninger /MIP/mip-53/ @l-monninger /MIP/mip-58/ @primata @apenzk /MIP/mip-88/ @apenzk @Primata diff --git a/MIP/mip-52/README.md b/MIP/mip-52/README.md new file mode 100644 index 00000000..6a4c24f7 --- /dev/null +++ b/MIP/mip-52/README.md @@ -0,0 +1,45 @@ +# MIP-52: Aptos Gas Pool + +- **Description**: Introduces implementation specification for the Gas Pool in Aptos. +- **Authors**: [Liam Monninger](mailto:liam@movementlabs.xyz) +- **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. + +## 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**: +- 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. + +## Changelog + +## Appendix