Skip to content

Add chain data validation endpoint to detect cross-source inconsistencies#10

Merged
Johnaverse merged 4 commits intomainfrom
copilot/find-human-error-potential
Feb 8, 2026
Merged

Add chain data validation endpoint to detect cross-source inconsistencies#10
Johnaverse merged 4 commits intomainfrom
copilot/find-human-error-potential

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 8, 2026

Implements validation logic to detect potential data quality issues across The Graph Networks Registry, Chainlist, and Chain ID Network sources. Exposes findings via GET /validate endpoint.

Implementation

New function: validateChainData() in dataService.js

  • Analyzes all indexed chains against 6 validation rules
  • Returns errors grouped by rule type with detailed context

New endpoint: GET /validate

  • Returns validation summary and detailed error breakdown

Validation Rules

  1. Relation conflicts - Graph relations assumed authoritative; flags conflicts with chainlist isTestnet values
  2. slip44/testnet mismatch - Detects slip44=1 (testnet indicator) paired with isTestnet=false
  3. Name/tag inconsistency - Chains with "Testnet"/"Devnet" in names lacking Testnet tag
  4. Sepolia/Hoodie networks - Chains containing these keywords without L2 tag or network relations
  5. Status conflicts - Deprecated status disagreement between sources
  6. Goerli deprecation - Goerli chains not marked deprecated

Response Format

{
  "totalErrors": 86,
  "summary": {
    "rule1": 3,
    "rule2": 57,
    "rule3": 17,
    "rule4": 1,
    "rule5": 1,
    "rule6": 7
  },
  "errorsByRule": {
    "rule1_relation_conflicts": [...],
    "rule2_slip44_testnet_mismatch": [...],
    ...
  },
  "allErrors": [...]
}

Each error includes chain ID, name, error type, descriptive message, and relevant source data for context.

Original prompt

Review all 3 data source, write a function to find out any potential error for the human mistakes. Let start with

  1. Assume that the graph relations is always true, find out any conflict with other 2 sources
  2. slip44 = 1 but isTestnet =false
  3. Chain full name included Testnet/Denver but identifying as Mainnet
  4. The Chain Full name containing keywords "sepolia" or "hoodie" but not identifying as L2 or no relations with other network
  5. status of deprecated has conflict in different source
  6. find out all chains that containing keywords Goerli but not marked as deprecated

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Johnaverse Johnaverse marked this pull request as ready for review February 8, 2026 18:52
Copilot AI and others added 2 commits February 8, 2026 18:55
Co-authored-by: Johnaverse <110527930+Johnaverse@users.noreply.github.com>
Co-authored-by: Johnaverse <110527930+Johnaverse@users.noreply.github.com>
Copilot AI changed the title [WIP] Add function to identify potential human errors in data sources Add chain data validation endpoint to detect cross-source inconsistencies Feb 8, 2026
Copilot AI requested a review from Johnaverse February 8, 2026 18:59
@Johnaverse
Copy link
Copy Markdown
Owner

@copilot sorry, rules 3 keyword is Testnet or Devnet

Co-authored-by: Johnaverse <110527930+Johnaverse@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 8, 2026

@copilot sorry, rules 3 keyword is Testnet or Devnet

Updated Rule 3 to check for "Devnet" instead of "Denver". The validation now correctly identifies chains like "Nibiru devnet-3" (chain 7222). Updated in commit 80fece8.

Results: Rule 3 now detects 17 errors (up from 16), including the newly found devnet chain.

@Johnaverse
Copy link
Copy Markdown
Owner

@copilot is it included the error sources in the api response?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 8, 2026

@copilot is it included the error sources in the api response?

Yes, error sources are included in the API response. Each error includes source information in different formats:

Rule 1: graphRelation.source field shows "theGraph", and chainlistData indicates chainlist source
Rule 2: Source mentioned in message text ("chainlist" or "chains.json")
Rule 3-4: Sources implied by the validation logic (name from theGraph/chains, tags from indexed data)
Rule 5: Explicit statuses array with source field for each conflicting status
Rule 6: Source inferred from the status check across all sources

Example from Rule 1:

{
  "graphRelation": {
    "source": "theGraph"
  },
  "chainlistData": {...}
}

Example from Rule 5:

{
  "statuses": [
    {"source": "chainlist", "status": "active"},
    {"source": "chains", "status": "deprecated"}
  ]
}

@Johnaverse Johnaverse merged commit 33ded02 into main Feb 8, 2026
1 check passed
@Johnaverse Johnaverse deleted the copilot/find-human-error-potential branch February 10, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants