I think I found the reason of the subgraph crash (some null checks?), but that's not the problem now, the problem is to be able to build the subgraph... even without modifying anything I get this apiVersion error:
Error: The current version of graph-cli can't be used with mappings on apiVersion less than '0.0.5'
then, changing the subgraph yaml template to api version 0.0.5 I get this assemblyscript error, I've tried installing different versions, dependencies... can't get rid of it (edit: looks like there are breaking changes in apiVersion 0.0.5, and apiVersion is enforced by the nodes? i tried to refactor things (but maybe we just need to spend some time to do it properly, according to this migration guide, its just a bit sad that we have to spend time on an old project like this):
right now, having this ugly assemblyscript error:
kemuru@kemurus-MacBook-Air proof-of-humanity-web % npm run deploy:graph:mainnet
> @kleros/components@1.0.0-beta.4 deploy:graph:mainnet
> npm run build:graph:mainnet && cd subgraph && graph deploy --studio poh
> @kleros/components@1.0.0-beta.4 build:graph:mainnet
> cd subgraph && mustache config/mainnet.json subgraph.template.yaml > subgraph.yaml && graph codegen && graph build
Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2
Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3
Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4
Skip migration: Bump mapping apiVersion from 0.0.4 to 0.0.5
Skip migration: Bump mapping apiVersion from 0.0.5 to 0.0.6
Skip migration: Bump manifest specVersion from 0.0.1 to 0.0.2
Apply migration: Bump manifest specVersion from 0.0.2 to 0.0.4
✔ Apply migrations
✔ Load subgraph from subgraph.yaml
Load contract ABI from abis/proof-of-humanity.json
Load contract ABI from abis/proof-of-humanity.json
Load contract ABI from abis/kleros-liquid.json
✔ Load contract ABIs
Generate types for contract ABI: ProofOfHumanity (abis/proof-of-humanity.json)
Write types to generated/ProofOfHumanity/ProofOfHumanity.ts
Generate types for contract ABI: ProofOfHumanity (abis/proof-of-humanity.json)
Write types to generated/KlerosLiquid/ProofOfHumanity.ts
Generate types for contract ABI: KlerosLiquid (abis/kleros-liquid.json)
Write types to generated/KlerosLiquid/KlerosLiquid.ts
✔ Generate types for contract ABIs
✔ Generate types for data source templates
✔ Load data source template ABIs
✔ Generate types for data source template ABIs
✔ Load GraphQL schema from schema.graphql
Write types to generated/schema.ts
✔ Generate types for GraphQL schema
Types generated successfully
Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2
Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3
Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4
Skip migration: Bump mapping apiVersion from 0.0.4 to 0.0.5
Skip migration: Bump mapping apiVersion from 0.0.5 to 0.0.6
Skip migration: Bump manifest specVersion from 0.0.1 to 0.0.2
Skip migration: Bump manifest specVersion from 0.0.2 to 0.0.4
✔ Apply migrations
✔ Load subgraph from subgraph.yaml
Compile data source: ProofOfHumanity => build/ProofOfHumanity/ProofOfHumanity.wasm
⠋ Compile subgraph
▌ Whoops, the AssemblyScript compiler has crashed during compile :-(
▌
▌ Here is the stack trace hinting at the problem, perhaps it's useful?
▌
▌ AssertionError: assertion failed
▌ at i.assert (/Users/kemuru/repos/proof-of-humanity-web/node_modules/assemblyscript/dist/assemblyscript.js:7:765506)
▌ at f.compileBinaryOverload (/Users/kemuru/repos/proof-of-humanity-web/node_modules/assemblyscript/dist/assemblyscript.js:7:280159)
▌ at f.compileBinaryExpression (/Users/kemuru/repos/proof-of-humanity-web/node_modules/assemblyscript/dist/assemblyscript.js:7:254896)
▌ at f.compileExpression (/Users/kemuru/repos/proof-of-humanity-web/node_modules/assemblyscript/dist/assemblyscript.js:7:245493)
▌ at f.compileIfStatement (/Users/kemuru/repos/proof-of-humanity-web/node_modules/assemblyscript/dist/assemblyscript.js:7:236460)
▌ at f.compileStatement (/Users/kemuru/repos/proof-of-humanity-web/node_modules/assemblyscript/dist/assemblyscript.js:7:230864)
▌ at f.compileStatements (/Users/kemuru/repos/proof-of-humanity-web/node_modules/assemblyscript/dist/assemblyscript.js:7:231714)
▌ at f.doCompileForStatement (/Users/kemuru/repos/proof-of-humanity-web/node_modules/assemblyscript/dist/assemblyscript.js:7:235400)
▌ at f.compileForStatement (/Users/kemuru/repos/proof-of-humanity-web/node_modules/assemblyscript/dist/assemblyscript.js:7:234395)
▌ at f.compileStatement (/Users/kemuru/repos/proof-of-humanity-web/node_modules/assemblyscript/dist/assemblyscript.js:7:230749)
▌
▌ If it refers to the dist files, try to 'npm install source-map-support' and
▌ run again, which should then show the actual code location in the sources.
▌
▌ If you see where the error is, feel free to send us a pull request. If not,
▌ please let us know: https://github.com/AssemblyScript/assemblyscript/issues
▌
▌ Thank you!
✖ Failed to compile subgraph: Failed to compile data source mapping: The AssemblyScript compiler crashed when compiling this file: 'src/mapping.ts'
Suggestion: try to comment the whole file and uncomment it little by little while re-running the graph-cli until you isolate the line where the problem happens.
Also, please contact us so we can make the CLI better by handling errors like this. You can reach out in any of these links:
- Discord channel: https://discord.gg/eM8CA6WA9r
- Github issues: https://github.com/graphprotocol/graph-tooling/issues/new/choose
Error: Failed to compile data source mapping: The AssemblyScript compiler crashed when compiling this file: 'src/mapping.ts'
Suggestion: try to comment the whole file and uncomment it little by little while re-running the graph-cli until you isolate the line where the problem happens.
Also, please contact us so we can make the CLI better by handling errors like this. You can reach out in any of these links:
- Discord channel: https://discord.gg/eM8CA6WA9r
- Github issues: https://github.com/graphprotocol/graph-tooling/issues/new/choose
at Compiler._compileDataSourceMapping (/Users/kemuru/repos/proof-of-humanity-web/node_modules/@graphprotocol/graph-cli/dist/compiler/index.js:249:19)
at /Users/kemuru/repos/proof-of-humanity-web/node_modules/@graphprotocol/graph-cli/dist/compiler/index.js:201:167
at updateInDeeply (/Users/kemuru/repos/proof-of-humanity-web/node_modules/immutable/dist/immutable.js:2121:22)
at updateInDeeply (/Users/kemuru/repos/proof-of-humanity-web/node_modules/immutable/dist/immutable.js:2134:23)
at updateInDeeply (/Users/kemuru/repos/proof-of-humanity-web/node_modules/immutable/dist/immutable.js:2134:23)
at updateIn$1 (/Users/kemuru/repos/proof-of-humanity-web/node_modules/immutable/dist/immutable.js:2099:24)
at Map.updateIn (/Users/kemuru/repos/proof-of-humanity-web/node_modules/immutable/dist/immutable.js:2180:12)
at /Users/kemuru/repos/proof-of-humanity-web/node_modules/@graphprotocol/graph-cli/dist/compiler/index.js:201:115
at /Users/kemuru/repos/proof-of-humanity-web/node_modules/immutable/dist/immutable.js:3321:30
at List.withMutations (/Users/kemuru/repos/proof-of-humanity-web/node_modules/immutable/dist/immutable.js:2367:5)
additionally Martin said that he had problems with toHexString() on v2, and that we could try to change those to toHex()
I think I found the reason of the subgraph crash (some null checks?), but that's not the problem now, the problem is to be able to build the subgraph... even without modifying anything I get this apiVersion error:
Error: The current version of graph-cli can't be used with mappings on apiVersion less than '0.0.5'
then, changing the subgraph yaml template to api version 0.0.5 I get this assemblyscript error, I've tried installing different versions, dependencies... can't get rid of it (edit: looks like there are breaking changes in apiVersion 0.0.5, and apiVersion is enforced by the nodes? i tried to refactor things (but maybe we just need to spend some time to do it properly, according to this migration guide, its just a bit sad that we have to spend time on an old project like this):
right now, having this ugly assemblyscript error:
additionally Martin said that he had problems with
toHexString()
on v2, and that we could try to change those totoHex()