Skip to content

Incorrect entities in DB #600

@bohendo

Description

@bohendo

Do you want to request a feature or report a bug?
Bug

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

Transaction 0x53e7d9ce8d9c032e87b15310cc74ec46a2e5e085ced2bf8333b60b7f1aecd768 makes a good case study of this problem. You'll see from the event logs that this proposal's id is "0x2c766d6d269d8cef520aeaf4e78bed2db4cb59ed07330e203dcafe50f4a637f1"

The mappings that generated this data can be found here but the most interesting file are probably the GenesisProtocol handlers and the schema.

The above source code should compile to a subgraph that can be found at /ipfs/QmQ1rhZhZQeSm4mgR8Bnii6xq7efBFqMXpd82cNLZq7Hhh, the same subgraph that's in the subgraph column of the db row displayed below.

Running a query to fetch this proposal's data in the database returns:

$ select data from entities where entity = 'Proposal' and id = '0x2c766d6d269d8cef520aeaf4e78bed2db4cb59ed07330e203dcafe50f4a637f1';

{
  "id": {
    "data": "0x2c766d6d269d8cef520aeaf4e78bed2db4cb59ed07330e203dcafe50f4a637f1",
    "type": "String"
  },
  "dao": {
    "data": "0xa3f5411cfc9eee0dd108bf0d07433b6dd99037f1",
    "type": "String"
  },
  "time": {
    "data": "1542255067",
    "type": "BigInt"
  },
  "type": {
    "data": "genesisProtocolBounty",
    "type": "String"
  },
  "state": {
    "data": 3,
    "type": "Int"
  },
  "voter": {
    "data": "0xf47c189056ab295854e4752f3dc61e1800793d56e500a97efabd1e281ddbd1c1",
    "type": "String"
  },
  "amount": {
    "data": "75000000000000000000",
    "type": "BigInt"
  },
  "staker": {
    "data": "0xf47c189056ab295854e4752f3dc61e1800793d56e500a97efabd1e281ddbd1c1",
    "type": "String"
  },
  "account": {
    "data": "0xd04120c5ed3c1d141a40fcec9ea37a4828efbd73ba259cdfa9e1818133942808",
    "type": "String"
  },
  "address": {
    "data": "0xda666fb849cfa3c44540c9a8897a49dea7e74d83",
    "type": "Bytes"
  },
  "decision": {
    "data": "1",
    "type": "BigInt"
  },
  "proposal": {
    "data": "0xa8b21f86775c02be6ed8a4c967a5006b9829ad347355c51a8ea30d8d4a1f894a",
    "type": "String"
  },
  "proposer": {
    "data": "0xf47c189056ab295854e4752f3dc61e1800793d56e500a97efabd1e281ddbd1c1",
    "type": "String"
  },
  "accountId": {
    "data": "0xa31e62d6af4041f9fc992ec8d6cda68a6e74482b0c2d59204f9f8c4c64f87ca5",
    "type": "String"
  },
  "__typename": {
    "data": "Proposal",
    "type": "String"
  },
  "paramsHash": {
    "data": "0x5f0497643ffca224e98f82826ef3ba0d4ffd90358c3230a55e26c1923a564510",
    "type": "Bytes"
  },
  "prediction": {
    "data": "1",
    "type": "BigInt"
  },
  "proposalId": {
    "data": "0x2c766d6d269d8cef520aeaf4e78bed2db4cb59ed07330e203dcafe50f4a637f1",
    "type": "String"
  },
  "reputation": {
    "data": "0",
    "type": "BigInt"
  },
  "voteOption": {
    "data": "1",
    "type": "BigInt"
  },
  "stakeAmount": {
    "data": "50000000000000000000",
    "type": "BigInt"
  },
  "numOfChoices": {
    "data": "2",
    "type": "BigInt"
  },
  "executionTime": {
    "data": "1542257912",
    "type": "BigInt"
  },
  "submittedTime": {
    "data": "1542257064",
    "type": "BigInt"
  }
}

You'll notice that this Proposal entity also contains fields that belong to the Vote & Stake entities. Further, if you compare this data to the raw event data you'll see that the proposer is incorrect.

Explore this graphql API further yourself on my staging server

These mappings have been synced onto fresh databases on two different servers (the other one is here) and the results on both is the same.

This may be unrelated but at the same point that I started noticing this issue, I also started seeing errors fill my graphiql UIs console that repeat the following many times.

Name "__typename" must not begin with "__", which is reserved by GraphQL introspection.

I'm using graph-ts and graph-cli v0.4.1 and running docker image graphprotocol/graph-node:latest (I won't know the exact version associated w this particular "latest" image until issue #591 is resolved)

Thank you for your time.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions