graphprotocol / graph-node

Graph Node indexes data from blockchains such as Ethereum and serves it over GraphQL
https://thegraph.com
Apache License 2.0
2.91k stars 978 forks source link

CallHandler: Doesn't work for function with tuple arguments #1668

Closed samparsky closed 4 years ago

samparsky commented 4 years ago

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

What is the current behavior? CallHanlders doesn't work with tuple arguments. A call handler for a function with tuple arguments doesn't get invoked

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

contract Test {
  struct Check {
     uint param;
  }
  function test(Check memory check) {

  }
}

subgraph.yaml

specVersion: 0.0.2
description: AdEx Protocol subgraph
schema:
  file: ./schema.graphql

dataSources:
  ...
  callHandlers:
        - function: test(tuple)
          handler: handleTest

The handleTest handler doesn't ever get invoked

What is the expected behavior?

The handleTest handler should get invoked

Jannis commented 4 years ago

Tuples are represented as tuples of their field types, e.g. (uint256,bytes32), so (assuming it's supposed to be uint param, not unit param), the manifest should look as follows:

callHandlers:
  - function: test((uint256))
    handler: handleTest
samparsky commented 4 years ago

I already tried using it but yarn build errors anytime I try it

callHandlers:
  - function: test((uint256))
    handler: handleTest

The error from yarn build

 Call function with signature 'test((uint256))' not present in ABI 'Test'.
  Available call functions:
  - test(tuple)
Jannis commented 4 years ago

Duplicate of #1800. (I've renamed that one to include both event and call handlers).