Skip to content

Commit

Permalink
Merge branch 'develop' into feat-cosmos-sdk-0.47.10-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis authored May 2, 2024
2 parents bddee34 + e5f48e4 commit 6dd2551
Show file tree
Hide file tree
Showing 19 changed files with 450 additions and 307 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ RUN go mod download
# Copy the rest of the source code and build the application
COPY . .

RUN make install
RUN expected_major_version=$(grep 'const releaseVersion = ' app/setup_handlers.go | awk -F'"' '{print $2}') && \
make install VERSION="${expected_major_version}" && \
git_hash=$(git rev-parse --short HEAD) && \
echo -n "${expected_major_version}-${git_hash}" > /go/delivery/zeta-node/expected_major_version

# Run Stage
FROM alpine:3.18
Expand All @@ -46,6 +49,7 @@ RUN apk --no-cache add git jq bash curl nano vim tmux python3 libusb-dev linux-h
# Copy the binaries from the build stage
COPY --from=builder /go/bin/zetaclientd /usr/local/bin/zetaclientd
COPY --from=builder /go/bin/zetacored /usr/local/bin/zetacored
COPY --from=builder /go/delivery/zeta-node/expected_major_version /scripts/expected_major_version

# Set the working directory
WORKDIR /usr/local/bin
Expand Down
40 changes: 22 additions & 18 deletions Dockerfile-upgrade
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine3.18
FROM golang:1.20-alpine3.18 as base

# Purpose: This Dockerfile creates an environment for performing an upgrade test on ZetaChain
# It contains the ZetaChain and ZetaClient binaries for two different versions of ZetaChain
Expand All @@ -8,6 +8,7 @@ FROM golang:1.20-alpine3.18
ENV GOPATH /go
ENV GOOS=linux
ENV CGO_ENABLED=1
ENV GOCACHE=/root/.cache/go-build

RUN apk --no-cache add git make build-base jq openssh libusb-dev linux-headers bash curl tmux
RUN ssh-keygen -b 2048 -t rsa -f /root/.ssh/localtest.pem -q -N ""
Expand All @@ -20,32 +21,35 @@ WORKDIR /go/delivery/zeta-node
RUN mkdir -p $GOPATH/bin/old
RUN mkdir -p $GOPATH/bin/new

ARG OLD_VERSION=v14.0.0
ENV NEW_VERSION=v15

# Build new release from the current source
COPY go.mod /go/delivery/zeta-node/
COPY go.sum /go/delivery/zeta-node/
RUN cd /go/delivery/zeta-node/ && go mod download
COPY . /go/delivery/zeta-node/
RUN cd /go/delivery/zeta-node/ && make install
RUN cd /go/delivery/zeta-node/ && make install-zetae2e
RUN cp $GOPATH/bin/zetacored $GOPATH/bin/new/
RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/new/
RUN ssh-keygen -A
RUN cp /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys

# Checkout and build old binary
FROM base as oldbuild
ARG OLD_VERSION
RUN git clone https://github.com/zeta-chain/node.git
RUN cd node && git fetch

RUN cd node && git checkout ${OLD_VERSION}
RUN cd node && make install
RUN cp $GOPATH/bin/zetacored $GOPATH/bin/old/
RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/old/

RUN ssh-keygen -A
WORKDIR /root
# Build new release from the current source
FROM base
ARG NEW_VERSION
ENV NEW_VERSION=${NEW_VERSION}
COPY go.mod /go/delivery/zeta-node/
COPY go.sum /go/delivery/zeta-node/
RUN cd /go/delivery/zeta-node/ && go mod download
COPY . /go/delivery/zeta-node/
RUN --mount=type=cache,target="/root/.cache/go-build" cd /go/delivery/zeta-node/ && make install
RUN --mount=type=cache,target="/root/.cache/go-build" cd /go/delivery/zeta-node/ && make install-zetae2e
RUN cp $GOPATH/bin/zetacored $GOPATH/bin/new/ && \
cp $GOPATH/bin/zetaclientd $GOPATH/bin/new/

RUN cp /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys
COPY --from=oldbuild $GOPATH/bin/zetacored $GOPATH/bin/zetaclientd $GOPATH/bin/
COPY --from=oldbuild $GOPATH/bin/zetacored $GOPATH/bin/zetaclientd $GOPATH/bin/old

WORKDIR /root

RUN cp /go/bin/zetaclientd /usr/local/bin
RUN cp /go/bin/zetacored /usr/local/bin
Expand Down
80 changes: 68 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,18 @@ start-stress-test: zetanode
@echo "--> Starting stress test"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-stresstest.yml up -d

