Skip to content

Commit

Permalink
Merge branch 'develop' into fix/chain-params-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis authored Jan 10, 2024
2 parents 5676f2c + 3283191 commit 9998de7
Show file tree
Hide file tree
Showing 51 changed files with 4,216 additions and 314 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/change-log-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog') }}
run: |
git fetch origin ${{ github.base_ref }}
CHANGELOG_DIFF=$(git diff origin/${{ github.base_ref }} origin/${{ github.head_ref }} -- changelog.md)
CHANGELOG_DIFF=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} -- changelog.md)
echo "${CHANGELOG_DIFF}"
if [ -z "$CHANGELOG_DIFF" ]; then
echo "ERROR: No changes detected in CHANGELOG.md. Please update the changelog."
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Pull Request Labeler"
on:
pull_request:
pull_request_target:
types:
- opened
- edited
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/publish-typescript.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,20 @@ jobs:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Install buf
run: |
curl -sSL https://github.com/bufbuild/buf/releases/download/v1.28.1/buf-Linux-x86_64 -o /usr/local/bin/buf
chmod +x /usr/local/bin/buf
- name: Generate
run: |
make typescript
- name: Set Version
working-directory: typescript
run: |
version=$(cat app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"')
version=$(cat ../app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"')
npm version ${version}
sed -i 's/@zetachain\/blockchain-types/@zetachain\/node-types/' package.json
- name: Install dependencies and build 🔧
working-directory: typescript
run: npm ci && npm run build
- name: Publish package on NPM 📦
run: npm publish
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,11 @@ localnet/ganache/storage
localnet/zetachain-monorepo
/standalone-network/authz/tx.json
/zetanode.log

# Blockscout Files
contrib/localnet/blockscout/services/blockscout-db-data/*
contrib/localnet/blockscout/services/logs/*
contrib/localnet/blockscout/services/redis-data/*
contrib/localnet/blockscout/services/stats-db-data/*
contrib/localnet/grafana/addresses.txt
contrib/localnet/addresses.txt
5 changes: 1 addition & 4 deletions Dockerfile-versioned
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-alpine
FROM golang:1.20-alpine3.18

ENV GOPATH /go
ENV GOOS=linux
Expand Down Expand Up @@ -38,10 +38,7 @@ 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

Expand Down
23 changes: 8 additions & 15 deletions Dockerfile-versioned-source
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-alpine
FROM golang:1.20-alpine3.18

ENV GOPATH /go
ENV GOOS=linux
Expand All @@ -9,51 +9,44 @@ 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 ""

# Build cosmovisor
RUN go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]

WORKDIR /go/delivery/zeta-node

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

ENV NEW_VERSION=v42.0.0
ENV NEW_VERSION=v12.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 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 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
RUN cp /go/bin/zetae2e /usr/local/bin
RUN cp /go/bin/cosmovisor /usr/local/bin

COPY contrib/localnet/scripts /root
COPY contrib/localnet/preparams /root/preparams
Expand Down
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,26 @@ stateful-upgrade:

stateful-upgrade-source:
@echo "--> Starting stateful smoketest"
$(DOCKER) build --build-arg old_version=v10.1.7 -t zetanode -f ./Dockerfile-versioned-source .
$(DOCKER) build --build-arg old_version=v11.0.0-patch-core-params -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

###############################################################################
### Monitoring ###
###############################################################################

start-monitoring:
@echo "Starting monitoring services"
cd contrib/localnet/grafana/ && ./get-tss-address.sh
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-monitoring.yml up -d

stop-monitoring:
@echo "Stopping monitoring services"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-monitoring.yml down

###############################################################################
### GoReleaser ###
###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion app/setup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
)

const releaseVersion = "v11.0.0"
const releaseVersion = "v12.0.0"

func SetupHandlers(app *App) {
app.UpgradeKeeper.SetUpgradeHandler(releaseVersion, func(ctx sdk.Context, plan types.Plan, vm module.VersionMap) (module.VersionMap, error) {
Expand Down
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* ChainNoncesAll :Changed from `/zeta-chain/observer/chainNonces` to `/zeta-chain/observer/chainNonces` . It returns all the chain nonces for all chains. This returns the current nonce of the TSS address for all chains.

### Features

* [1498](https://github.com/zeta-chain/node/pull/1498) - Add monitoring(grafana, prometheus, ethbalance) for localnet testing
* [1395](https://github.com/zeta-chain/node/pull/1395) - Add state variable to track aborted zeta amount
* [1410](https://github.com/zeta-chain/node/pull/1410) - `snapshots` commands
* enable zetaclients to use dynamic gas price on zetachain - enables >0 min_gas_price in feemarket module
Expand Down Expand Up @@ -59,6 +59,8 @@

### Tests

* [1538](https://github.com/zeta-chain/node/pull/1538) - improve stateful e2e testing

### CI
* Removed private runners and unused GitHub Action

Expand Down
6 changes: 3 additions & 3 deletions cmd/zetaclientd/start_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ func validatePeer(seedPeer string) error {
parsedPeer := strings.Split(seedPeer, "/")

if len(parsedPeer) < 7 {
return errors.New("seed peer missing IP or ID")
return errors.New("seed peer missing IP or ID or both, seed: " + seedPeer)
}

seedIP := parsedPeer[2]
seedID := parsedPeer[6]

if net.ParseIP(seedIP) == nil {
return errors.New("invalid seed IP address")
return errors.New("invalid seed IP address format, seed: " + seedPeer)
}

if len(seedID) == 0 {
return errors.New("seed id is empty")
return errors.New("seed id is empty, seed: " + seedPeer)
}

return nil
Expand Down
21 changes: 21 additions & 0 deletions cmd/zetae2e/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,24 @@ func RunnerFromConfig(

return sm, err
}

// ExportContractsFromRunner export contracts from the runner to config using a source config
func ExportContractsFromRunner(sm *runner.SmokeTestRunner, conf config.Config) config.Config {
// copy contracts from deployer runner
conf.Contracts.EVM.ZetaEthAddress = sm.ZetaEthAddr.Hex()
conf.Contracts.EVM.ConnectorEthAddr = sm.ConnectorEthAddr.Hex()
conf.Contracts.EVM.CustodyAddr = sm.ERC20CustodyAddr.Hex()
conf.Contracts.EVM.USDT = sm.USDTERC20Addr.Hex()

conf.Contracts.ZEVM.SystemContractAddr = sm.SystemContractAddr.Hex()
conf.Contracts.ZEVM.ETHZRC20Addr = sm.ETHZRC20Addr.Hex()
conf.Contracts.ZEVM.USDTZRC20Addr = sm.USDTZRC20Addr.Hex()
conf.Contracts.ZEVM.BTCZRC20Addr = sm.BTCZRC20Addr.Hex()
conf.Contracts.ZEVM.UniswapFactoryAddr = sm.UniswapV2FactoryAddr.Hex()
conf.Contracts.ZEVM.UniswapRouterAddr = sm.UniswapV2RouterAddr.Hex()
conf.Contracts.ZEVM.ZEVMSwapAppAddr = sm.ZEVMSwapAppAddr.Hex()
conf.Contracts.ZEVM.ContextAppAddr = sm.ContextAppAddr.Hex()
conf.Contracts.ZEVM.TestDappAddr = sm.TestDAppAddr.Hex()

return conf
}
28 changes: 28 additions & 0 deletions cmd/zetae2e/config/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import (
"github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-core/contracts/uniswapv2factory.sol"
uniswapv2router "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol"
"github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/config"
"github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/contextapp"
"github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/erc20"
"github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/zevmswap"
"github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner"
)

Expand Down Expand Up @@ -133,6 +135,32 @@ func setContractsFromConfig(r *runner.SmokeTestRunner, conf config.Config) error
return err
}
}
if c := conf.Contracts.ZEVM.ZEVMSwapAppAddr; c != "" {
if !ethcommon.IsHexAddress(c) {
return fmt.Errorf("invalid ZEVMSwapAppAddr: %s", c)
}
r.ZEVMSwapAppAddr = ethcommon.HexToAddress(c)
r.ZEVMSwapApp, err = zevmswap.NewZEVMSwapApp(r.ZEVMSwapAppAddr, r.ZevmClient)
if err != nil {
return err
}
}
if c := conf.Contracts.ZEVM.ContextAppAddr; c != "" {
if !ethcommon.IsHexAddress(c) {
return fmt.Errorf("invalid ContextAppAddr: %s", c)
}
r.ContextAppAddr = ethcommon.HexToAddress(c)
r.ContextApp, err = contextapp.NewContextApp(r.ContextAppAddr, r.ZevmClient)
if err != nil {
return err
}
}
if c := conf.Contracts.ZEVM.TestDappAddr; c != "" {
if !ethcommon.IsHexAddress(c) {
return fmt.Errorf("invalid TestDappAddr: %s", c)
}
r.TestDAppAddr = ethcommon.HexToAddress(c)
}

return nil
}
Loading

0 comments on commit 9998de7

Please sign in to comment.