Skip to content

Replace hardcoded node IDs in info.peers.sh and document upgrade history#124

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/replace-hardcoded-node-ids
Draft

Replace hardcoded node IDs in info.peers.sh and document upgrade history#124
Copilot wants to merge 2 commits intomainfrom
copilot/replace-hardcoded-node-ids

Conversation

Copy link

Copilot AI commented Mar 7, 2026

Hardcoded validator node IDs in api/info.peers.sh silently return stale results after validator rotation. Both upgrade.json files contain past precompile upgrades with no documented rationale, leaving new operators without context.

Changes

api/info.peers.sh

  • Sources env.sh via SCRIPT_DIR pattern, consistent with other API scripts
  • Replaces hardcoded node IDs with dynamic resolution via platform.getCurrentValidators — subnet IDs (stable identifiers) replace node IDs (volatile):
get_node_ids_json() {
    local url="$1"
    local subnet_id="$2"
    curl -s -X POST --data "{...\"subnetID\": \"${subnet_id}\"...}" \
        "${url}/ext/bc/P" | jq '[.result.validators[].nodeID]'
}

SNOW_NODE_IDS=$(get_node_ids_json "${TESTNET_URL}" "${SNOW_SUBNET_ID}")
# nodeIDs now always reflects current validator set

avalanchego/configs/chains/UPGRADE_HISTORY.md (new)

Documents every entry in both upgrade.json files with rationale, execution timestamp (UTC), and outcome:

  • Testnet (Snow): Granite override (2025-11-07), temporary 20-minute contractDeployerAllowList enable→disable (2026-01-07)
  • Mainnet (Jade): contractDeployerAllowList disable (2026-01-07), explaining the genesis-era allowlist and why it was lifted

avalanchego/configs/README.md

  • Updated directory tree to include upgrade.json and UPGRADE_HISTORY.md
  • Added Precompile Configurations section with current-state table and link to UPGRADE_HISTORY.md
Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature][Medium] Replace hardcoded node IDs in peer script and document upgrade history</issue_title>
<issue_description>## Summary

Two maintainability improvements to prevent stale configuration and improve operational clarity.

Findings

1. Hardcoded node IDs in info.peers.sh will become stale

File: api/info.peers.sh, lines 10-16 and 27-29

The script has hardcoded node IDs for both Snow (testnet, 5 nodes) and Jade (mainnet, 1 node). When validators are rotated or decommissioned, this script silently returns empty or misleading results. The script also queries public Avalanche API endpoints directly rather than using the configurable env.sh, inconsistent with other API scripts.

Fix: Dynamically fetch current validators using platform.getCurrentValidators and extract node IDs, or accept node IDs as command-line arguments. Also source env.sh for consistency:

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/env.sh"

2. Upgrade.json entries lack rationale documentation

Files:

  • avalanchego/configs/chains/2oo5UvYgFQikM7KBsMXFQE3RQv3xAFFc8JY2GEBNBF1tp4JaeZ/upgrade.json
  • avalanchego/configs/chains/2PDRxzc6jMbZSTLb3sufkVszgQc2jtDnYZGtDTAAfom1CTwPsE/upgrade.json

Both files contain precompile upgrades with timestamps that have already passed. The testnet file has a complex enable-then-disable-after-20-minutes pattern for contractDeployerAllowListConfig with no inline documentation. New operators have no way to understand the purpose or outcome of these entries.

Fix: Add a companion UPGRADE_HISTORY.md in the configs directory documenting each upgrade with rationale, execution date, and outcome. Update avalanchego/configs/README.md to describe the current state of precompile configurations.

Impact

  • Peer monitoring could return stale/incorrect results after validator rotation
  • New operators face confusion when deploying nodes with undocumented past upgrades

Generated by Health Monitor with Omni</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: numbers-official <181934381+numbers-official@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace hardcoded node IDs in peer script Replace hardcoded node IDs in info.peers.sh and document upgrade history Mar 7, 2026
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.

[Feature][Medium] Replace hardcoded node IDs in peer script and document upgrade history

2 participants