DEPLOYING SUBGRAPHS

WHO: Any contributor can update code and create PRs. Safe signers can deploy and publish new version to the network.

HOW OFTEN: As Needed.

Key Considerations

☢️☢️ DANGER ZONE ☢️☢️

Because these subgraphs are deep in the foundation of the DAOhaus protocol, changes can reverberate throughout the SDK and all apps built with it, so we need to be careful when making updates. It's usually best not to make subgraph code changes unless absolutely necessary. If you do make changes, all side effects should be assessed and tested before propagating throughout the protocol! Deployment to non-test subgraphs should happen all at the same time. The SDK and apps are making the same queries, so if a change happens in one subgraph and a query is updated, it'll break in the subgraph that isn't deployed.

Dangerous changes include

  • Removing fields that the SDK or apps might be relying on
  • Changing field types

Safer changes include

  • Adding fields or tables

HOW TO

Prepare

So you've made your subgraph code changes, tested and are ready to deploy?

You first should familiarize yourself with the deployment docs The Graph provides. (opens in a new tab)

Graph tooling installation instructions are here (opens in a new tab) - make sure to install the Graph CLI.

npm install -g @graphprotocol/graph-cli

Step 1: Authenticate into the studio and get the DEPLOY KEY

You will need to sign into the subgraph studio with the safe that owns the account. To do this you need to be a signer on that safe.

Visit the studio here (opens in a new tab)

Connect with the Arbitrum safe that owns the account: 0x08678A8d65D8d81bD13db617211F1E9CE176B2fB

When connected the dashboard will look like this:

Then you can click into one of the subgraphs to find the DEPLOY KEY. Save that to use later.

Also note the name and current version of each subgraph so you can bump that when you deploy.

Step 2: Prepare and deploy subgraph code

The Graph CLI generates and builds all the code needed for deployment. This will need to be done in order for each network.

  • generate subgraph.yaml
nx run moloch-v3-subgraph:generate-config --network=mainnet
  • generate/build code
nx run moloch-v3-subgraph:generate-code
  • deploy code - you need to use the subgraph name here (seen in the urls from the dashboard) and bump the version number you looked at for each network here.
nx run moloch-v3-subgraph:graph-deploy-studio --name=daohaus-v3 --network=mainnet --semver=0.6.9
  • Successful output:

Repeat for the other networks. Note the config generation step uses the name 'xdai' while the studio deployment uses the name 'gnosis'.

Command cheat sheet for copy and paste here (opens in a new tab)

Step 3: Publish the new version in the studio

Note that as of writing this we only need to do this step on Mainnet and Gnosis. The Base subgraph doesn't require publishing just yet.

Go back to the studio dashboard and navigate to your subgraph and select the new version.

Use the publish button and initiate the publishing transaction. Select the Arbitrum network in the publish form.

This will create a proposal in the safe that will publish once signed by enough safe owners and executed.