Skip to content

Commit

Permalink
Merge branch 'withdraw-emissions' of github.com:zeta-chain/zeta-node …
Browse files Browse the repository at this point in the history
…into withdraw-emissions
  • Loading branch information
kingpinXD committed Mar 5, 2024
2 parents 22b423e + f239219 commit 867fd83
Show file tree
Hide file tree
Showing 35 changed files with 926 additions and 1,481 deletions.
33 changes: 23 additions & 10 deletions .github/workflows/docker-build-and-push.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: Zetacored-Docker-Build

on:
pull_request:
release:
types:
- closed
branches:
- 'main'
- created
workflow_dispatch:
inputs:
version:
Expand All @@ -32,9 +30,14 @@ jobs:
fetch-depth: 0

- name: Set Version from the PR title.
if: github.event_name == 'pull_request'
if: github.event_name != 'workflow_dispatch'
run: |
echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.pull_request.title }}" >> ${GITHUB_ENV}
LATEST_RELEASE=$(curl -s -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases/latest)
RELEASE_TITLE=$(echo $LATEST_RELEASE | jq -r .name)
echo "Latest release title: $RELEASE_TITLE"
echo "GITHUB_TAG_MAJOR_VERSION=$RELEASE_TITLE" >> $GITHUB_ENV
- name: Set Version for Hotfix Release from Input.
if: github.event_name != 'pull_request'
Expand Down Expand Up @@ -64,9 +67,14 @@ jobs:
fetch-depth: 0

- name: Set Version from the PR title.
if: github.event_name == 'pull_request'
if: github.event_name != 'workflow_dispatch'
run: |
echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.pull_request.title }}" >> ${GITHUB_ENV}
LATEST_RELEASE=$(curl -s -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases/latest)
RELEASE_TITLE=$(echo $LATEST_RELEASE | jq -r .name)
echo "Latest release title: $RELEASE_TITLE"
echo "GITHUB_TAG_MAJOR_VERSION=$RELEASE_TITLE" >> $GITHUB_ENV
- name: Set Version for Hotfix Release from Input.
if: github.event_name != 'pull_request'
Expand Down Expand Up @@ -107,9 +115,14 @@ jobs:
fetch-depth: 0

- name: Set Version from the PR title.
if: github.event_name == 'pull_request'
if: github.event_name != 'workflow_dispatch'
run: |
echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.pull_request.title }}" >> ${GITHUB_ENV}
LATEST_RELEASE=$(curl -s -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases/latest)
RELEASE_TITLE=$(echo $LATEST_RELEASE | jq -r .name)
echo "Latest release title: $RELEASE_TITLE"
echo "GITHUB_TAG_MAJOR_VERSION=$RELEASE_TITLE" >> $GITHUB_ENV
- name: Set Version for Hotfix Release from Input.
if: github.event_name != 'pull_request'
Expand Down
66 changes: 34 additions & 32 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
# Purpose: This Dockerfile creates an environment for running ZetaChain
# It contains:
# - zetacored: the ZetaChain node binary
# - zetaclientd: the ZetaChain client binary for observers
# - zetae2e: the ZetaChain end-to-end tests CLI

FROM golang:1.20-alpine3.18
# Build Stage
FROM golang:1.20-alpine3.18 AS builder

ENV GOPATH /go
ENV GOOS=linux
ENV CGO_ENABLED=1

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 ""
# Install build dependencies
RUN apk --no-cache add git make build-base jq openssh libusb-dev linux-headers bash curl python3 py3-pip

# Set the working directory
WORKDIR /go/delivery/zeta-node

# Copy module files and download dependencies
COPY go.mod .
COPY go.sum .

RUN go mod download

# Copy the rest of the source code and build the application
COPY . .
RUN make install
RUN make install-zetae2e
#
#FROM golang:1.20-alpine

#RUN apk --no-cache add openssh jq tmux vim curl bash
RUN ssh-keygen -A
WORKDIR /root
RUN make install

RUN cp /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys
# Run Stage
FROM alpine:3.18

