From a807646e1213c3f42f464b247c0d60f1b81583b0 Mon Sep 17 00:00:00 2001 From: Liam Monninger Date: Fri, 8 Nov 2024 14:23:27 +0100 Subject: [PATCH 1/6] feat: aptos governed gas pool. --- MIP/mip-n/README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 MIP/mip-n/README.md diff --git a/MIP/mip-n/README.md b/MIP/mip-n/README.md new file mode 100644 index 00000000..447c36d8 --- /dev/null +++ b/MIP/mip-n/README.md @@ -0,0 +1,43 @@ +# 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. + +## Errata + + +## Appendix From 7a68f250efd7ec15aae91dafa9aaef3d387560a0 Mon Sep 17 00:00:00 2001 From: apenzk Date: Tue, 28 Jan 2025 15:20:14 +0100 Subject: [PATCH 2/6] filename and codeowners --- .github/CODEOWNERS | 5 +---- MIP/{mip-n => mip-52}/README.md | 0 2 files changed, 1 insertion(+), 4 deletions(-) rename MIP/{mip-n => mip-52}/README.md (100%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3d5e5fd6..fa2f9ecf 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,16 +1,13 @@ # Reviewers that should be generally notified. * @l-monninger -* @andyjsbell * @apenzk # Authors and reviewers that should be added for specific files /MIP/mip-0/ @l-monninger @apenzk /MD/md-0/ @l-monninger @apenzk /MG/mg-0/ @l-monninger @apenzk - /MIP/mip1/ @l-monninger - /MD/md-3/ @l-monninger - /MIP/mip15/ @l-monninger @apenzk /MD/md-15/ @l-monninger @apenzk +/MIP/mip-52/ @l-monninger diff --git a/MIP/mip-n/README.md b/MIP/mip-52/README.md similarity index 100% rename from MIP/mip-n/README.md rename to MIP/mip-52/README.md From b8978fef0d53800daa956b9d29ba3f244316b6aa Mon Sep 17 00:00:00 2001 From: apenzk Date: Tue, 28 Jan 2025 15:22:09 +0100 Subject: [PATCH 3/6] minor changes --- MIP/mip-52/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MIP/mip-52/README.md b/MIP/mip-52/README.md index 447c36d8..6a4c24f7 100644 --- a/MIP/mip-52/README.md +++ b/MIP/mip-52/README.md @@ -1,4 +1,5 @@ # 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 @@ -30,14 +31,15 @@ The custom rewards collection approach replaces Aptos' experimental `transaction 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. -## Errata - +## Changelog ## Appendix From 8bc41b3089d3d09492673c9db9d71135f22b18b4 Mon Sep 17 00:00:00 2001 From: Liam Monninger Date: Tue, 25 Feb 2025 10:17:10 -0800 Subject: [PATCH 4/6] fix: aptos gas pool. --- MIP/mip-n/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MIP/mip-n/README.md b/MIP/mip-n/README.md index 447c36d8..f5f60d90 100644 --- a/MIP/mip-n/README.md +++ b/MIP/mip-n/README.md @@ -1,5 +1,5 @@ # MIP-52: Aptos Gas Pool -- **Description**: Introduces implementation specification for the Gas Pool in Aptos. +- **Description**: Introduces implementation specification for the Gas Pool in the Aptos Framework - **Authors**: [Liam Monninger](mailto:liam@movementlabs.xyz) - **Reviewer**: Andreas Penzkofer - **Desiderata**: [MD-38](https://github.com/movementlabsxyz/MIP/pulls) @@ -10,7 +10,7 @@ We propose a means of implementing a Gas Pool in Aptos to satisfy the token reci ## 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. +The introduction of a Gas Pool in Aptos will allow for the recirculation of gas used in the Aptos Framework based ecosystem. This ensures the supply can remain fixed and the gas can be re-used for purposes such as rewarding. ## Specification From de4722c3a5d98d98ab4c59b70f29e2328eeb46a8 Mon Sep 17 00:00:00 2001 From: apenzk Date: Wed, 26 Feb 2025 11:08:45 +0100 Subject: [PATCH 5/6] edits --- MIP/mip-52/README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/MIP/mip-52/README.md b/MIP/mip-52/README.md index 6a4c24f7..84ae6620 100644 --- a/MIP/mip-52/README.md +++ b/MIP/mip-52/README.md @@ -1,8 +1,7 @@ # MIP-52: Aptos Gas Pool -- **Description**: Introduces implementation specification for the Gas Pool in Aptos. +- **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 @@ -11,21 +10,23 @@ We propose a means of implementing a Gas Pool in Aptos to satisfy the token reci ## 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. +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. +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: +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. @@ -37,9 +38,10 @@ The burn replacement approach replaces the `coin::burn_from` call in `transactio ## 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 + +## Changelog From 2204779ba62ec34eb37b668a5898a0d922b6d59f Mon Sep 17 00:00:00 2001 From: Andreas Penzkofer <36140574+apenzk@users.noreply.github.com> Date: Mon, 3 Mar 2025 20:58:33 +0100 Subject: [PATCH 6/6] Update MIP/mip-52/README.md --- MIP/mip-52/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/MIP/mip-52/README.md b/MIP/mip-52/README.md index 1dbfb757..4168f114 100644 --- a/MIP/mip-52/README.md +++ b/MIP/mip-52/README.md @@ -9,11 +9,7 @@ We propose a means of implementing a Gas Pool in Aptos to satisfy the token reci ## Motivation -<<<<<<< HEAD:MIP/mip-n/README.md The introduction of a Gas Pool in Aptos will allow for the recirculation of gas used in the Aptos Framework based ecosystem. This ensures the supply can remain fixed and the gas can be re-used for purposes such as rewarding. -======= -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. ->>>>>>> de4722c3a5d98d98ab4c59b70f29e2328eeb46a8:MIP/mip-52/README.md ## Specification