Skip to content

Instantly share code, notes, and snippets.

@darklankou
Last active March 27, 2024 21:07
Show Gist options
  • Save darklankou/21c38d2f894d138ebc79c92ecebb63f8 to your computer and use it in GitHub Desktop.
Save darklankou/21c38d2f894d138ebc79c92ecebb63f8 to your computer and use it in GitHub Desktop.
Namada migration 32

Info

At the end (and only there) this doc assume you are yusing systemctl and /usr/local/bin as a path for namada binaries

you should read the doc here

https://github.com/anoma/namada-shielded-expedition/blob/main/HardFork.md

but the procedure should work so-so

install binary script (tested ok)

script static versions

get_namada_binaries_version_more.sh

#!/bin/bash

if [ -z $1 ];then
        echo "arg is version, like 0.31.0"
        exit 1
fi
set -u

# OPERATING_SYSTEM="Linux"
version=$1
release_url="https://github.com/anoma/namada/releases/download/v$version/namada-v$version-Linux-x86_64.tar.gz"
curl -I https://github.com/anoma/namada/releases/download/v$version/namada-v$version-Linux-x86_64.tar.gz || (echo "version [$version] not found" ; exit 1)

wget "$release_url"

# 
namda_archive=$(ls -rt namada*$version*.tar.gz | tail -1)
tar -xzvf $namda_archive

namada_dir=$(ls -drt namada-*$version*-Linux-x86_64 | tail -1)

for i in namada namadan namadac namadaw;do
        sudo cp -av $namada_dir/$i /usr/local/bin/$i-$1
done

echo "check versions"
set -v
/usr/local/bin/namada-$1 --version
/usr/local/bin/namadan-$1 --version
/usr/local/bin/namadac-$1 --version
/usr/local/bin/namadaw-$1 --version

install the bins with version 0.31.10 and 0.32.1 in /usr/local/bin (tested ok)

bash get_namada_binaries_version_more.sh 0.31.10
bash get_namada_binaries_version_more.sh 0.32.1

Stop your service (may be namada instead of namadad) depends on your systemctl config

sudo service namadad stop

start ledger in a tmux stopping at height 237907 (tested ok)

tmux
max_height=237907
namadan ledger run-until --block-height $max_height --suspend

you can get aout of the tmux with ctrl-b d it will let the node runs

then kill it with Ctrl-C after upgrade height

you can check if younode is running by attaching the tmux or curl localhost:26657/status

tmux att

when upgrade starts

backup

cp -r \
~/.local/share/namada/shielded-expedition.88f17d1d14 \
~/.local/share/namada/shielded-expedition.88f17d1d14.backup-before-upgrade-32
namadan-0.31.10 ledger query-db --db-key conversion_state \
 --hash 05E2FD0BEBD54A05AAE349BBDE61F90893F09A72850EFD4F69060821EC5DE65F \
 --db-column-family state > conversion_state.txt

dload tools

wget 'https://github.com/anoma/namada-shielded-expedition/raw/main/hard_fork/make-db-migration'
chmod +x make-db-migration

dload the wasm

mkdir wasm
cd wasm
wget 'https://github.com/anoma/namada-shielded-expedition/raw/main/hard_fork/vp_user.6065919f895d43099a567cb120ebdfa0c99c3ba4e803fe99159a14bd8f97f0ea.wasm'
wget 'https://github.com/anoma/namada-shielded-expedition/raw/main/hard_fork/checksums.json'

generate migration.json

cd -
./make-db-migration

if it fails redowload everything using wget

(Option dolad it instead of generating it)

wget https://namada.lankou.org/migrations.json

check the file sum with the tool you like

$ sha256sum migrations.json 
34bd7815ebc4d2344bd875ce4ae847bc42feb03099c69313a646a40a3aa2ea99  migrations.json

$ md5sum migrations.json 
d3f95fae0cb50ad928947e9eb177834b  migrations.json

update the DB dry run

namadan-0.32.1 ledger update-db \
  --path migrations.json \
  --block-height $max_height --dry-run

don't run for now - wait for annoucement

update the DB real

namadan-0.32.1 ledger update-db \
 --path migrations.json \
 --block-height $max_height

install the 0.32.1 binaries in your /usr/local/bin

install_binaries_version.sh

#!/bin/bash

if [ -z $1 ];then
	echo "arg is version, like 0.31.0"
	exit 1
fi


# OPERATING_SYSTEM="Linux" # or "Darwin" for MacOS
version=$1
release_url="https://github.com/anoma/namada/releases/download/v$version/namada-v$version-Linux-x86_64.tar.gz"
curl -I https://github.com/anoma/namada/releases/download/v$version/namada-v$version-Linux-x86_64.tar.gz || (echo "version [$version] not found" ; exit 1)

wget "$release_url"
# 
namda_archive=$(ls -rt namada*$version*.tar.gz | tail -1)
tar -xzvf $namda_archive

namada_dir=$(ls -drt namada-*$version*-Linux-x86_64 | tail -1)


echo "RM OLD"
sudo rm -v /usr/local/bin/namada{,n,c,w}

echo "copying binaries"
sudo cp -av $namada_dir/na* /usr/local/bin

echo "check versions"
set -v
/usr/local/bin/namada --version
/usr/local/bin/namadan --version
/usr/local/bin/namadac --version
/usr/local/bin/namadaw --version

install overriding you /usr/local/bin/namada version

./install_binaries_version.sh 0.32.1
systemctl start namadad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment