From 76da4a76bfafd94c18010cab09a5051d0e0908f7 Mon Sep 17 00:00:00 2001 From: i-stam Date: Mon, 16 Aug 2021 15:46:55 -0500 Subject: [PATCH] Minor fixes --- content/sips/sip-167.md | 45 ++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/content/sips/sip-167.md b/content/sips/sip-167.md index 984bcc8c..3c2ed223 100644 --- a/content/sips/sip-167.md +++ b/content/sips/sip-167.md @@ -1,7 +1,7 @@ --- sip: 167 title: L2 Bridged Governance -status: Approved +status: Vote_Pending author: Leonardo Massazza (@leomassazza), Alejandro Santander (@ajsantander) discussions-to: https://research.synthetix.io/t/l2-bridged-governance/443 @@ -14,7 +14,7 @@ created: 2021-07-13 -Add the ability to govern L2 contracts with a MultiSig (Gnosis Safe) contract instead of using EOA (Externally Owned Account). +Add the ability to govern L2 contracts with a MultiSig (Gnosis Safe) contract instead of using anEOA (Externally Owned Account). ## Abstract @@ -26,7 +26,7 @@ This SIP proposes the addition of a bridge to connect L2 contracts to an L1 Gnos -Currently L2 contracts are owned by EAO which poses a risk on ownership and security. The proposed SIP allows a contract or MultiSig to own L2 contracts and enable proper council governance. +Currently L2 contracts are owned by an EOA which poses a risk on ownership and security. The proposed SIP allows a contract or MultiSig to own L2 contracts and enable proper council governance. ## Specification @@ -73,8 +73,9 @@ From the three options the chosen one is the 3rd which, based on Gnosis Safe in ### Technical Specification + The proposal includes the creation of two new governance contracts that will act as bridges (OwnerRelayOnEthereum.sol and OwnerRelayOnOptimism.sol) and extend the ownwership from L1 to L2. -**OwnerRelayOnEthereum** is owned by the Gnosis safe contract, staged transations on Gnosis Safe are directed to that contract, encoded with the appropriate data, and targeted to interact with the appropriate contract on L2. Once signed and executed by the ProtocolDAO, the L1 transaction will automatically relay to **OwnerRelayOnOptimism** on L2, which is the L2 owner, and will ultimately execute the commands (as owner) on behalf of the ProtocolDAO to transact on Optimism. +**OwnerRelayOnEthereum** is owned by the Gnosis Safe contract, staged transations on Gnosis Safe are directed to that contract, encoded with the appropriate data, and targeted to interact with the appropriate contract on L2. Once signed and executed by the ProtocolDAO, the L1 transaction will automatically relay to **OwnerRelayOnOptimism** on L2, which is the L2 owner, and will ultimately execute the commands (as owner) on behalf of the ProtocolDAO to transact on Optimism. #### Current process on Ethereum @@ -93,7 +94,7 @@ As can be seen in the following image, optmimism contracts are more susceptible #### Bridged process on Optimism In order to solve these issues, the proposal is to add a couple of contracts (one on each network, Ethereum and Optmism) that will be used as a bridge and link the Gnosis Safe on L1 to L2 owned contracts, named **OwnerRelayOnEthereum** and **OwnerRelayOnOptimism** respectively. -**OwnerRelayOnEthereum** will be deployed in Etherum and will be owned by the Gnosis Safe contract. It will relay the transactions data to its counterpart contract on Optimism, named OwnerRelayOnOptimism. **OwnerRelayOnOptimism** will be the owner of the owned protected contracts on L2, so that the same protection (and same mechanism to sign transactions) that exists on Ethereum is present on Optimism. +**OwnerRelayOnEthereum** will be deployed in Etherum and will be owned by the Gnosis Safe contract. It will relay the transactions data to its counterpart contract on Optimism, named **OwnerRelayOnOptimism**. **OwnerRelayOnOptimism** will be the owner of the owned protected contracts on L2, so that the same protection (and same mechanism to sign transactions) that exists on Ethereum is present on Optimism. The bridged governance solution proposed is based on [CrossChainAccount technique](https://github.com/gakonst/xchain-account/blob/master/contracts/CrossChainAccount.sol). @@ -101,19 +102,18 @@ The setup comprises deploying the two new contracts (one per network), linking t The following image shows the process to sign a transaction on L2, which can be split in the following steps: -- *1- Stage.* A CC (Core Contributor) will stage the transaction on the Gnosis safe UI/API with the encoded data to be executed on the target L2 contract. The CC will communicate to the ProtocolDAO representatives and ask them to sign the transaction. -- *2- Approve.* Once the minimum number of approvals is reached on Gnosis safe, the transaction can be executed. -- *3- Execute.* The execution means the Gnosis Safe will execute the approved transaction on the **OwnerRelayOnEthereum** contract. Up to this point, the process is the usual. -- *4- Relay.* This step is split in two (4.1 and 4.2). - - *4.1- Relay L1.* The L1 part of the relay consists on sending a transaction to the Optimism Messenger from the Ethereum network that will relay it to the Optimism network. The target for this transaction is the relay counterpart on L2 (OwnerRelayOnOptimism). - - *4.2- Relay on L2.* After 5 to 8 minutes, when the transaction is relayed by the Optimism messenger to L2, the transaction will be received by OwnerRelayOnOptimism. -- *5- Execute.* This is actually the execution of the staged transaction on Gnosis Safe, but on a protected contract on L2. +- _1- Stage._ A CC (Core Contributor) will stage the transaction on the Gnosis safe UI/API with the encoded data to be executed on the target L2 contract. The CC will communicate to the ProtocolDAO representatives and ask them to sign the transaction. +- _2- Approve._ Once the minimum number of approvals is reached on Gnosis Safe, the transaction can be executed. +- _3- Execute._ The execution means the Gnosis Safe will execute the approved transaction on the **OwnerRelayOnEthereum** contract. Up to this point, the process is the usual. +- _4- Relay._ This step is split in two (4.1 and 4.2). + - _4.1- Relay L1._ The L1 part of the relay consists on sending a transaction to the Optimism Messenger from the Ethereum network that will relay it to the Optimism network. The target for this transaction is the relay counterpart on L2 (**OwnerRelayOnOptimism**). + - _4.2- Relay on L2._ After 5 to 8 minutes, when the transaction is relayed by the Optimism messenger to L2, the transaction will be received by **OwnerRelayOnOptimism**. +- _5- Execute._ This is actually the execution of the staged transaction on Gnosis Safe, but on a protected contract on L2. ![Bridged L2 Case](assets/sip-167/l1_and_l2.png) As it can be seen on the descriptions, the first steps (human involved process, from 1 to 3) are the same for signing transactions on L1 and L2, the only difference is on how to set the data and target on the staged transaction. The rest of the process is fully automated. - ### Test Cases @@ -122,17 +122,19 @@ As it can be seen on the descriptions, the first steps (human involved process, Two new unit tests are added to test the two new contracts. These tests will mock the required external interfaces (i.e. opt messenger). -For OwnerRelayOnEthereum +For **OwnerRelayOnEthereum** + - It reverts transactions coming from a non-owner address - It can initiate a relay transaction to L2 - It emits an event when the transaction is relayed to the Opt. Messenger -- The data, target relayed are right -- The CrossDomainGasLimit is set to the desired value -- The CrossDomainGasLimit is set to the DEFAULT value is set to 0 +- The data and target relayed are right +- The CrossDomainRelayGasLimit is set to the desired value +- The CrossDomainRelayGasLimit is set to the DEFAULT value if it is set to 0 + +For **OwnerRelayOnOptimism** -For OwnerRelayOnOptimism - It reverts transactions not comming from the Optimism messenger -- It reverts transaction originated by an L1 address that is not OwnerRelayOnEthereum +- It reverts transaction originated by an L1 address that is not **OwnerRelayOnEthereum** - It can accept ownership on the target contracts on L2 - It can finalize a relay transaction from L1 - An event is emitted @@ -141,9 +143,10 @@ For OwnerRelayOnOptimism #### Integration Tests One integration test to cover the relay. Using SystemSettingsL2 as target contract on L2 and updating a setting (minimumStakeTime) + - Transfer ownership of the L2 target contract (using SystemSettingsL2) to OwnerRelayOnOptimism if still owned by an EOA. -- Try to update a setting on the target contract on L2 using a transaction initiated in L1 (we are not using a Gnosis Safe account as owner of OwnerRelayOnEthereum, but an EOA) and revert the change to the original value. -- Relinquish ownership of the target contract and transfer it back to a EOA. +- Try to update a setting on the target contract on L2 using a transaction initiated in L1 (we are not using a Gnosis Safe account as owner of **OwnerRelayOnEthereum**, but an EOA) and revert the change to the original value. +- Relinquish ownership of the target contract and transfer it back to an EOA. #### Manual Tests