start-upgrade-test:
@echo "--> Starting upgrade test"
$(DOCKER) build -t zetanode -f ./Dockerfile-upgrade .
zetanode-upgrade:
@echo "Building zetanode-upgrade"
$(DOCKER) build -t zetanode -f ./Dockerfile-upgrade --build-arg OLD_VERSION=v14.0.0 --build-arg NEW_VERSION=v15 .
$(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile.fastbuild .
.PHONY: zetanode-upgrade

start-upgrade-test: zetanode-upgrade
@echo "--> Starting upgrade test"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-upgrade.yml up -d

start-upgrade-test-light:
start-upgrade-test-light: zetanode-upgrade
@echo "--> Starting light upgrade test (no ZetaChain state populating before upgrade)"
$(DOCKER) build -t zetanode -f ./Dockerfile-upgrade .
$(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile.fastbuild .
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-upgrade-light.yml up -d

start-localnet: zetanode
Expand Down Expand Up @@ -288,14 +290,68 @@ release:
### Local Mainnet Development ###
###############################################################################

mainnet-zetarpc-node:
cd contrib/mainnet/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose up
#BTC
start-bitcoin-node-mainnet:
cd contrib/rpc/bitcoind-mainnet && DOCKER_TAG=$(DOCKER_TAG) docker-compose up

stop-bitcoin-node-mainnet:
cd contrib/rpc/bitcoind-mainnet && DOCKER_TAG=$(DOCKER_TAG) docker-compose down

clean-bitcoin-node-mainnet:
cd contrib/rpc/bitcoind-mainnet && DOCKER_TAG=$(DOCKER_TAG) docker-compose down -v

#ETHEREUM
start-eth-node-mainnet:
cd contrib/rpc/ethereum && DOCKER_TAG=$(DOCKER_TAG) docker-compose up

stop-eth-node-mainnet:
cd contrib/rpc/ethereum && DOCKER_TAG=$(DOCKER_TAG) docker-compose down

clean-eth-node-mainnet:
cd contrib/rpc/ethereum && DOCKER_TAG=$(DOCKER_TAG) docker-compose down -v

#ZETA

#FULL-NODE-RPC-FROM-BUILT-IMAGE
start-zetacored-rpc-mainnet:
cd contrib/rpc/zetacored && bash init_docker_compose.sh mainnet image $(DOCKER_TAG)

stop-zetacored-rpc-mainnet:
cd contrib/rpc/zetacored && bash kill_docker_compose.sh mainnet false

clean-zetacored-rpc-mainnet:
cd contrib/rpc/zetacored && bash kill_docker_compose.sh mainnet true

#FULL-NODE-RPC-FROM-BUILT-IMAGE
start-zetacored-rpc-testnet:
cd contrib/rpc/zetacored && bash init_docker_compose.sh athens3 image $(DOCKER_TAG)

stop-zetacored-rpc-testnet:
cd contrib/rpc/zetacored && bash kill_docker_compose.sh athens3 false

clean-zetacored-rpc-testnet:
cd contrib/rpc/zetacored && bash kill_docker_compose.sh athens3 true

#FULL-NODE-RPC-FROM-LOCAL-BUILD
start-zetacored-rpc-mainnet-localbuild:
cd contrib/rpc/zetacored && bash init_docker_compose.sh mainnet localbuild $(DOCKER_TAG)

stop-zetacored-rpc-mainnet-localbuild:
cd contrib/rpc/zetacored && bash kill_docker_compose.sh mainnet false

clean-zetacored-rpc-mainnet-localbuild:
cd contrib/rpc/zetacored && bash kill_docker_compose.sh mainnet true

#FULL-NODE-RPC-FROM-LOCAL-BUILD
start-zetacored-rpc-testnet-localbuild:
cd contrib/rpc/zetacored && bash init_docker_compose.sh athens3 localbuild $(DOCKER_TAG)

stop-zetacored-rpc-testnet-localbuild:
cd contrib/rpc/zetacored && bash kill_docker_compose.sh athens3 false

mainnet-bitcoind-node:
cd contrib/mainnet/bitcoind && DOCKER_TAG=$(DOCKER_TAG) docker-compose up
clean-zetacored-rpc-testnet-localbuild:
cd contrib/rpc/zetacored && bash kill_docker_compose.sh athens3 true

athens3-zetarpc-node:
cd contrib/athens3/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose up

###############################################################################
### Debug Tools ###
Expand Down
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@
## Unreleased

### Breaking Changes

* Observer param `ballot_maturity_blocks` is part of `emissions` module now. Observer `params` are deprecated and removed from `observer` module.

### Features

* [2032](https://github.com/zeta-chain/node/pull/2032) - improve some general structure of the ZetaClient codebase
* [2100](https://github.com/zeta-chain/node/pull/2100) - cosmos v0.47 upgrade

### Refactor

* [2094](https://github.com/zeta-chain/node/pull/2094) - upgrade go-tss to use cosmos v0.47

### CI

* [2070](https://github.com/zeta-chain/node/pull/2070) - Added commands to build binaries from the working branch as a live full node rpc to test non-governance changes.

## Unreleased
### Breaking Changes

Expand Down
42 changes: 0 additions & 42 deletions contrib/athens3/zetacored/docker-compose.yml

This file was deleted.

30 changes: 29 additions & 1 deletion contrib/docker-scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,35 @@ function move_zetacored_binaries {
}

function start_network {
${VISOR_NAME} version
if [ "${IS_LOCAL_DEVELOPMENT}" == "true" ]; then
cp /usr/local/bin/zetacored ${DAEMON_HOME}/cosmovisor/genesis/bin/zetacored
find /root/.zetacored/cosmovisor/upgrades/ -type f -path "*/bin/zetacored" -exec cp /usr/local/bin/zetacored {} \;
fi
expected_major_version=$(cat /scripts/expected_major_version | cut -d '-' -f 1)
VISOR_VERSION=v$(${VISOR_NAME} version | tail -n 1 | tr -d '(devel)' | tr -d '\n')
DAEMON_VERSION=$(${DAEMON_NAME} version)
VISOR_MAJOR_VERSION=$(echo $VISOR_VERSION | grep -o '^v[0-9]*')
DAEMON_MAJOR_VERSION=$(echo $DAEMON_VERSION | grep -o '^v[0-9]*')

logt "EXPECTED_VERSION_WITH_HASH: $(cat /scripts/expected_major_version | cut -d '-' -f 1)"
logt "EXPECTED_MAJOR_VERSION: ${expected_major_version}"
logt "VISOR_VERSION: ${VISOR_VERSION}"
logt "DAEMON_VERSION: ${DAEMON_VERSION}"
logt "VISOR_MAJOR_VERSION: ${VISOR_MAJOR_VERSION}"
logt "DAEMON_MAJOR_VERSION: ${DAEMON_MAJOR_VERSION}"

if [ "$VISOR_MAJOR_VERSION" != "$expected_major_version" ] || [ "$DAEMON_MAJOR_VERSION" != "$expected_major_version" ]; then
logt "One or both versions don't match the expected major release version: $expected_major_version"
else
logt "Both versions match the expected major release version: $expected_major_version"
fi

if [ "$VISOR_VERSION" != "$DAEMON_VERSION" ]; then
logt "cosmovisor version doesn't appear to match your daemon version. Start ${DAEMON_NAME}"
else
logt "cosmovisor version match your daemon version. Start ${VISOR_NAME}"
fi

${VISOR_NAME} run start --home ${DAEMON_HOME} \
--log_level info \
--moniker ${MONIKER} \
Expand Down
4 changes: 2 additions & 2 deletions contrib/localnet/scripts/start-zetacored.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ else
sleep 7
/root/.zetacored/cosmovisor/genesis/bin/zetacored query gov proposal 1

# We use tail -f to keep the container running
tail -f zetanode.log
# We use tail -f to keep the container running. Use -n999999 to ensure we get all the context.
tail -n999999 -f zetanode.log

fi

45 changes: 0 additions & 45 deletions contrib/mainnet/zetacored/docker-compose.yml

This file was deleted.

File renamed without changes.
8 changes: 8 additions & 0 deletions contrib/rpc/ethereum/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Use the official Go Ethereum image
FROM ethereum/client-go:latest

# Expose the ports (8545 for JSON-RPC, 8546 for WebSocket, 30303 for P2P)
EXPOSE 8545 8546 30303

# Set the entrypoint to start Geth
ENTRYPOINT ["geth"]
38 changes: 38 additions & 0 deletions contrib/rpc/ethereum/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3.8'
services:
lighthouse:
image: sigp/lighthouse:latest
command: lighthouse --network mainnet beacon --http --checkpoint-sync-url https://sync.invis.tools
ports:
- "5052:5052"
volumes:
- type: volume
source: lighthouse_data
target: /root/.lighthouse
geth:
build: .
ports:
- "18545:18545" # JSON-RPC
- "18546:18546" # WebSocket
- "30303:30303" # P2P Network
volumes:
- type: volume
source: ethereum_data
target: /root/.ethereum
command:
- "--http"
- "--http.addr"
- "0.0.0.0"
- "--http.vhosts=*"
- "--http.api=admin,eth,debug,miner,net,txpool,personal,web3"
- "--ws"
- "--ws.addr"
- "0.0.0.0"
- "--ws.api=admin,eth,debug,miner,net,txpool,personal,web3"
- "--ws.origins=*"
- "--maxpeers=50"
- "--syncmode=snap"

volumes:
ethereum_data:
lighthouse_data:
Loading

0 comments on commit 6dd2551

Please sign in to comment.