Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework graph config files #572

Merged
merged 2 commits into from
May 31, 2022
Merged

Rework graph config files #572

merged 2 commits into from
May 31, 2022

Conversation

tmigone
Copy link
Contributor

@tmigone tmigone commented May 17, 2022

Motivation

The contracts repo has a configuration file (graph.config.yml) that defines deployment configuration parameters for the protocol. This file only contains mainnet configuration and it's not up to date.

We want to ensure this file matches what we have in mainnet and also we want to support multiple config files for different networks.

Changes

This PR introduces a few changes that make config files management a bit easier:

  • Use one config file per network, convention is graph.<networkName>.yml
  • Add hardhat task (update-config) that reads the on chain values of the parameters and updates the config file. The task will run for the specified network (using hardhat's --network) and update the config file you specify via --graph-config option.
  • Update comments in config files so they don't reference values that might change

For example:

# update rinkeby config
npx hardhat update-config --network rinkeby --graph-config config/graph.rinkeby.yml 

 # update mainnet config
npx hardhat update-config --network mainnet
npx hardhat update-config --network mainnet --graph-config config/graph.mainnet.yml

The task will update all init parameters that are not being read from the address book with the only exception being GraphToken > initialSupply.

Pending

  • Update rinkeby general addresses
  • Figure out if the script can update addresses in the general section (arbitrator, governor and authority).

@tmigone tmigone marked this pull request as draft May 17, 2022 19:42
@tmigone tmigone changed the title Tmigone/update config task feat: May 17, 2022
@tmigone tmigone changed the title feat: Rework graph config files May 17, 2022
@codecov
Copy link

codecov bot commented May 17, 2022

Codecov Report

Merging #572 (cb00eee) into dev (1a6e94f) will decrease coverage by 0.08%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##              dev     #572      +/-   ##
==========================================
- Coverage   90.58%   90.49%   -0.09%     
==========================================
  Files          37       35       -2     
  Lines        1795     1747      -48     
  Branches      293      290       -3     
==========================================
- Hits         1626     1581      -45     
+ Misses        169      166       -3     
Flag Coverage Δ
unittests 90.49% <ø> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
contracts/tests/testnet/GSRManager.sol
contracts/tests/testnet/GDAI.sol

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1a6e94f...cb00eee. Read the comment docs.

- add hardhat task to update config files with on chain data
- support using one config file per network

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
@tmigone tmigone force-pushed the tmigone/update-config-task branch from 1f82435 to 123ccd6 Compare May 17, 2022 20:20
Copy link
Contributor

@abarmat abarmat left a comment

Choose a reason for hiding this comment

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

Very clever to fetch config from on-chain data, it's a nice addition to the existing commands. I've just left a few notes.

"deploy-hardhat": "yarn deploy -- --network hardhat --force",
"deploy-rinkeby": "yarn deploy -- --force --network rinkeby",
"deploy-ganache-manual": "yarn deploy -- --force --network ganache",
"deploy-hardhat": "yarn deploy -- --force --network hardhat",
Copy link
Contributor

Choose a reason for hiding this comment

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

What if --graph-config is not passed? is it storing it in any place by default or just not storing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will fallback to the CLI's default defined here: https://github.com/graphprotocol/contracts/blob/tmigone/update-config-task/cli/defaults.ts#L8. It currently points to mainnet config file

// initParams: [],
// }

const curation: Contract = {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could import the ABIs JSON from the build/abi folder to avoid copying them over.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@abarmat I thought about using ABIs but how would you filter out all the stuff that's not related to init params? You'd still need to hardcode a list right?

Copy link
Contributor

Choose a reason for hiding this comment

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

@tmigone I get it, you are using the list to know what to scan, all good!

@tmigone tmigone marked this pull request as ready for review May 23, 2022 19:57
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
@tmigone tmigone requested a review from abarmat May 26, 2022 16:58
@abarmat
Copy link
Contributor

abarmat commented May 30, 2022

@tmigone is this ready to merge?

@tmigone
Copy link
Contributor Author

tmigone commented May 30, 2022

@abarmat the second commit is pending review. Not sure why Pushing a new commit didn’t invalidate the original approval

@abarmat
Copy link
Contributor

abarmat commented May 31, 2022

Oh, I see

Copy link
Contributor

@abarmat abarmat left a comment

Choose a reason for hiding this comment

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

🥇

@tmigone tmigone merged commit 5272f4a into dev May 31, 2022
abarmat added a commit that referenced this pull request Jul 13, 2022
- Add a threshold above which rewards start accruing for a subgraph (#528)
- Verify contracts with sourcify (#574)
- Add GraphCurationToken to addressbook (#575)
- Rework graph config files (#572)
abarmat added a commit that referenced this pull request Jul 13, 2022
- Add a threshold above which rewards start accruing for a subgraph (#528)
- Verify contracts with sourcify (#574)
- Add GraphCurationToken to addressbook (#575)
- Rework graph config files (#572)
@tmigone tmigone deleted the tmigone/update-config-task branch July 15, 2022 07:49
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants