-
Notifications
You must be signed in to change notification settings - Fork 207
ag0 to agd upgrade for mainnet 1 launch
- Proposal 16 passed with 85% participation and over 1800 votes!
To prepare for this network upgrade, which is the first time that the Agoric JavaScript VM will be include on-chain, here is everything you need to know in advance:
-
There is no binary release of 'agd', so validators MUST build the code from source in advance of reaching the blockheight specified in the proposal. The compilation of the code takes longer than
ag0
, and it requires installing theagd
binary as well as additional dependencies. Taking this step in advance will help validators start producing blocks more quickly. -
Agoric recommends orchestrating the running of
agD
manually, or create asystemd
service foragd
as described below. While the code was under evaluation on Emerynet, several validators experienced compatability issues with Cosmovisor, and the Agoric team recommends against relying on it for this upgrade. If you've found a comfortable workaround and would like to proceed with Cosmovisor for this upgrade, please consult Polkachu's Unofficial Upgrade Guide foragoric-upgrade-8
to avoid any issues with symlink or file path names. - Before you upgrade, Agoric recommends creating a backup of your local.agoric directory. It is always a good idea to backup important data (e.g. state) before initiating major changes in your environment.
If you have any questions, the Agoric team is available in the #peer-support channel in the Mainnet Validator category of the Agoric Discord. (If you don't see the Mainnet category, visit #get-roles to get the Mainnet role.)
For this upgrade, agd
installation involves building from source. A binary installation package for agd is an outstanding issue: #6455.
- Install
agd
from source- install node, yarn
- install go
- install agoric-sdk
- Configure
agd.service
- Disable
ag0
once it stops - Start
agd
to complete the upgrade
These source installation instructions were tested on an Ubuntu 22.04.1 LTS amd64 host with with sudo
and curl
available.
For a recording, see:
-
ag0 to agd upgrade - asciinema
duration: 6min
Note: this recording pre-dates rc4; it used rc3. Also, it shows running as root, which is probably not a good idea in production.
Install node.js v16. Following Node.js download instructions:
# Download the nodesource PPA for Node.js
curl https://deb.nodesource.com/setup_16.x | sudo bash
# Install the Yarn package manager
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# Update Ubuntu
sudo apt-get update
sudo apt upgrade -y
# Install Node.js, Yarn, and build tools
# Install jq for formatting of JSON data
# We'll need git below.
sudo apt install nodejs=16.* yarn build-essential git jq -y
# verify installation
node --version | grep 16
yarn --version
Agoric's Cosmos integration is built using Go and requires Go version 1.17+. In this example, we will be installing Go on the above Ubuntu 20.04 with Node.js installed:
# First remove any existing old Go installation
sudo rm -rf /usr/local/go
# Download and verify go
curl -L -o /tmp/go1.18.7.linux-amd64.tar.gz https://go.dev/dl/go1.18.7.linux-amd64.tar.gz
sha256sum --check <<EOF
6c967efc22152ce3124fc35cdf50fc686870120c5fd2107234d05d450a6105d8 /tmp/go1.18.7.linux-amd64.tar.gz
EOF
# install
sudo tar -C /usr/local -xzf /tmp/go1.18.7.linux-amd64.tar.gz
# Update environment variables to include go
cat <<'EOF' >>$HOME/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
EOF
source $HOME/.profile
# Verify that Go is installed:
go version | grep 1.18
We’ll install the Agoric SDK from source using git clone
.
cd # Writeable directory of your choice. $HOME will do.
git clone https://github.com/Agoric/agoric-sdk -b pismoA
cd agoric-sdk
# Install and build Agoric Javascript packages
yarn install && yarn build
# Install and build Agoric Cosmos SDK support
(cd packages/cosmic-swingset && make)
Note that you will need to keep the agoric-sdk
directory intact when running the validator, as it contains data files necessary for correct operation.
To verify the build:
agd version --long
The output should start with:
name: agoriccosmos
server_name: ag-cosmos-helper
version: 0.32.2
commit: 2c812d221
build_tags: ',ledger'
go: go version go1.18.1 linux/amd64
...
If the software version does not match, then please check your $PATH
to ensure the correct agd
is running.
To use systemd
, we will create a service file:
sudo tee <<EOF >/dev/null /etc/systemd/system/agd.service
[Unit]
Description=Agoric Cosmos daemon
After=network-online.target
[Service]
# OPTIONAL: turn on JS debugging information.
#SLOGFILE=.agoric/data/chain.slog
User=$USER
# OPTIONAL: turn on Cosmos nondeterminism debugging information
#ExecStart=$HOME/go/bin/agd start --log_level=info --trace-store=.agoric/data/kvstore.trace
ExecStart=$HOME/go/bin/agd start --log_level=warn
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable agd
sudo systemctl daemon-reload
To confirm that the service is configured but not yet started, run systemctl status agd
. The result should look like:
○ agd.service - Agoric Cosmos daemon
Loaded: loaded (/etc/systemd/system/agd.service; enabled; vendor preset: enabled)
Active: inactive (dead)
To confirm that agd
has access to the same key material that ag0
was using:
ag0 tendermint show-validator
agd tendermint show-validator
ag0
should stop on its own at the block height in the software upgrade governance proposal.
Once that happens, disable it:
sudo systemctl disable ag0
sudo systemctl start agd
(this part is done: Proposal 16)