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.89k stars 959 forks source link

Event with the signature not found [Bug] #5171

Closed AlcibiadesCleinias closed 5 months ago

AlcibiadesCleinias commented 7 months ago

Bug report

We have an event: event EffectorInfoSet(CIDV1 indexed id, string description, CIDV1 metadata); that could be represent as EffectorInfoSet((indexed bytes4,bytes32),string,(bytes4,bytes32)) and on execution stage graph node tracebacks:

Jan 29 09:32:31.683 ERRO Subgraph failed with non-deterministic error: failed to process trigger: block #23 (0x53a8…7ed8), transaction 5180c04e7375176342409088c838aa2f6cbd7c6c34a8e0edfafdf43e760d4d86: Event with the signature "EffectorInfoSet((indexed bytes4,bytes32),string,(bytes4,bytes32))" not found in contract "Market" of data source "Market", retry_delay_s: 142, attempt: 0, sgd: 3, subgraph_id: QmR8bdw6cnAF74UwdcECZtmDcq3wwCUzHAkx7gbwVZe9BA, component: SubgraphInstanceManager

if I replace this event with event EffectorInfoSetButNotTuple(uint indexed foo, CIDV1 id, string description, CIDV1 metadata); that resolved into EffectorInfoSetButNotTuple(indexed uint256,(bytes4,bytes32),string,(bytes4,bytes32)) it works as expected.

Versions:

I use docker: graphprotocol/graph-node:v0.33.0

I also tested on graph-node:v0.34.0

a little bit later I will send a branch with this workaround

Relevant log output

No response

IPFS hash

-

Subgraph name or link to explorer

-

Some information to help us out

OS information

Linux

Reproduce

  1. checkout to this version: https://github.com/fluencelabs/deal/tree/9b6c088a7462efb95c50868a36659dd49d71d848
  2. boot contracts and subgraph: docker compose -f docker/docker-compose.yml up -d
  3. run forge commands to deploy contracts and sync subgraph and deploy: make deploy-local && make build-npms && make start-local-subgraph
  4. Use create pure market (It triggers the problem in EffectorInfoSet) via: make create-pure-market-local

To resolve

checkout to this branch: https://github.com/fluencelabs/deal/tree/graphprotocol-5171 where I changed EffectorInfoSet to EffectorInfoSetButNotTuple and you could use Reproduce steps to check that everything is going as expected

this is a diff of the resolve: https://github.com/fluencelabs/deal/compare/fix/related-to-CHAIN-279...graphprotocol-5171?expand=1

incrypto32 commented 7 months ago

@AlcibiadesCleinias Do you have testnet deployed version of these subgraphs, its been hard to reproduce this with a local graph-node running into issues with contracts.

AlcibiadesCleinias commented 6 months ago

@AlcibiadesCleinias Do you have testnet deployed version of these subgraphs, its been hard to reproduce this with a local graph-node running into issues with contracts.

hi, thank you for assigning.

So, I deployed subgraph to hosted service on Mumbai: https://thegraph.com/explorer/subgraph/alcibiadescleinias/fluence-deal-contracts

subgraph.yaml:

specVersion: 0.0.5
description: TODO
repository: https://TODO
schema:
  file: ./schema.graphql
