graphprotocol / graph-tooling

Monorepo for various tools used by subgraph developers.
https://thegraph.com/docs
Apache License 2.0
392 stars 209 forks source link

Indexing two smart contracts with the same tag throws an error #1722

Open marcusrein opened 2 months ago

marcusrein commented 2 months ago

Which packages are impacted by your issue?

@graphprotocol/graph-cli

Describe the issue

I am attempting to index two smart contracts on iotex-testnet.

0x0A7e595C7889dF3652A19aF52C18377bF17e027D (https://testnet.iotexscan.io/address/io1pfl9jhrc380nv54pnt6jcxph00chuqna9llsac#code)

0x45Ce3E6f526e597628c73B731a3e9Af7Fc32f5b7 (https://testnet.iotexscan.io/address/io1gh8rum6jdevhv2x88de350567l7r9adhket5q0#code)

They both have the same smart contract tag of TransparentUpgradeableProxy.

The first smart contract is added without issue. After adding the second smart contract address into the CLI, this error is thrown:

✔ Ethereum network · iotex-testnet
✔ Contract address · 0x0A7e595C7889dF3652A19aF52C18377bF17e027D
✔ Fetching ABI from Etherscan
✔ Fetching Start Block
✔ Fetching Contract Name
✔ Start Block · 27278816
✔ Contract Name · ioID Registry
✔ Index contract events as entities (Y/n) · true
  Generate subgraph
  Write subgraph to directory
✔ Create subgraph scaffold
✔ Initialize networks config
✔ Initialize subgraph repository
✔ Install dependencies with yarn
✔ Generate ABI and schema types with yarn codegen
Add another contract? (y/n):
Contract address: 0x45Ce3E6f526e597628c73B731a3e9Af7Fc32f5b7
✔ Fetching ABI from Etherscan
✔ Fetching Start Block
✔ Fetching Contract Name
✖ Failed to run codegen: Command failed: yarn codegen
- Apply migrations
  Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2
- Apply migrations
  Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3
- Apply migrations
  Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4
- Apply migrations
  Skip migration: Bump mapping apiVersion from 0.0.4 to 0.0.5
- Apply migrations
  Skip migration: Bump mapping apiVersion from 0.0.5 to 0.0.6
- Apply migrations
  Skip migration: Bump manifest specVersion from 0.0.1 to 0.0.2
- Apply migrations
  Skip migration: Bump manifest specVersion from 0.0.2 to 0.0.4
- Apply migrations
✔ Apply migrations
- Load subgraph from subgraph.yaml
✖ Failed to load subgraph from subgraph.yaml: Error in subgraph.yaml:

  Path: dataSources > 1 > name
  More than one data source named 'TransparentUpgradeableProxy', data source names must be unique.
error Command failed with exit code 1.

    Error: Command failed: yarn codegen
    - Apply migrations
      Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2
    - Apply migrations
      Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3
    - Apply migrations
      Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4
    - Apply migrations
      Skip migration: Bump mapping apiVersion from 0.0.4 to 0.0.5
    - Apply migrations
      Skip migration: Bump mapping apiVersion from 0.0.5 to 0.0.6
    - Apply migrations
      Skip migration: Bump manifest specVersion from 0.0.1 to 0.0.2
    - Apply migrations
      Skip migration: Bump manifest specVersion from 0.0.2 to 0.0.4
    - Apply migrations
    ✔ Apply migrations
    - Load subgraph from subgraph.yaml
    ✖ Failed to load subgraph from subgraph.yaml: Error in subgraph.yaml:

      Path: dataSources > 1 > name
      More than one data source named 'TransparentUpgradeableProxy', data
    source names must be unique.
    error Command failed with exit code 1.

    Code: 1
marcusmbpro@MarcussWorkMBP iotex-subgraph

Reproduction

www.thegraph.com/studio

Steps to Reproduce the Bug or Issue

See above description ⏫

Expected behavior

Both smart contracts should be able to be added to the subgraph.

Screenshots or Videos

Screenshot 2024-08-30 at 11 31 57 AM

Platform

Subgraph Manifest

No response

Subgraph GraphQL Schema

No response

Additional context

No response