RUN cp /go/bin/zetaclientd /usr/local/bin
RUN cp /go/bin/zetacored /usr/local/bin
RUN cp /go/bin/zetae2e /usr/local/bin
# Copy Start Script Helpers
COPY contrib/docker-scripts/* /scripts/

COPY contrib/localnet/scripts /root
COPY contrib/localnet/preparams /root/preparams
COPY contrib/localnet/ssh_config /root/.ssh/config
COPY contrib/localnet/zetacored /root/zetacored
COPY contrib/localnet/tss /root/tss
# Install runtime dependencies
RUN apk --no-cache add git jq bash curl python3 libusb-dev linux-headers make build-base wget py3-pip qemu-img qemu-system-x86_64 && \
pip install requests && \
chmod a+x -R /scripts && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.31-r0/glibc-2.31-r0.apk && \
apk add --force-overwrite --allow-untrusted glibc-2.31-r0.apk

RUN chmod 755 /root/*.sh
RUN chmod 700 /root/.ssh
RUN chmod 600 /root/.ssh/*
# 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

# Set the working directory
WORKDIR /usr/local/bin
ENV SHELL /bin/sh
EXPOSE 22

ENTRYPOINT ["/usr/sbin/sshd", "-D"]
# Set the default shell
ENV SHELL /bin/bash

EXPOSE 26656
EXPOSE 1317
EXPOSE 8545
EXPOSE 8546
EXPOSE 9090
EXPOSE 26657
EXPOSE 9091
52 changes: 52 additions & 0 deletions Dockerfile-localnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM golang:1.20-alpine3.18

ENV GOPATH /go
ENV GOOS=linux
ENV CGO_ENABLED=1

RUN apk --no-cache add git make build-base jq openssh libusb-dev linux-headers bash curl tmux python3 py3-pip
RUN pip install requests
RUN ssh-keygen -b 2048 -t rsa -f /root/.ssh/localtest.pem -q -N ""

WORKDIR /go/delivery/zeta-node
COPY go.mod .
COPY go.sum .
#RUN --mount=type=cache,target=/root/.cache/go-build \
# go mod download
RUN go mod download
COPY . .

#RUN --mount=type=cache,target=/root/.cache/go-build \
# make install
#RUN --mount=type=cache,target=/root/.cache/go-build \
# make install-zetae2e
RUN make install
RUN make install-zetae2e
#
#FROM golang:1.20-alpine

#RUN apk --no-cache add openssh jq tmux vim curl bash
RUN ssh-keygen -A
WORKDIR /root

RUN cp /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys

RUN cp /go/bin/zetaclientd /usr/local/bin
RUN cp /go/bin/zetacored /usr/local/bin
RUN cp /go/bin/zetae2e /usr/local/bin

COPY contrib/localnet/scripts /root
COPY contrib/localnet/preparams /root/preparams
COPY contrib/localnet/ssh_config /root/.ssh/config
COPY contrib/localnet/zetacored /root/zetacored
COPY contrib/localnet/tss /root/tss

RUN chmod 755 /root/*.sh
RUN chmod 700 /root/.ssh
RUN chmod 600 /root/.ssh/*

WORKDIR /usr/local/bin
ENV SHELL /bin/sh
EXPOSE 22

ENTRYPOINT ["/usr/sbin/sshd", "-D"]
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ generate: proto openapi specs typescript docs-zetacored

zetanode:
@echo "Building zetanode"
$(DOCKER) build -t zetanode -f ./Dockerfile .
$(DOCKER) build -t zetanode -f ./Dockerfile-localnet .
$(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile.fastbuild .
.PHONY: zetanode

Expand Down Expand Up @@ -266,7 +266,10 @@ release:
###############################################################################

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

mainnet-bitcoind-node:
cd contrib/local-mainnet/bitcoind && docker-compose up
cd contrib/mainnet/bitcoind && DOCKER_TAG=$(DOCKER_TAG) docker-compose up

athens3-zetarpc-node:
cd contrib/athens3/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose up
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
### Tests

* [1767](https://github.com/zeta-chain/node/pull/1767) - add unit tests for emissions module begin blocker
* [1791](https://github.com/zeta-chain/node/pull/1791) - add e2e tests for feature of restricted address

### Chores

Expand Down Expand Up @@ -76,12 +77,17 @@
* Added docker-compose and make commands for launching full nodes. `make mainnet-zetarpc-node` `make mainnet-bitcoind-node`
* Made adjustments to the docker-compose for launching mainnet full nodes to include examples of using the docker images build from the docker image build pipeline.
* [1736](https://github.com/zeta-chain/node/pull/1736) - chore: add Ethermint endpoints to OpenAPI
* Re-wrote Dockerfile for building Zetacored docker images.
* Adjusted the docker-compose files for Zetacored nodes to utilize the new docker image.
* Added scripts for the new docker image that facilitate the start up automation.
* Adjusted the docker pipeline slightly to pull the version on PR from the app.go file.
* [1781](https://github.com/zeta-chain/node/pull/1781) - add codecov coverage report in CI

### Features

* [1425](https://github.com/zeta-chain/node/pull/1425) add `whitelist-erc20` command


### Chores

* [1729](https://github.com/zeta-chain/node/pull/1729) - add issue templates
Expand Down
1 change: 1 addition & 0 deletions cmd/zetae2e/local/bitcoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func bitcoinTestRoutine(
e2etests.TestBitcoinWithdrawName,
e2etests.TestZetaWithdrawBTCRevertName,
e2etests.TestCrosschainSwapName,
e2etests.TestBitcoinWithdrawRestrictedName,
); err != nil {
return fmt.Errorf("bitcoin tests failed: %v", err)
}
Expand Down
1 change: 1 addition & 0 deletions cmd/zetae2e/local/erc20.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func erc20TestRoutine(
e2etests.TestMultipleWithdrawsName,
e2etests.TestERC20DepositAndCallRefundName,
e2etests.TestZRC20SwapName,
e2etests.TestERC20DepositRestrictedName,
); err != nil {
return fmt.Errorf("erc20 tests failed: %v", err)
}
Expand Down
1 change: 1 addition & 0 deletions cmd/zetae2e/local/ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func ethereumTestRoutine(
e2etests.TestContextUpgradeName,
e2etests.TestEtherDepositAndCallName,
e2etests.TestDepositAndCallRefundName,
e2etests.TestEtherWithdrawRestrictedName,
); err != nil {
return fmt.Errorf("ethereum tests failed: %v", err)
}
Expand Down
1 change: 1 addition & 0 deletions cmd/zetae2e/local/zeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func zetaTestRoutine(
e2etests.TestMessagePassingName,
e2etests.TestMessagePassingRevertFailName,
e2etests.TestMessagePassingRevertSuccessName,
e2etests.TestZetaDepositRestrictedName,
); err != nil {
return fmt.Errorf("zeta tests failed: %v", err)
}
Expand Down
44 changes: 44 additions & 0 deletions contrib/athens3/zetacored/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: '3.8'
services:
zetachain_mainnet_rpc:
platform: linux/amd64
#This will build the binary from the GIT_REF you are locally on.
# build:
# context: ../../..
# dockerfile: Dockerfile
image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14}
environment:
DAEMON_HOME: "/root/.zetacored"
NETWORK: athens3
#RESTORE_TYPE=snapshot/snapshot-archive/statesync
RESTORE_TYPE: "statesync"
SNAPSHOT_API: https://snapshots.zetachain.com
TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: 40000
COSMOVISOR_VERSION: "v1.5.0"
CHAIN_ID: "athens_7001-1"
COSMOVISOR_CHECKSUM: "626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc"
VISOR_NAME: "cosmovisor"
DAEMON_NAME: "zetacored"
DAEMON_ALLOW_DOWNLOAD_BINARIES: "false"
DAEMON_RESTART_AFTER_UPGRADE: "true"
UNSAFE_SKIP_BACKUP: "true"
CLIENT_DAEMON_NAME: "zetaclientd"
CLIENT_DAEMON_ARGS: ""
CLIENT_SKIP_UPGRADE: "true"
CLIENT_START_PROCESS: "false"
MONIKER: local-test
RE_DO_START_SEQUENCE: "false"
ports:
- "26656:26656"
- "1317:1317"
- "8545:8545"
- "8546:8546"
- "26657:26657"
- "9090:9090"
- "9091:9091"
volumes:
- zetacored_data:/root/.zetacored/
entrypoint: bash /scripts/start.sh

volumes:
zetacored_data:
Loading

0 comments on commit 867fd83

Please sign in to comment.