Title: L2 Bridge and Protocol Deployment
Authors: Pablo Carranza Vélez firstname.lastname@example.org, Ariel Barmat email@example.com, Tomás Migone firstname.lastname@example.org
Category: Protocol Operations
This GIP proposes the deployment of The Graph contracts on Arbitrum from the latest published version.
As mentioned in GIP-0031, there is an interest in the community to move to an L2 to benefit from gas savings, and Arbitrum is thought by many to be the best candidate at this time. It is desirable to move to L2 gradually, however, as Arbitrum is still in beta and such a big protocol change is not without risks. Therefore, we’ve proposed having an experimental stage where rewards are not distributed in L2.
High Level Description
We propose a gradual move to L2 by deploying the new L2 protocol in parallel to the existing L1 deployment. Initially, this new deployment would be experimental because indexing rewards would be disabled. Eventually, governance can enable reward distribution.
The L2 network will mostly work like the existing L1 network. Most of the contracts will be deployed with no functional changes, so staking and curation can be done in the same way as in L1. To participate in the L2 network, users can move GRT to L2 using the bridge proposed in GIP-0031, though future GIPs can propose ways to facilitate migration of staked tokens or subgraphs and curated signal.
We propose deploying the L2 in 3 stages, though this GIP is only about the deployment of the first stage:
- Stage 1: Deploy a mirror of L1 contracts on Arbitrum, including an L1-L2 bridge with disabled indexing rewards. In addition to that, we propose to deploy Curation in L2 with a flattened bonding curves as explained in GIP-0039.
- Stage 2: Upgrade the protocol to support indexing rewards on L2.
- Stage 3: Add migration helpers to facilitate users moving stake, delegations and subgraphs from L1 to L2.
A similar GIP to this will be written to propose the deployments of phase 2 and 3 in the future.
This GIP propose the deployment of the updates described in GIP-0031 and GIP-0039 and giving an outline about the different stages.
Stage 1: L2 Bridge and Protocol Deployment
GIP-0031: An Arbitrum GRT Bridge
GIP-0031: Arbitrum GRT bridge
GIP-0039: Curation 1.x
GIP-0039: Curation v1.x
Stage 2: L2 Rewards
GIP-0034: The Graph Arbitrum deployment with rewards distribution using drip mechanism GIP-0034: The Graph Arbitrum deployment with a new rewards issuance and distribution mechanism
GIP-0037: The Graph Arbitrum deployment with linear reward distribution minted on L2 GIP-0037: The Graph Arbitrum deployment with linear rewards minted in L2
L1 vs L2 Contracts Changes
Most of the protocol contracts are the same as the ones deployed on Mainnet Ethereum. The only difference is that the GraphToken is upgradeable on L2 and adds a few more functions required by the L2 Bridge.
Having a functioning L2 requires the deployment of an L1-L2 Bridge that can move state over. The bridge is comprised of three contracts that are in charge of passing cross-chain messages and lock GRT. We propose deploying the L1GraphTokenGateway, Escrow and L2GraphTokenGateway and set them up as the canonical bridge for GRT. Please refer to GIP-0031 for more information.
Most of the L2 deployment can be performed using a deployer account with sufficient funds that will then transfer governance to the Council. However, certain actions require the intervention from the Council.
- Base L2 protocol contracts: deployed and configured by deployer, and then transferred to governance.
- Bridge on L2: deployed and configured by deployer, and then transferred to governance.
- Bridge on L1: deployed by deployer, configured by the Council.
The Bridge is Paused by default when deployed, the Council will send a transaction to unpause when the deployer verifies that the configuration is complete. The Council signals the acceptance of the L2 deployment by accepting ownership of the contracts and unpausing the bridge.
This document is proposing the deployment of the work described in GIP-0031 and GIP-0039.
Risks and Security Considerations
Please see the Related Work section for a full risk registry.
GIP-0031 has been audited by OpenZeppelin. You can find the audit report in the contracts repo.
The GIP-0031 code has been audited by a CodeArena bounty https://code4rena.com/contests/2022-10-the-graph-l2-bridge-contest with no critical issues found.
The updates that this GIP propose to deploy has been tested in a private testnet using Goerli and Goerli Arbitrum Nitro according to a test plan developed by Edge & Node.
We will make public both the test plan and the contingency plan describing potential risks and failure modes.
Copyright and related rights waived via CC0.