diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 783b6b59..dba3d4d1 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-48/ @0xmovses /MIP/mip-53/ @l-monninger /MIP/mip-58/ @primata @apenzk /MIP/mip-88/ @apenzk @Primata diff --git a/MIP/mip-48/README.md b/MIP/mip-48/README.md new file mode 100644 index 00000000..110a56a0 --- /dev/null +++ b/MIP/mip-48/README.md @@ -0,0 +1,138 @@ +# MIP-48: `aptos_governance` for Goverened Gas Pool +- **Description**: Use the `aptos_governance` framework for the Governed Gas Pool +- **Authors**: [Richard Melkonian](mailto:richard@movementlabs.xyz) + +## Abstract + +The Goverened Gas Pool design presented in [MIP-44](../mip-44/) is required to be subject to onchain governance by a governing body that holds the +`$L2-MOVE` token. In [MIP-44] governance mechanisms and roles are proposed, such as `Proposers` and `Executors` so that the collected gas can be used +for the good of the network. + +The Governed Gas Pool may be used to provide liquidity for different network needs, such as L1 Reward Tokens, or to enable the "Trickle-back", where the `$L2-MOVE` would be paid +directly to attestors as `$L1-MOVE` for rewards. For all these activities a dispersal of funds is required, this MIP proposes concrete ways to manage dispersal events +in a safe immutable and secure manner. + +To decide on how acrued `$L2-MOVE` in the Governed Gas Pool should be used, a robust and thorough implementation of governance should be proposed. + +## Motivation + +This MIP proposes an implementation of the governance mechanism proposed in [MIP-44] by using the `aptos_governance.move` module. We think this has several benefits. +1. `aptos_governance.move` is fully audited and battle tested. +2. `aptos_governance.move` is currently in use on the Aptos Blockchain. +3. Using aptos governance prepares us for extendeding it and using it for future proposals to upgrade or migrate the network, this will be a fairly common necessity post-mainnet. +4. It strenghtens the utility of `$L2-MOVE` as this becomes the governance token. + +## Specification + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174. + +## Reference Implementation + +The `governed_gas_pool.move` would interact with `aptos_framework.move`, seperating the roles of actual governance, voting and storing of gas and dispersing those funds. + +```rust +//pseudocode +module GovernedGasPool::goverened_gas_pool { + use aptos_framework::aptos_coin::AptosCoin; + use aptos_framework::coin; + use aptos_framework::signer; + use aptos_framework::aptos_governance; + use aptos_framework::aptos_governance::{self, GovernanceProposal}; + use aptos_std::vector; + use aptos_std::option::{self, Option}; + + // Address of the governance framework module + const GOVERNANCE_ADDRESS: address = @0x1; + + struct GovernedPool has key { + funds: coin::Coin, // holds the pool of funds in AptosCoin + passed_proposals: vector::Vector, // list of proposals that passed governance + admin: address // address with permission to execute proposals + } + + struct DispersalAction has copy, drop, store { + recipient: address, + amount: u64 + } + + struct Proposal has key { + id: u64, + dispersal_action: Option, // Only one type of action at a time + executed: bool, + } + + /// Initialize the Governed Pool + public fun initialize_governed_pool(admin: &signer, authorized_admin: address): address { + let governed_pool = GovernedPool { + funds: coin::zero(), + passed_proposals: vector::empty(), + admin: authorized_admin + }; + let addr = signer::address_of(admin); + move_to(admin, governed_pool); + addr + } + + /// Add a proposal that has passed governance + /// Only callable by the governance module at address 0x1 + public fun add_passed_proposal( + pool: &mut GovernedPool, + governance_signer: &signer, + id: u64, + dispersal_action: DispersalAction + ) { + // Ensure only the governance framework can call this function + assert!(signer::address_of(governance_signer) == GOVERNANCE_ADDRESS, 1); + + // Verify that the proposal is approved in aptos_governance + assert!(aptos_governance::is_proposal_approved(id), 2); + + let proposal = Proposal { + id, + dispersal_action: option::some(dispersal_action), + executed: false, + }; + vector::push_back(&mut pool.passed_proposals, proposal); + } + + /// Execute a proposal that has been approved by governance + /// Only callable by the designated admin + public fun execute_passed_proposal(pool: &mut GovernedPool, executor: &signer, proposal_id: u64) { + // Ensure only the authorized admin can call this function + assert!(signer::address_of(executor) == pool.admin, 2); + + let proposal_index = find_proposal(&pool.passed_proposals, proposal_id); + let proposal = &mut vector::borrow_mut(&mut pool.passed_proposals, proposal_index); + + // Ensure the proposal hasn't already been executed + assert!(!proposal.executed, 3); + + // Execute the dispersal action if present + if (option::is_some(&proposal.dispersal_action)) { + let action = option::borrow(&proposal.dispersal_action).unwrap(); + let amount = action.amount; + assert!(amount <= coin::value(&pool.funds), 4); // Ensure pool has sufficient funds + coin::withdraw(&mut pool.funds, amount); + coin::deposit(&signer::create(action.recipient), amount); + }; + + proposal.executed = true; + } +} +``` + +Notice the call : +`assert!(aptos_governance::is_proposal_approved(id), 2);` + +## Verification + + +## Errata + + +## Appendix + +--- +## Copyright + +Copyright and related rights waived via [CC0](../LICENSE.md). diff --git a/MIP/mip-48/README2.md b/MIP/mip-48/README2.md new file mode 100644 index 00000000..bae2d62f --- /dev/null +++ b/MIP/mip-48/README2.md @@ -0,0 +1,118 @@ +# MIP-\: use `aptos_governance` for Goverened Gas Pool +- **Description**: ???? +- **Authors**: [Richard Melkonian](mailto:richard@movementlabs.xyz) + +## Abstract + +The Goverened Gas Pool design presented in [MIP-44](../mip-44/) is required to be subject to onchain governance by a governing body that holds the +`$L2-MOVE` token. In [MIP-44] governance mechanisms and roles are proposed, such as `Proposers` and `Executors` so that the collected gas can be used +for the good of the network. + +The Governed Gas Pool may be used to provide liquidity for different network needs, such as L1 Reward Tokens, or to enable the "Trickle-back", where the `$L2-MOVE` would be paid +directly to attestors as `$L1-MOVE` for rewards. For all these activities a dispersal of funds is required, this MIP proposes concrete ways to manage dispersal events +in a safe immutable and secure manner. + +To decide on how acrued `$L2-MOVE` in the Governed Gas Pool should be used, a robust and thorough implementation of governance should be proposed. + +## Motivation + +This MIP proposes an implementation of the governance mechanism proposed in [MIP-44] by using the `aptos_governance.move` module. We think this has several benefits. +1. `aptos_governance.move` is fully audited and battle tested. +2. `aptos_governance.move` is currently in use on the Aptos Blockchain. +3. Using aptos governance prepares us for extendeding it and using it for future proposals to upgrade or migrate the network, this will be a fairly common necessity post-mainnet. +4. It strenghtens the utility of `$L2-MOVE` as this becomes the governance token. + +## Specification + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174. + +##### 1. Fix the Potential Supply + +As described in the [Abstract](#abstract), the sum of the token supply of `$L1MOVE` and `$L2MOVE` is equal to `MOVE_MAX`. Since the bridge is the sole point of creation (or release) of `$L2MOVE` token, the L2 contract MUST monitor the `$L2MOVE` supply. The L2 bridge contract MUST not release more `$L2MOVE` than the maximum supply `MOVE_MAX`. + +##### 2. Native Bridge rate limitation + +The total amount of bridge transfers should be rate limited to $(X, T)$ where $X$ is the maximum transferable amount per time period $T$. I.e. the bridge should not allow more than $X$ total transaction value in any $T$ period. + +To not impact honest traffic heavily, a governance body MAY be overseeing, whether the `bridge_rate` SHOULD be increased temporarily and for what interval. However, such a mechanism impacts the security assumptions as this governance body also would have to adhere to stringent security requirements and a compromise of the governance body could effectively disable the rate limitation. Also the above mentioned Crypto-economic security guarantees do not hold any longer. + + +##### 3. Relayer key protection + +The relayer shall maximize security measurements to protect its keys. For example, it SHOULD implement a multi-signature scheme to sign its messages, as is proposed in [MIP-21](https://github.com/movementlabsxyz/MIP/pull/21). The owners of the constituent keys should be distinct entities with distinct access to their keys. + +[This article](https://medium.com/@j2abro/a-visual-guide-to-blockchain-bridge-security-e982fec671a7) describes some of the considerations that have to be taken into account: + + **Multisigs**: + > It’s likely that the bridge is controlled by one or more multisigs —wallets that require multiple individuals to sign before a transaction is executed. Multisigs add an element of security by ensuring that a single signer can’t control the bridge. Multisigs might be used to enable the bridge contracts to be upgraded or paused. While multisigs are an essential security control for bridges, they are not foolproof and require proper management. In fact multisigs have been targeted in some major bridge exploits. + +**Contract Exploits**: +> Multisigs are implemented as smart contracts and are thus potentially vulnerable to exploits. Many of the popular multisig contracts have been used to store billions in assets over time and are somewhat battle tested. Nonetheless, these contracts do represent additional attack surface. + +**Signers are People**: +> Multisigs are controlled by a group of signers; you must trust that the private keys of those signers are kept secure. Any individual that is a singer on a multisig must be trusted to not be an adversary of course, but also must be trusted to adhere to basic security practices. Multisig signers are ripe targets for phishing and malware attacks. + +## Reference Implementation + + + +## Verification + +##### 1. Fix the Potential Supply + +Since the maximal released supply of `$L1MOVE` is `MOVE_MAX` the maximum *Potential Supply* (of the sum of the supply of `$L1MOVE` and `$L2MOVE`) is 2 $\times$ `MOVE_MAX`, even in the case of a compromised relayer and a maximum exploit. + +##### 2. Native Bridge rate limitation + + +Eigenlayer AVS does suggest a similar model and provides the following Definition on Strong Economic Security in their [white paper (EIGEN: The Universal Intersubjective Work Token)](https://docs.eigenlayer.xyz/assets/files/EIGEN_Token_Whitepaper-0df8e17b7efa052fd2a22e1ade9c6f69.pdf): + +> *Formal Definition of Strong Cryptoeconomic Security* +If [a bridge] acquires more [cryptoeconomic] security than the harm it can suffer from an attack within the interval $T_{redeem}$ slots, then it achieves strong cryptoeconomic security, i.e.
+>         *[Economic]-security ≥ Harm-from-corruption [..] in $T_{redeem}$ slots* + +> [..] consider a [..] bridge [..] for a rollup, which has a $(X, T)$-rate-limit [..]. Now if [$T + +Needs discussion. + +--- +## Reference Implementation + +The `governed_gas_pool.move` would interact with `aptos_framework.move`, seperating the roles of actual governance, voting and storing of gas and dispersing those funds. + +## Errata + + +## Appendix + +--- +## Copyright + +Copyright and related rights waived via [CC0](../LICENSE.md).