Skip to content

onChainCheck crashes when chain metadata lacks an RPC endpoint #985

@MrLightspeed

Description

@MrLightspeed

Summary

If a contributor adds a new chain to networkMapping before the ethereum-lists/chains dataset includes that chain, ./gradlew onChainCheck throws a NoSuchElementException instead of skipping the on-chain validation.

Steps to reproduce

  1. Checkout master at e0794ee`.
  2. Extend networkMapping with a placeholder entry, e.g. add "demo" to 4242424242.
  3. Create tokens/demo/0x0000000000000000000000000000000000000001.json with valid metadata.
  4. Run export JAVA_HOME=$HOME/.jdks/jdk-17.0.13+11 && export PATH=$JAVA_HOME/bin:$PATH.
  5. Run ./gradlew onChainCheck -PfileToCheck=tokens/demo/0x0000000000000000000000000000000000000001.json.

Actual result

checking tokens/demo/0x0000000000000000000000000000000000000001.jsonException in thread "main" 
java.util.NoSuchElementException: Collection contains no element matching the predicate.
    at org.ethereum.lists.tokens.TokenCheckerKt.getRPC-B0vcT2Q(TokenChecker.kt:198)
    at org.ethereum.lists.tokens.TokenCheckerKt.checkTokenFile-StX6v-4(TokenChecker.kt:100)
    …

The task aborts instead of continuing with pure JSON validation.

Expected result

If no RPC endpoint exists for the chain yet, we should emit a warning and skip the RPC checks, letting the remainder of the validations finish successfully.

Environment

  • Commit: e0794ee
  • JDK: openjdk version "17.0.13" 2024-10-15 (Temurin-17.0.13+11)
  • OS: Ubuntu 22.04 (WSL)

Related PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions