unlock icon indicating copy to clipboard operation
unlock copied to clipboard

Missing data on querying subgraph

Open searchableguy opened this issue 2 years ago • 2 comments

Describe the bug

When you try to grab the totalSupply and maxNumberOfKeys, you will get 0 and null respectively.

This is on Rinkeby and the Unlock Rinkeby Subgraph here — https://thegraph.com/hosted-service/subgraph/unlock-protocol/unlock-rinkeby?selected=playground

To Reproduce Steps to reproduce the behavior:

  1. Go to unlock subgraph on thegraph explorer
  2. Run below query
{
  locks(where : {address: "0xDea369C7Dd7CaC10267516C3CAc47a41B610D41E"}){
    id,
    name,
    price,
    expirationDuration,
    totalSupply,
    maxNumberOfKeys,
    keys(where:{owner:"0xbe14c2f410ec78b64cbd54f72081533cb392a3d1"}){
      id,
      keyId
    },
    owner,
    version
  }
}
  1. Check for totalSupply and maxNumberOfKeys. Those will be 0 and null.

Expected behavior Proper values for totalSupply and maxNumberOfKeys

I'm not sure if this happens on other subgraph as well. We should confirm it.

searchableguy avatar Mar 22 '22 06:03 searchableguy

Adding a few more details:

  • The issue does appear to be on mainnet as well.
  • totalSupply looks like it always equals 0. This query returns empty:
{
  locks(where :{totalSupply_gt : 0}){
    id,
    name,
    totalSupply,
    maxNumberOfKeys,
    version
  }
}
  • maxNumberOfKeys : null for lock contracts version 7 and greater. This query also returns empty:
{
  locks(where :{maxNumberOfKeys_not : null, version_gt : 6}){
    id,
    name,
    totalSupply,
    maxNumberOfKeys,
    version
  }
}

cgigl avatar Mar 22 '22 13:03 cgigl

I can't say this with any degree of certainty as I have no idea how the subgraph is deployed, but the maxNumberOfKeys issue may be a simple fix. Looking at lockProcessing.ts, the processv7 function appears to be missing this line from processPreV7:

lock.maxNumberOfKeys = chainPublicLock.maxNumberOfKeys()

so maxNumberOfKeys is never set. If that's the case, would make sense why it's returning null

cgigl avatar Mar 22 '22 18:03 cgigl

We now have a MUCH better subgraph infrastructure/backbone https://unlock-protocol.com/blog/subgraph-v2 which means it will now be MUCH easier to add missing fields...

julien51 avatar Oct 05 '22 17:10 julien51

Awesome, thanks @julien51 ! I noticed this the other day and it's in our queue to use the updated version. I'll let you know if we run into issues. Sincerely appreciate it.

cgigl avatar Oct 05 '22 19:10 cgigl

Closing as I believe we now have the missing fields!

julien51 avatar Jan 22 '23 00:01 julien51