Upgrade Preparation
Purpose of this document
Technical instructions on preparing a protocol upgrade.
Instructions to create a new upgrade and apply it to both Alpha & Beta TesNet.
You MUST follow this PRIOR TO the MainNet Release Procedure: https://dev.poktroll.com/develop/upgrades/mainnet_release_procedure
Required Prerequisites Setup, Reading & Knowledge
Ensure you've read and understood When is a Protocol Upgrade Needed?: https://dev.poktroll.com/develop/upgrades/upgrade_overview
Ensure you have push access to pokt-network/poktroll: https://github.com/pokt-network/poktroll
Familiarize yourself with the list of previous upgrade handlers: https://github.com/pokt-network/poktroll/tree/main/app/upgrades
Familiarize yourself with how to test changes locally: https://dev.poktroll.com/develop/upgrades/localnet_upgrade_testing
Ensure you have the required CLI tools: git, make, jq, sed, curl, go, brew, pocketd, etc.
1 Avoid On-Chain Non-Determinism
⚠️ The most common cause of chain halts is non-deterministic onchain behavior ⚠️
No amount of code reviews or testing can fully catch this. Here is a suggested and opinionated potential solution:
Use an LLM / CLI agent to review diffs
Start a session of Claude code or the CLI agent of your choice: https://www.anthropic.com/claude-code
Identify the tag of the previous MainNet release (e.g.
v0.1.20)Ask the agent the following prompt:
You are a senior CosmosSDK protocol engineer in charge of the next protocol upgrade.
Do a git diff v0.1.20.
Identify any potential bugs, edge cases or issues.
In particular, focus on any onchain behaviour that can result in non-deterministic outcomes. For example, iterating a map without sorting the keys first.
This is critical to avoid chain halts. Take your time and provide a comprehensive analysis.2 Prepare a New Upgrade Handler
3 Test Locally
Follow the instructions in Testing Protocol Upgrades Locally: https://dev.poktroll.com/develop/upgrades/localnet_upgrade_testing
If your upgrade handler had complex business logic, you MUST test it locally to avoid a chain halt.
Follow Testing Protocol Upgrades BEFORE submitting any transactions.
If you find an issue, you'll need to:
Delete the previous release
Delete the previous tag
Implement and merge in the fix
Prepare a new release
Regenerate the artifacts
Repeat the process above (you may need to jump back to earlier steps on this page)
4 Create a GitHub Release
5 Prepare the Upgrade Transactions
Generate upgrade tx JSON files
For example, for v0.1.21, run:
./tools/scripts/upgrades/prepare_upgrade_tx.sh v0.1.21This will create:
tools/scripts/upgrades/upgrade_tx_v0.1.21_alpha.json
tools/scripts/upgrades/upgrade_tx_v0.1.21_beta.json
tools/scripts/upgrades/upgrade_tx_v0.1.21_local.json
tools/scripts/upgrades/upgrade_tx_v0.1.21_main.json
Make sure to commit these to GitHub once you're done.
Note: the height is not populated in the *.json files. This will be updated in subsequent steps.
Optional: Validate the Upgrade Binary URLs
Install go-getter if you don't have it:
go install github.com/hashicorp/go-getter/cmd/go-getter@latestCheck all binary URLs:
RELEASE_VERSION=<VERSION> # E.g. "v0.1.11"
for file in ./tools/scripts/upgrades/upgrade_tx_${RELEASE_VERSION}*; do
echo "Processing $file"
jq -r '.body.messages[0].plan.info | fromjson | .binaries[]' "$file" | while IFS= read -r url; do
go-getter "$url" .
done
doneExpected output:
2025/04/16 12:11:36 success!
2025/04/16 12:11:40 success!
2025/04/16 12:11:44 success!
2025/04/16 12:11:48 success!6 Prepare Snapshots
Generate new snapshots for each network and ensure they are available here: https://snapshots.us-nj.poktroll.com/
This is currently a manual process maintained by Grove: https://grove.city/
Instructions are maintained in an internal Notion document: https://www.notion.so/buildwithgrove/Shannon-Snapshot-Playbook-1aea36edfff680bbb5a7e71c9846f63c?source=copy_link
7 Submit the Upgrade on Alpha & Beta TestNet
If you are submitting the upgrade for v0.1.21, run:
./tools/scripts/upgrades/submit_upgrade.sh alpha v0.1.21
./tools/scripts/upgrades/submit_upgrade.sh beta v0.1.21Make sure to ONLY move to the next network after the prior one finished successfully.
8 Troubleshooting & Canceling an Upgrade
Infrastructure Documentation (Grove): https://github.com/buildwithgrove/infrastructure/tree/main/docs
Chain Halt Troubleshooting: https://dev.poktroll.com/develop/upgrades/chain_halt_troubleshooting
Failed upgrade contingency plan: https://dev.poktroll.com/develop/upgrades/chain_halt_upgrade_contigency_plans
Chain Halt Recovery: https://dev.poktroll.com/develop/upgrades/chain_halt_recovery
Was this helpful?
