Skip to content

Subgraph split signal to multiple versions #526

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

Closed
wants to merge 60 commits into from
Closed

Conversation

jona
Copy link

@jona jona commented Nov 25, 2021

Summary

When a new subgraph version is published, it burns all signal on the past deployment and mints on the new deployment. This incentivizes indexers to stop indexing the past deployment therefore causing a disruption of service. This PR seeks to fix that by splitting signal in half between both deployments and allow usage to be migrated to the new deployment.

Current Behavior

When publishNewVersion is called, signal is burned on the old deployment and signal is minted on the new deployment through the Curation contract.

Solution

  • Track the old and new deployment IDs and vSignal.
  • When publishNewVersion is called, split the signal in half between the old and new versions.
  • When mint or burn are called in the GNS contract, split the mint/burn equally amongst the versions.
  • Allow the owner to finalizeSubgraphUpgrade once the old version is no longer needed.

@abarmat
Copy link
Contributor

abarmat commented Nov 29, 2021

@jona can you add a title and a brief description to the PR? you can use #492 as an example

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.

Some partial comments, I'll keep adding as I keep reviewing

@@ -1,9 +1,9 @@
{
"compilerOptions": {
"lib": ["ES2018", "dom"],
"lib": ["ES2020", "dom"],
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this changing?

Copy link
Author

Choose a reason for hiding this comment

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

Its to allow the usage of BigInt literals in the tests

@abarmat abarmat changed the title jona/subgraph versions Subgraph split signal to multiple versions Dec 2, 2021
uint256 tokens;

// Burn signal
tokens = curation.burn(
Copy link
Contributor

Choose a reason for hiding this comment

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

In this case, can we just burn the shares for the current version to save some gas?

abarmat and others added 5 commits December 3, 2021 10:33
* curation: use a minimal proxy to save gas when minting for first time
* curation: use token utils for transfers
* tests: remove unnecessary block advance in test
* curation: add external function to set token master copy and avoid re-deploy the clone on minting reset
* chore: add graph curation master copy token to deployment config
@jona jona changed the base branch from ariel/gns-ownership to dev December 5, 2021 02:47
@codecov
Copy link

codecov bot commented Dec 5, 2021

Codecov Report

Merging #526 (0acb399) into dev (2cf753f) will increase coverage by 0.01%.
The diff coverage is 94.16%.

❗ Current head 0acb399 differs from pull request most recent head 5d6f2d2. Consider uploading reports for the commit 5d6f2d2 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #526      +/-   ##
==========================================
+ Coverage   90.60%   90.61%   +0.01%     
==========================================
  Files          35       35              
  Lines        1703     1780      +77     
  Branches      282      292      +10     
==========================================
+ Hits         1543     1613      +70     
- Misses        160      167       +7     
Flag Coverage Δ
unittests 90.61% <94.16%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
contracts/discovery/GNS.sol 88.33% <92.63%> (+1.21%) ⬆️
contracts/curation/Curation.sol 100.00% <100.00%> (ø)
contracts/curation/GraphCurationToken.sol 100.00% <100.00%> (ø)

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 a24f6a1...5d6f2d2. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants