LocalNet Upgrade Testing

CURRENT_HEIGHT=$(./release_binaries/pocket_darwin_arm64 q consensus comet block-latest -o json | jq '.sdk_block.last_commit.height' | tr -d '"')
UPGRADE_HEIGHT=$((CURRENT_HEIGHT + 20))
sed -i.bak "s/\"height\": \"[^\"]*\"/\"height\": \"$UPGRADE_HEIGHT\"/" tools/scripts/upgrades/upgrade_tx_v0.1.2_local.json
cat ./tools/scripts/upgrades/upgrade_tx_v0.1.2_local.json

1

Submit & verify the upgrade transaction

In pocket_old, submit the upgrade transaction:

./release_binaries/pocket_darwin_arm64 tx authz exec tools/scripts/upgrades/upgrade_tx_v0.1.2_local.json --yes --from=pnf

Verify it was submitted onchain:

./release_binaries/pocket_darwin_arm64 query upgrade plan
2

Observe the upgrade output

When UPGRADE_HEIGHT is reached, you should see output like:

ERR UPGRADE "v0.1.2" NEEDED at height: <height>: ...
3

Stop old node & start new node

  • In pocket_old, stop the validator (cmd/ctrl + C on macOS).

  • In pocket_new, start the validator:

./release_binaries/pocket_darwin_arm64 start
4

Sanity checks

  • Check the new validator version:

curl -s http://localhost:26657/abci_info | jq '.result.response.version'
  • Expected output: v0.1.2

Query the node for business logic changes as needed.


[Advanced] Fast Iteration for Local Changes

This is rough and advanced. We will update and streamline this section in the future — use at your own risk for now.

Setup (one time)

One time setup & preparation to test local changes.

Old repo:

# Checkout the previous release
git checkout v<previous_release_tag>

# Prepare the release
make release_tag_local_testing

# Rebuild the binary
make go_develop ignite_release_local ignite_release_extract_binaries

# Reset to genesis
./release_binaries/pocket_darwin_arm64 comet unsafe-reset-all && make localnet_regenesis

# Start the binary
./release_binaries/pocket_darwin_arm64 start

New repo:

# Checkout the working feature branch
git checkout <working_feature_branch>

# Prepare the release
make release_tag_local_testing

# Update the upgrade

# CRUD `allUpgrades` in `app/upgrades.go`

# See TODO to manually update `pocket-local` in `NetworkAuthzGranteeAddress`

# Rebuild the binary
make go_develop ignite_release_local ignite_release_extract_binaries

# Start the binary
# ./release_binaries/pocket_darwin_arm64 start

Iterate (repeated)

The steps you'll be repeating many times through the process.

Old repo:

# Reset to genesis
./release_binaries/pocket_darwin_arm64 comet unsafe-reset-all && make localnet_regenesis

# Start the binary
./release_binaries/pocket_darwin_arm64 start

# Update the upgrade height
CURRENT_HEIGHT=$(./release_binaries/pocket_darwin_arm64 q consensus comet block-latest -o json | jq '.sdk_block.last_commit.height' | tr -d '"')
UPGRADE_HEIGHT=$((CURRENT_HEIGHT + 20))
sed -i.bak "s/\"height\": \"[^\"]*\"/\"height\": \"$UPGRADE_HEIGHT\"/" tools/scripts/upgrades/upgrade_tx_v0.1.2_local.json
cat ./tools/scripts/upgrades/upgrade_tx_vX.Y.Z_local.json

# Submit the upgrade
./release_binaries/pocket_darwin_arm64 tx authz exec tools/scripts/upgrades/upgrade_tx_vX.Y.Z_local.json --yes --from=pnf

# Stop the binary

New repo:

# Compile the binaries on every change/iteration
make go_develop ignite_release_local ignite_release_extract_binaries

# Start the binary after the release in the other one goes through
./release_binaries/pocket_darwin_arm64 start

# Test your changes

Was this helpful?