Skip to content

ag0 to agd upgrade

Dan Connolly edited this page Oct 15, 2022 · 39 revisions

Work in Progress: stay tuned to emerynet #announce for next steps. Visit #get-roles on https://agoric.com/discord to get the @emerynet role if you have not already.

note: one more release candidate is expected after pismoA-rc3

Overview: build from source

For this upgrade, agd installation involves building from source. A binary installation package for agd is an outstanding issue: #6455.

  1. Install agd from source
    1. install node, yarn
    2. install go
    3. install agoric-sdk
    4. Configure agd.service
  2. Disable ag0 once it stops
  3. Start agd to complete the upgrade

Install agd

Tested on Ubuntu 22.04

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:

Install Node.js and yarn

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

Install Go

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

Install Agoric SDK

note: one more release candidate is expected after pismoA-rc3

We’ll install the Agoric SDK from source using git clone.

cd /usr/local/src
git clone https://github.com/Agoric/agoric-sdk -b pismoA-rc3
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.1
commit: ef8aa3c56
build_tags: ledger,
go: go version go1.18.7 linux/amd64
...

If the software version does not match, then please check your $PATH to ensure the correct agd is running.

Configure agd.service

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

Disable ag0 once it stops

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

Start agd to complete the upgrade

sudo systemctl start agd

Context / Background

Clone this wiki locally