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

Feat/plan info in response and semantic version GitHub tag checking #19

Conversation

pharr117
Copy link
Contributor

Plan Info in Response

This PR adds the plan info object into the response.

When the "source" is current_upgrade_plan, we include the parsed upgrade plan pulled from the plan endpoint:

{
    "type": "mainnet",
    "network": "cosmoshub",
    "rpc_server": "https://cosmos-rpc.quickapi.com:443",
    "rest_server": "https://cosmoshub-api.lavenderfive.com:443",
    "latest_block_height": 16947875,
    "upgrade_found": true,
    "upgrade_name": "v12",
    "source": "current_upgrade_plan",
    "upgrade_block_height": 16985500,
    "estimated_upgrade_time": "2023-09-13T12:08:55.648530",
    "upgrade_plan": {
      "height": "16985500",
      "binaries": {
        "darwin/amd64": "https://github.com/cosmos/gaia/releases/download/v12.0.0/gaiad-v12.0.0-darwin-amd64?checksum=sha256:1b76a7b2ee9bd739cd28de6e380248f276c678d8f9cab1fc2fe17fce07389693",
        "darwin/arm64": "https://github.com/cosmos/gaia/releases/download/v12.0.0/gaiad-v12.0.0-darwin-arm64?checksum=sha256:20e81d813f942ed3114c6953016b9e24f0946b08e34f0da9c13bcb7276719130",
        "linux/amd64": "https://github.com/cosmos/gaia/releases/download/v12.0.0/gaiad-v12.0.0-linux-amd64?checksum=sha256:d67e91bda37c94f2efacba0f97bcbdb8931e9dbc457d1ce3f1e60a71d1b1b7dd",
        "linux/arm64": "https://github.com/cosmos/gaia/releases/download/v12.0.0/gaiad-v12.0.0-linux-arm64?checksum=sha256:aee279a6aedf8e83e59487c2006e72e496f73c36a882c44b3cc20969c3d237fb",
        "windows/amd64": "https://github.com/cosmos/gaia/releases/download/v12.0.0/gaiad-v12.0.0-windows-amd64.exe?checksum=sha256:7d970cd3f138b5ce8fe78a8209a5907fcfec6fb717434244010381cdd6b4cd32",
        "windows/arm64": "https://github.com/cosmos/gaia/releases/download/v12.0.0/gaiad-v12.0.0-windows-arm64.exe?checksum=sha256:b54c9c7e1c7bb36fc78cac294d86f8836e2dc02d747abc84d68062615a0512df"
      },
      "name": "v12",
      "upgraded_client_state": null
    },
    "version": "v12.0.0",
    "error": null
  }

Network Repo Tags Checking for Version

This PR adds the simple semantic-version Python package for parsing semantic versions.

This package is used in the following way:

  1. Use the codebase URL from the chain registry to pull down the current repo tags. These are cached per-repo url for 600 seconds to prevent external API throttling.
  2. Get the possible version strings from the endpoints
  3. Pass these to a semantic version checker that:
    • Finds possible semver matches between the parsed data and the network repo tags
    • Use the highest semver found in the matches

This fixes a known issue in the secret network where they are including other repo version tags in the plan description that was making the version be incorrect.

Secret now looks like this:

{
    "type": "mainnet",
    "network": "secretnetwork",
    "rpc_server": "https://secretnetwork-rpc.lavenderfive.com:443",
    "rest_server": "https://secretnetwork-api.highstakes.ch:1317/",
    "latest_block_height": 10589028,
    "upgrade_found": true,
    "upgrade_name": "v1.11",
    "source": "active_upgrade_proposals",
    "upgrade_block_height": 10615300,
    "estimated_upgrade_time": "2023-09-12T14:05:53.051747",
    "upgrade_plan": null,
    "version": "v1.11.0",
    "error": null
  }

Closes #18

@pharr117 pharr117 requested a review from danbryan September 10, 2023 20:04
@pharr117 pharr117 merged commit fa99bb5 into main Sep 10, 2023
2 checks passed
@pharr117 pharr117 deleted the feat/plan-info-in-response-and-semantic-version-github-tag-checking branch September 10, 2023 23:04
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.

Use plan name and search on repo git tags to find potential versions
2 participants