Skip to content
This repository has been archived by the owner on Aug 17, 2021. It is now read-only.

SIP-167 - Minor amendments to improve wording consistency #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
45 changes: 24 additions & 21 deletions content/sips/sip-167.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -14,7 +14,7 @@ created: 2021-07-13

<!--"If you can't explain it simply, you don't understand it well enough." Simply describe the outcome the proposed changes intends to achieve. This should be non-technical and accessible to a casual community member.-->

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).

Choose a reason for hiding this comment

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

missing a space


## Abstract

Expand All @@ -26,7 +26,7 @@ This SIP proposes the addition of a bridge to connect L2 contracts to an L1 Gnos

<!--This is the problem statement. This is the *why* of the SIP. It should clearly explain *why* the current state of the protocol is inadequate. It is critical that you explain *why* the change is needed, if the SIP proposes changing how something is calculated, you must address *why* the current calculation is inaccurate or wrong. This is not the place to describe how the SIP will address the issue!-->

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

Expand Down Expand Up @@ -73,8 +73,9 @@ From the three options the chosen one is the 3rd which, based on Gnosis Safe in
### Technical Specification

<!--The technical specification should outline the public API of the changes proposed. That is, changes to any of the interfaces Synthetix currently exposes or the creations of new ones.-->

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

Expand All @@ -93,27 +94,26 @@ 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).

The setup comprises deploying the two new contracts (one per network), linking them, and transferring the ownership of protected contracts on L2 to the relay contract on Optmism.

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

<!--Test cases for an implementation are mandatory for SIPs but can be included with the implementation..-->
Expand All @@ -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
Expand All @@ -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

Expand Down