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

Patch/chains missing gov #38

Merged
merged 2 commits into from
Jan 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
"https://cosmos-lcd.quickapi.com:443",
]

NETWORKS_NO_GOV_MODULE = [
"noble",
"nobletestnet",
]

# Global variables to store the data for mainnets and testnets
MAINNET_DATA = []
TESTNET_DATA = []
Expand Down Expand Up @@ -136,7 +141,7 @@ def is_endpoint_healthy(endpoint):
# some chains dont implement the /health endpoint. Should we just skip /health and go directly to the below?
if response.status_code == 501:
response = requests.get(
f"{endpoint}/cosmos/gov/v1beta1/proposals?proposal_status=2",
f"{endpoint}/cosmos/base/tendermint/v1beta1/node_info",
timeout=1,
verify=False,
)
Expand Down Expand Up @@ -568,19 +573,43 @@ def fetch_data_for_network(network, network_type, repo_path):

if current_endpoint in SERVER_BLACKLIST:
continue

active_upgrade_check_failed = False
upgrade_plan_check_failed = False
try:
if network in NETWORKS_NO_GOV_MODULE:
raise Exception("Network does not have gov module")
(
active_upgrade_name,
active_upgrade_version,
active_upgrade_height,
) = fetch_active_upgrade_proposals(current_endpoint, network, network_repo_url)

except:
(
active_upgrade_name,
active_upgrade_version,
active_upgrade_height,
) = (None, None, None)
active_upgrade_check_failed = True

try:
(
current_upgrade_name,
current_upgrade_version,
current_upgrade_height,
current_plan_dump,
) = fetch_current_upgrade_plan(current_endpoint, network, network_repo_url)
except:
(
current_upgrade_name,
current_upgrade_version,
current_upgrade_height,
current_plan_dump,
) = (None, None, None, None)
upgrade_plan_check_failed = True

if active_upgrade_check_failed and upgrade_plan_check_failed:
if index + 1 < len(healthy_rest_endpoints):
print(
f"Failed to query rest endpoints {current_endpoint}, trying next rest endpoint"
Expand All @@ -592,6 +621,12 @@ def fetch_data_for_network(network, network_type, repo_path):
)
break

if active_upgrade_check_failed and network not in NETWORKS_NO_GOV_MODULE:
print(
f"Failed to query active upgrade endpoint {current_endpoint}, trying next rest endpoint"
)
continue

if (
active_upgrade_version
and (active_upgrade_height is not None)
Expand Down
Loading