Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI action to test endpoints from whitelisted chains and providers #5427

Merged
merged 13 commits into from
Oct 28, 2024

Conversation

pablin-10
Copy link
Contributor

@pablin-10 pablin-10 commented Oct 5, 2024

This PR adds a github action to do a simple smoke test of the RPC and LCD endpoints offered in the chain registry.

This is how it looks like:
https://github.com/pablin-10/chain-registry/actions/runs/11265464331

image
image

By now only tests providers whitelisted in the test itself:

# Set this to False to ignore the whitelist and process all providers
use_whitelist = True

# Whitelist for specific chains and providers
whitelist = {
    "chains": [
        "axelar",
        "celestia",
        "composable",
        "cosmoshub",
        "dydx",
        "dymension",
        "evmos",
        "injective",
        "neutron",
        "noble",
        "osmosis",
        "stargaze",
        "stride"
    ],
    "providers": [
        "Osmosis Foundation", 
        "Polkachu",
        "CryptoCrew",
        "forbole",
        "Imperator.co",
        "WhisperNode 🤐",
        "chainlayer",
        "Numia",
        "Enigma",
        "kjnodes",
        "Stake&Relax 🦥",
        "Allnodes ⚡️ Nodes & Staking",
        "Lava",
        "Golden Ratio Staking",
        "Stargaze Foundation",
    ]
} if use_whitelist else {'chains': [], 'providers': []}

We may configure it to run every day or every week since it may take a lot of time to run for all the chains and providers if whitelist disabled.

Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I only had minor defense-in-depth recommendations but overall LGTM!

with open(filename) as f:
data = json.load(f)
chain_name = data.get('chain_name', 'unknown')
if 'apis' in data:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be helpful to print some warnings if this condition is false in case the structure changes and we start skipping the entries.

Applies to other if statements below too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

return test_cases

test_cases = generate_endpoint_tests()
if test_cases:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this check? Is it ever expected to not pass?

Comment on lines 21 to 33
"axelar",
"celestia",
"composable",
"cosmoshub",
"dydx",
"dymension",
"evmos",
"injective",
"neutron",
"noble",
"osmosis",
"stargaze",
"stride"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to ensure that our CI passes only when all providers are processed, we could also keep a tally of the number of successful chains validated, checking that it matches the length of the whitelisted chains at the end.

Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visualization is pretty sweet

@JeremyParish69 JeremyParish69 merged commit aa950cb into cosmos:master Oct 28, 2024
4 checks passed
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.

3 participants