dataSources:
  - kind: ethereum/contract
    name: Core
    network: mumbai
    source:
      abi: Core
      address: "0x8696f76b0343141F88ECD6CDF447C2cFD280108f"
      startBlock: 46937562
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.7
      language: wasm/assemblyscript
      entities:
        - GraphNetwork
      abis:
        - name: Core
          file: ../out/Core.sol/Core.json
      eventHandlers:
        - event: Initialized(uint8)
          handler: handleInitialized
      file: ./src/mappings/core.ts
  - kind: ethereum/contract
    name: Market
    network: mumbai
    source:
      abi: Market
      address: "0xe447Aae0dDe7b19673d706F6A20BbbB290B58c8D"
      startBlock: 46937562
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.7
      language: wasm/assemblyscript
      entities:
        - Offer
        - Effector
        - Peer
        - OfferToEffector
        - ComputeUnit
        - Token
        - GraphNetwork
      abis:
        - name: Market
          file: ../out/Market.sol/Market.json
        - name: Deal
          file: ../out/Deal.sol/Deal.json
        - name: ERC20
          file: ../out/ERC20.sol/ERC20.json
        - name: Core
          file: ../out/Core.sol/Core.json
      eventHandlers:
        - event: Initialized(uint8)
          handler: handleInitialized
        - event: ProviderInfoUpdated(indexed address,string,(bytes4,bytes32))
          handler: handleProviderInfoUpdated
        - event: MarketOfferRegistered(indexed
            address,bytes32,uint256,address,(bytes4,bytes32)[],uint256,uint256)
          handler: handleMarketOfferRegistered
        - event: PeerCreated(indexed bytes32,bytes32,address)
          handler: handlePeerCreated
        - event: ComputeUnitCreated(indexed bytes32,bytes32)
          handler: handleComputeUnitCreated
        - event: MinPricePerEpochUpdated(indexed bytes32,uint256)
          handler: handleMinPricePerEpochUpdated
        - event: PaymentTokenUpdated(indexed bytes32,address)
          handler: handlePaymentTokenUpdated
        - event: EffectorAdded(indexed bytes32,(bytes4,bytes32))
          handler: handleEffectorAdded
        - event: EffectorRemoved(indexed bytes32,(bytes4,bytes32))
          handler: handleEffectorRemoved
        - event: ComputeUnitAddedToDeal(indexed bytes32,address,bytes32)
          handler: handleComputeUnitAddedToDeal
        - event: ComputeUnitRemovedFromDeal(indexed bytes32,address,bytes32)
          handler: handleComputeUnitRemovedFromDeal
      file: ./src/mappings/market.ts
  - kind: ethereum/contract
    name: DealFactory
    network: mumbai
    source:
      abi: DealFactory
      address: "0x0ED5dA5b049C42cB0F3EC92adB9375612b35Db4b"
      startBlock: 46937562
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.7
      language: wasm/assemblyscript
      entities:
        - Effector
        - Deal
        - GraphNetwork
      abis:
        - name: DealFactory
          file: ../out/DealFactory.sol/DealFactory.json
        - name: ERC20
          file: ../out/ERC20.sol/ERC20.json
        - name: Core
          file: ../out/Core.sol/Core.json
      eventHandlers:
        - event: DealCreated(indexed
            address,address,uint256,address,uint256,uint256,uint256,uint256,(bytes4,bytes32)[],(bytes4,bytes32),uint8,address[],uint256)
          handler: handleDealCreated
      file: ./src/mappings/deal-factory.ts
  - kind: ethereum/contract
    name: Capacity
    network: mumbai
    source:
      abi: Capacity
      address: "0x62EBe41480d056C6085425588Bd5B68041DE7f7e"
      startBlock: 46937562
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.7
      language: wasm/assemblyscript
      entities:
        - CapacityCommitment
        - Peer
        - SubmittedProof
        - CapacityCommitmentStatsPerEpoch
        - ComputeUnitPerEpochStats
      abis:
        - name: Capacity
          file: ../out/Capacity.sol/Capacity.json
        - name: Core
          file: ../out/Core.sol/Core.json
      eventHandlers:
        - event: Initialized(uint8)
          handler: handleInitialized
        - event: WhitelistAccessGranted(address)
          handler: handleWhitelistAccessGranted
        - event: WhitelistAccessRevoked(address)
          handler: handleWhitelistAccessRevoked
        - event: CommitmentCreated(indexed
            bytes32,bytes32,uint256,address,uint256,uint256)
          handler: handleCommitmentCreated
        - event: CommitmentActivated(indexed bytes32,indexed
            bytes32,uint256,uint256,bytes32[])
          handler: handleCommitmentActivated
        - event: CollateralDeposited(indexed bytes32,uint256)
          handler: handleCollateralDeposited
        - event: CommitmentStatsUpdated(bytes32,uint256,uint256,uint256,uint256,uint256)
          handler: handleCommitmentStatsUpdated
        - event: CommitmentRemoved(indexed bytes32)
          handler: handleCommitmentRemoved
        - event: CommitmentFinished(indexed bytes32)
          handler: handleCommitmentFinished
        - event: UnitActivated(indexed bytes32,indexed bytes32,uint256)
          handler: handleUnitActivated
        - event: UnitDeactivated(indexed bytes32,indexed bytes32)
          handler: handleUnitDeactivated
        - event: ProofSubmitted(indexed bytes32,indexed bytes32,bytes32)
          handler: handleProofSubmitted
        - event: RewardWithdrawn(indexed bytes32,uint256)
          handler: handleRewardWithdrawn
      file: ./src/mappings/capacity.ts
templates:
  - name: Deal
    kind: ethereum/contract
    network: mumbai
    source:
      abi: Deal
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.7
      language: wasm/assemblyscript
      entities:
        - Deal
        - DealToEffector
      abis:
        - name: Deal
          file: ../out/Deal.sol/Deal.json
      eventHandlers:
        - event: Deposited(uint256)
          handler: handleDeposited
        - event: Withdrawn(uint256)
          handler: handleWithdrawn
        - event: MaxPaidEpochUpdated(uint256)
          handler: handleMaxPaidEpochUpdated
        - event: AppCIDChanged((bytes4,bytes32))
          handler: handleAppCIDChanged
        - event: ComputeUnitJoined(indexed bytes32,bytes32)
          handler: handleComputeUnitJoined
        - event: ComputeUnitRemoved(indexed bytes32,bytes32)
          handler: handleComputeUnitRemoved
        - event: WorkerIdUpdated(bytes32,bytes32)
          handler: handleWorkerIdUpdated
        - event: ProviderAddedToAccessList(address)
          handler: handleProviderAddedToAccessList
        - event: ProviderRemovedFromAccessList(address)
          handler: handleProviderRemovedFromAccessList
      file: ./src/mappings/deal.ts

also, I triggered EffectorInfoSet event in the contracts

AlcibiadesCleinias commented 5 months ago

a little update from my side. We decided to change contract event signatures: https://github.com/fluencelabs/deal/pull/346.

For me, this case is not valid anymore. Moreover, I believe that kinda this error occurs when you try to use the last ethers in JS and parse for logs of such events with indexed Tuple argument

Feel free to close this issue, thank you

azf20 commented 5 months ago

Closing, but @incrypto32 let me know if you think there is something worth digging into here