Skip to content

Commit

Permalink
feat: v11.0.0 (#1444)
Browse files Browse the repository at this point in the history
* feat: zeta supply checks (#1358)

* chore: improve changelogs format (#1390)

* sort changelogs

* refactor format

* comment

* fix(`crosschain`): use event index in inbound tx digest (#1372)

* add event index in observer inbound

* rename messages

* update method usage

* use event index

* fix cosmos-gosec

* depositor contract

* smoketest refactor

* fix contracts

* mutiple deposits smoke tests

* fix depositor

* withdrawer contract

* fix smoketest deposits

* fix withdrawer contract

* multiple withdraw test

* fix contracts

* fix withdraws

* update changelog

* fix: cherry pick v10.1.x hotfix (minRelayTxFee and bitcoin mainnet/testnet address format) (#1367)

* skip some more recent garbage outTx trackers

* skip garbage trackers and increase btc gas fee

* skip mainnet addresses in cctxs

* cherry picked minRelayTxFee hotfix and bitcoin testnet/mainnet address format fix

* resolve conflict

* update CHANGELOG.md for v10.1.x hotfix

---------

Co-authored-by: charliec <[email protected]>
Co-authored-by: brewmaster012 <[email protected]>

* feat: update observer (#1384)

* chore: add chain id to localnet and open port 26657 to make local testing easier.  (#1401)

* added chain id to configs

* mapped port 26657 to localhost

* feat: Add HSM capability for zetaclient hot key - non production (#1387)

* initial commit

* Added sign function and unit test

* hsm config updates

* introduce hsm mode

* added commands to get address and generate key in hsm

* skipping unit test as it will fail in CI

* ran make generate and fixed lint errors

* Update cmd/zetaclientd/hsm.go

Co-authored-by: Lucas Bertrand <[email protected]>

* Update zetaclient/broadcast.go

Co-authored-by: Lucas Bertrand <[email protected]>

* Update zetaclient/broadcast.go

Co-authored-by: Lucas Bertrand <[email protected]>

* Update zetaclient/hsm_signer.go

Co-authored-by: Lucas Bertrand <[email protected]>

* Update zetaclient/hsm_signer.go

Co-authored-by: Lucas Bertrand <[email protected]>

* Update zetaclient/hsm_signer.go

Co-authored-by: Lucas Bertrand <[email protected]>

* cleanup

* added config for hsm hotkey name and moved hsm mode flag to zetabridge cfg

* add entry to changelog.

* moved hsm to new package and added build flag for unit test

* add changelog entry

* fix lint errors

---------

Co-authored-by: Lucas Bertrand <[email protected]>

* fix: speed up evm outtx inclusion and improve log prints (#1406)

Co-authored-by: charliec <[email protected]>

* docs: add code freeze note (#1414)

* zetaclient: allow one 1 event that remotely calls zEVM contract per tx

* revert the accidental last commit

* include bitcoin outtx regardless of the cctx status (#38)

* refactor: condense logging for a supply checker  (#9)

* chore: increment handler version (#5)

Co-authored-by: Lucas Bertrand <[email protected]>

* test: add tests for out tx tracker (#10)

* add tests fro out ts tracker

* use getEthereumChainID function in tests

---------

Co-authored-by: Lucas Bertrand <[email protected]>

* fix: Zellic-3.7 - Add check for existing contract address to avoid overwriting. (#13)

* add check for existing contract address to avoid overwriting.

* Added check for redeployment of gas and asset token contracts
Added unit test for this scenario

* update changelog

---------

Co-authored-by: Lucas Bertrand <[email protected]>

* fix: Zellic-3.2 - prevent deposit when zrc20 is paused (#31)

* add pause check

* revert on paused

* update tests

* add smoke test check

* goimports

* changelog

* Update x/crosschain/keeper/evm_deposit.go

Co-authored-by: Charlie Chen <[email protected]>

---------

Co-authored-by: Charlie Chen <[email protected]>

* test: ballot tests (#17)

* refactor(`fungible`): use code hash in `MsgUpdateContractBytecode` to allow for rollback (#23)

* code hash request

* make generate

* udpate message

* add cli command

* udpate smoke tests

* changelog

* update message name

* add check for length

* replace log with event

* add is contract check

* refactor: consolidate builds (#22)

* remove begin block

* remove build from smoketest

* deploy system contracts message

* msg tx

* add system contract deployment in smoke tests

* start core params refactor

* changelog

* refactor chains

* config refactor

* remaining build tags

* lint issues

* lint issues 2

* gen docs

* gen docs 2

* gosec issues 1

* fix cosmos nosec

* lint issues

* fix core params check

* make generate

* fix assign

* use privnet chains by default

* fix chain fetching

* use local goerli for smoke tests

* remove unamed gosec

* address nosec

* other goerli net to rename in smoketests

* gosec

* nosec alerts

* nosec alert 2

* use Bitcoin specific network

* fix address system contracts

* add logs in test

* Add more logs

* test remaining smoke tests

* remove hardcoded ZetaChain chain ID

* remove bitcoin hardcoded values

* add back smoketests

* fix smoke test except cross chain swap

* make generate

* add log message

* fix evm swap contract

* fix unit test 1

* fix CLI tests

* make generate

* fix log error

* fix Bitcoin proof test

* fix address test

* remove network flag and improve smoke tests

* add admin group

* move core params out of genesis

* remove unnecessary RemoveInTxTrackerIfExists

* add check for contract failure

* Update x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go

Co-authored-by: Tanmay <[email protected]>

* fix install in action

* improve events for system contract deploy

* error handling for bitcoin net params

* add utility functions in common

* add stateful smoketest from source

* try test fix

* fix unit test

* fix tests

---------

Co-authored-by: Tanmay <[email protected]>

* refactor: disable zeta supply checker routine (#45)

* docs: update changelog with v11.0.0

* chore: update go releaser

---------

Co-authored-by: Tanmay <[email protected]>
Co-authored-by: Lucas Bertrand <[email protected]>
Co-authored-by: Charlie Chen <[email protected]>
Co-authored-by: charliec <[email protected]>
Co-authored-by: brewmaster012 <[email protected]>
Co-authored-by: Charlie <[email protected]>
Co-authored-by: kevinssgh <[email protected]>
  • Loading branch information
8 people authored Dec 19, 2023
1 parent 4841dfd commit 689c824
Show file tree
Hide file tree
Showing 260 changed files with 10,865 additions and 3,512 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
GOOS: linux
GOARCH: ${{ env.CPU_ARCH }}
run: |
make install-testnet
make install
cp "$HOME"/go/bin/* ./
chmod a+x ./zetacored
./zetacored version
Expand Down
98 changes: 9 additions & 89 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
- CC_linux_amd64=x86_64-linux-gnu-gcc
- CXX_linux_amd64=x86_64-linux-gnu-g++
- CC_windows_amd64=x86_64-w64-mingw32-gcc
- CXX_windows_amd64=x86_64-w64-mingw32-g++
- CXX_windows_amd64=x86_64-w64-mingw32-g++
- VERSION={{ .Version }}
- COMMIT={{ .Commit }}
- BUILDTIME={{ .Date }}
Expand All @@ -32,9 +32,9 @@ before:
- go mod tidy

builds:
- id: "zetacored_testnet"
- id: "zetacored"
main: ./cmd/zetacored
binary: "zetacored_testnet-{{ .Os }}-{{ .Arch }}"
binary: "zetacored-{{ .Os }}-{{ .Arch }}"
env:
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
Expand All @@ -48,9 +48,8 @@ builds:
ignore:
- goos: windows
goarch: arm64
flags: &default_testnet_flags
- -tags=TESTNET,pebbledb,ledger,cgo,netgo
- -installsuffix=static
flags: &default_flags
- -tags=pebbledb,ledger
ldflags: &default_ldflags
- -X github.com/cosmos/cosmos-sdk/version.Name=zetacore
- -X github.com/cosmos/cosmos-sdk/version.ServerName=zetacored
Expand All @@ -61,11 +60,11 @@ builds:
- -X github.com/zeta-chain/zetacore/common.Version={{ .Version }}
- -X github.com/zeta-chain/zetacore/common.CommitHash={{ .Env.COMMIT }}
- -X github.com/zeta-chain/zetacore/common.BuildTime=={{ .Env.BUILDTIME }}
- -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb
- -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb

- id: "zetaclientd_testnet"
- id: "zetaclientd"
main: ./cmd/zetaclientd
binary: "zetaclientd_testnet-{{ .Os }}-{{ .Arch }}"
binary: "zetaclientd-{{ .Os }}-{{ .Arch }}"
env:
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
Expand All @@ -79,88 +78,9 @@ builds:
ignore:
- goos: windows
goarch: arm64
flags: *default_testnet_flags
flags: *default_flags
ldflags: *default_ldflags

- id: "zetacored_mock_mainnet"
main: ./cmd/zetacored
binary: "zetacored_mock_mainnet-{{ .Os }}-{{ .Arch }}"
env:
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
goos:
- linux
- darwin
- windows
goarch:
- arm64
- amd64
ignore:
- goos: windows
goarch: arm64
flags: &default_mock_mainnet_flags
- -tags=MOCK_MAINNET,pebbledb,ledger,cgo
ldflags: *default_ldflags

- id: "zetaclientd_mock_mainnet"
main: ./cmd/zetaclientd
binary: "zetaclientd_mock_mainnet-{{ .Os }}-{{ .Arch }}"
env:
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
goos:
- linux
# - darwin
# - windows
goarch:
- arm64
- amd64
ignore:
- goos: windows
goarch: arm64
flags: *default_mock_mainnet_flags
ldflags: *default_ldflags

- id: "zetacored_mainnet"
main: ./cmd/zetacored
binary: "zetacored_mainnet-{{ .Os }}-{{ .Arch }}"
env:
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
goos:
- linux
- darwin
- windows
goarch:
- arm64
- amd64
ignore:
- goos: windows
goarch: arm64
flags: &default_mainnet_flags
- -tags=pebbledb,ledger,cgo
ldflags: *default_ldflags

- id: "zetaclientd_mainnet"
main: ./cmd/zetaclientd
binary: "zetaclientd_mainnet-{{ .Os }}-{{ .Arch }}"
env:
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
goos:
- linux
# - darwin
# - windows
goarch:
- arm64
- amd64
ignore:
- goos: windows
goarch: arm64
flags: *default_mainnet_flags
ldflags: *default_ldflags


archives:
- format: binary
name_template: "{{ .Binary }}"
Expand Down
72 changes: 72 additions & 0 deletions Dockerfile-versioned-source
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
FROM golang:1.19-alpine

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

ARG old_version

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 ""

WORKDIR /go/delivery/zeta-node

RUN mkdir -p $GOPATH/bin/old
RUN mkdir -p $GOPATH/bin/new

ENV NEW_VERSION=v42.0.0

# 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-smoketest
RUN cp $GOPATH/bin/zetacored $GOPATH/bin/new/
RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/new/
RUN cp $GOPATH/bin/smoketest $GOPATH/bin/new/

# Checkout and build old binary
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 cd node && make install-smoketest
RUN cp $GOPATH/bin/zetacored $GOPATH/bin/old/
RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/old/
RUN cp $GOPATH/bin/smoketest $GOPATH/bin/old/

RUN git clone https://github.com/zeta-chain/cosmos-sdk.git
RUN cd cosmos-sdk && git checkout zetavisor-v0.1.5
RUN cd cosmos-sdk/cosmovisor && make zetavisor
#
#FROM golang:1.19-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/smoketest /usr/local/bin
RUN cp /go/bin/zetavisor /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"]
102 changes: 49 additions & 53 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \
-X github.com/zeta-chain/zetacore/common.BuildTime=$(BUILDTIME) \
-X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb

BUILD_FLAGS := -ldflags '$(ldflags)' -tags PRIVNET,pebbledb,ledger
TESTNET_BUILD_FLAGS := -ldflags '$(ldflags)' -tags TESTNET,pebbledb,ledger
MOCK_MAINNET_BUILD_FLAGS := -ldflags '$(ldflags)' -tags MOCK_MAINNET,pebbledb,ledger
MAINNET_BUILD_FLAGS := -ldflags '$(ldflags)' -tags pebbledb,ledger
BUILD_FLAGS := -ldflags '$(ldflags)' -tags pebbledb,ledger

TEST_DIR?="./..."
TEST_BUILD_FLAGS := -tags TESTNET,pebbledb,ledger
PRIV_BUILD_FLAGS := -tags PRIVNET,pebbledb,ledger
TEST_BUILD_FLAGS := -tags pebbledb,ledger
HSM_BUILD_FLAGS := -tags pebbledb,ledger,hsm_test

clean: clean-binaries clean-dir clean-test-dir clean-coverage

Expand All @@ -39,6 +36,22 @@ clean-dir:

all: install

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify

###############################################################################
### Test commands ###
###############################################################################

run-test:
@go test ${TEST_BUILD_FLAGS} ${TEST_DIR}

test :clean-test-dir run-test

test-hsm:
@go test ${HSM_BUILD_FLAGS} ${TEST_DIR}

test-coverage-exclude-core:
@go test ${TEST_BUILD_FLAGS} -v -coverprofile coverage.out $(go list ./... | grep -v /x/zetacore/)

Expand All @@ -57,21 +70,9 @@ clean-test-dir:
@rm -rf x/crosschain/client/querytests/.zetacored
@rm -rf x/observer/client/querytests/.zetacored

run-test:
@go test ${TEST_BUILD_FLAGS} ${TEST_DIR}

test :clean-test-dir run-test

test-priv:
@go test ${PRIV_BUILD_FLAGS} ${TEST_DIR}

gosec:
gosec -exclude-dir=localnet ./...

install-testnet: go.sum
@echo "--> Installing zetacored & zetaclientd"
@go install -mod=readonly $(TESTNET_BUILD_FLAGS) ./cmd/zetacored
@go install -mod=readonly $(TESTNET_BUILD_FLAGS) ./cmd/zetaclientd
###############################################################################
### Install commands ###
###############################################################################

build-testnet-ubuntu: go.sum
docker build -t zetacore-ubuntu --platform linux/amd64 -f ./Dockerfile-athens3-ubuntu .
Expand All @@ -85,44 +86,26 @@ install: go.sum
@go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored
@go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd

install-mainnet: go.sum
@echo "--> Installing zetacored & zetaclientd"
@go install -mod=readonly $(MAINNET_BUILD_FLAGS) ./cmd/zetacored
@go install -mod=readonly $(MAINNET_BUILD_FLAGS) ./cmd/zetaclientd

install-mock-mainnet: go.sum
@echo "--> Installing zetacored & zetaclientd"
@go install -mod=readonly $(MOCK_MAINNET_BUILD_FLAGS) ./cmd/zetacored
@go install -mod=readonly $(MOCK_MAINNET_BUILD_FLAGS) ./cmd/zetaclientd


install-zetaclient: go.sum
@echo "--> Installing zetaclientd"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd

# running with race detector on will be slow
install-zetaclient-race-test-only-build: go.sum
@echo "--> Installing zetaclientd"
@go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd

install-zetacore: go.sum
@echo "--> Installing zetacored"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored

install-zetacore-testnet: go.sum
@echo "--> Installing zetacored"
@go install -mod=readonly $(TESTNET_BUILD_FLAGS) ./cmd/zetacored
# running with race detector on will be slow
install-zetaclient-race-test-only-build: go.sum
@echo "--> Installing zetaclientd"
@go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd

install-smoketest: go.sum
@echo "--> Installing orchestrator"
@go install -mod=readonly $(BUILD_FLAGS) ./contrib/localnet/orchestrator/smoketest

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify

test-cctx:
./standalone-network/cctx-creator.sh
###############################################################################
### Local network ###
###############################################################################

init:
./standalone-network/init.sh
Expand All @@ -136,12 +119,12 @@ chain-stop:
@killall zetacored
@killall tail

test-cctx:
./standalone-network/cctx-creator.sh

chain-init-testnet: clean install-zetacore-testnet init
chain-run-testnet: clean install-zetacore-testnet init run

chain-init-mock-mainnet: clean install-mock-mainnet init
chain-run-mock-mainnet: clean install-mock-mainnet init run
###############################################################################
### Linting ###
###############################################################################

lint-pre:
@test -z $(gofmt -l .)
Expand All @@ -153,6 +136,13 @@ lint: lint-pre
lint-cosmos-gosec:
@bash ./scripts/cosmos-gosec.sh

gosec:
gosec -exclude-dir=localnet ./...

###############################################################################
### Generation commands ###
###############################################################################

proto:
@echo "--> Removing old Go types "
@find . -name '*.pb.go' -type f -delete
Expand Down Expand Up @@ -193,7 +183,7 @@ generate: proto openapi specs typescript docs-zetacored
.PHONY: generate

###############################################################################
### Docker Images ###
### Smoke tests ###
###############################################################################

zetanode:
Expand Down Expand Up @@ -237,13 +227,19 @@ stateful-upgrade:
$(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile-upgrade.fastbuild .
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stateful.yml up -d

stateful-upgrade-source:
@echo "--> Starting stateful smoketest"
$(DOCKER) build --build-arg old_version=v10.1.7 -t zetanode -f ./Dockerfile-versioned-source .
$(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile-upgrade.fastbuild .
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stateful.yml up -d

stop-stateful-upgrade:
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stateful.yml down --remove-orphans


###############################################################################
### GoReleaser ###
###############################################################################

PACKAGE_NAME := github.com/zeta-chain/node
GOLANG_CROSS_VERSION ?= v1.20
GOPATH ?= '$(HOME)/go'
Expand Down
Loading

0 comments on commit 689c824

Please sign in to comment.