Skip to content

Commit

Permalink
Merge branch 'develop' into remove-redundant-ValidateBasic-check
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis authored Jan 3, 2024
2 parents 93eb43f + 8c903c9 commit f6e868c
Show file tree
Hide file tree
Showing 91 changed files with 4,913 additions and 2,266 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ jobs:
run: rm -rf *

smoke-test:
runs-on: ["zeta-runners"] # 25 minutes
timeout-minutes: 35
runs-on: ["zeta-runners"]
timeout-minutes: 25
steps:
- uses: actions/checkout@v3

Expand All @@ -104,16 +104,19 @@ jobs:
skip_aws_cli: "true"
skip_docker_compose: "false"

- name: Login to Docker Hub
uses: docker/login-action@v2
if: github.event.repository.full_name == 'zetachain-chain/node'
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_READ_ONLY }}
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# if: github.event.repository.full_name == 'zetachain-chain/node'
# with:
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_READ_ONLY }}

- name: Start Private Network
- name: Build zetanode
run: |
make zetanode
- name: Start Private Network
run: |
cd contrib/localnet/
docker compose up -d zetacore0 zetacore1 zetaclient0 zetaclient1 eth bitcoin
Expand All @@ -125,7 +128,6 @@ jobs:
echo "Smoke Test Failed"
exit 1
fi
sleep 10
- name: Stop Private Network
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sast-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
with:
version: v1.54
skip-cache: true
args: --timeout=20m
args: --out-format=json

nosec_alert:
runs-on: ubuntu-latest
Expand Down
17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ 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 --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-smoketest
#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

Expand All @@ -29,7 +32,7 @@ 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/zetae2e /usr/local/bin

COPY contrib/localnet/scripts /root
COPY contrib/localnet/preparams /root/preparams
Expand Down
23 changes: 17 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ build-testnet-ubuntu: go.sum

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

install-zetaclient: go.sum
@echo "--> Installing zetaclientd"
Expand All @@ -99,10 +99,6 @@ 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/cmd/smoketest

###############################################################################
### Local network ###
###############################################################################
Expand Down Expand Up @@ -182,10 +178,25 @@ mocks:
generate: proto openapi specs typescript docs-zetacored
.PHONY: generate

###############################################################################
### E2E tests ###
###############################################################################

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

###############################################################################
### Smoke tests ###
###############################################################################

# Note: smoke tests are deprecated and will be removed in the future, replaced with e2e tests

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

zetanode:
@echo "Building zetanode"
$(DOCKER) build -t zetanode -f ./Dockerfile .
Expand Down
57 changes: 40 additions & 17 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,83 @@
## Unreleased

### Breaking Changes
- PendingNonces :Changed from `/zeta-chain/crosschain/pendingNonces/{chain_id}/{address}` to `/zeta-chain/observer/pendingNonces/{chain_id}/{address}` . It returns all the pending nonces for a chain id and address. This returns the current pending nonces for the chain.
- ChainNonces : Changed from `/zeta-chain/criosschain/chainNonces/{chain_id}` to`/zeta-chain/observer/chainNonces/{chain_id}` . It returns all the chain nonces for a chain id. This returns the current nonce oof the TSS address for the chain.
- 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.

* PendingNonces :Changed from `/zeta-chain/crosschain/pendingNonces/{chain_id}/{address}` to `/zeta-chain/observer/pendingNonces/{chain_id}/{address}` . It returns all the pending nonces for a chain id and address. This returns the current pending nonces for the chain.
* ChainNonces : Changed from `/zeta-chain/criosschain/chainNonces/{chain_id}` to`/zeta-chain/observer/chainNonces/{chain_id}` . It returns all the chain nonces for a chain id. This returns the current nonce oof the TSS address for the chain.
* 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

* [1395](https://github.com/zeta-chain/node/pull/1395) - Add state variable to track aborted zeta amount
* [1387](https://github.com/zeta-chain/node/pull/1387) - Add HSM capability for zetaclient hot key
* [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
* add static chain data for Sepolia testnet
* added metrics to track the burn rate of the hotkey in the telemetry server as well as prometheus

### Fixes
* fix Code4rena issue - zetaclients potentially miss inTx when PostSend (or other RPC) fails
* fix go-staticcheck warnings for zetaclient
* fix Athens-3 issue - incorrect pending-tx inclusion and incorrect confirmation count
* 6582f6b42f4f0eb0358e6fdefe5278295c791166 - masked zetaclient config at startup
* 1b8fdd3394c35afa47e830a5858b3c5c133fad8e - Added check for redeployment of gas and asset token contracts
* [1372](https://github.com/zeta-chain/node/pull/1372) - Include Event Index as part for inbound tx digest
* [1367](https://github.com/zeta-chain/node/pull/1367) - fix minRelayTxFee issue and check misuse of bitcoin mainnet/testnet addresses
* [1358](https://github.com/zeta-chain/node/pull/1358) - add a new thread to zetaclient which checks zeta supply in all connected chains in every block
* prevent deposits for paused zrc20
* [1406](https://github.com/zeta-chain/node/pull/1406) - improve log prints and speed up evm outtx inclusion
* fix Athens-3 issue - include bitcoin outtx regardless of the cctx status
* masked zetaclient config at startup
* set limit for queried pending cctxs
* add check to verify new tss has been produced when triggering tss funds migration
* fix Athens-3 log print issue - avoid posting uncessary outtx confirmation
* fix docker build issues with version: golang:1.20-alpine3.18

### Refactoring

* [1211](https://github.com/zeta-chain/node/issues/1211) - use `grpc` and `msg` for query and message files
* refactor cctx scheduler - decouple evm cctx scheduler from btc cctx scheduler
* [1391](https://github.com/zeta-chain/node/pull/1391) - consolidate node builds
* update `MsgUpdateContractBytecode` to use code hash instead of contract address
* move tss state from crosschain to observer
* move pending nonces, chain nonces and nonce to cctx to observer
* move tss related cli from crosschain to observer
* reorganize smoke tests structure
* Add pagination to queries which iterate over large data sets InTxTrackerAll ,PendingNoncesAll ,AllBlameRecord ,TssHistory
* GetTssAddress now returns only the current tss address for ETH and BTC
* Add a new query GetTssAddressesByFinalizedBlockHeight to get any other tss addresses for a finalized block height
* Add logger to smoke tests

### Chores

* [1442](https://github.com/zeta-chain/node/pull/1442) - remove build types in `.goreleaser.yaml`
* [1504](https://github.com/zeta-chain/node/pull/1504) - remove `-race` in the `make install` commmand

### Tests
- Add unit tests for adding votes to a ballot

### CI

## Version: v10.1.2
### Unreleased:
## Version: v11.0.0

### Features

* [1387](https://github.com/zeta-chain/node/pull/1387) - Add HSM capability for zetaclient hot key
* add a new thread to zetaclient which checks zeta supply in all connected chains in every block
* add a new tx to update an observer, this can be either be run a tombstoned observer/validator or via admin_policy_group_2.

### Fixes

* Added check for redeployment of gas and asset token contracts
* [1372](https://github.com/zeta-chain/node/pull/1372) - Include Event Index as part for inbound tx digest
* [1367](https://github.com/zeta-chain/node/pull/1367) - fix minRelayTxFee issue and check misuse of bitcoin mainnet/testnet addresses
* [1358](https://github.com/zeta-chain/node/pull/1358) - add a new thread to zetaclient which checks zeta supply in all connected chains in every block
* prevent deposits for paused zrc20
* [1406](https://github.com/zeta-chain/node/pull/1406) - improve log prints and speed up evm outtx inclusion
* fix Athens-3 issue - include bitcoin outtx regardless of the cctx status

### Refactoring

* [1391](https://github.com/zeta-chain/node/pull/1391) - consolidate node builds
* update `MsgUpdateContractBytecode` to use code hash instead of contract address

### Chores

### Tests
- Add unit tests for adding votes to a ballot

### CI

## Version: v10.1.2

### Features
* [1137](https://github.com/zeta-chain/node/pull/1137) - external stress testing
* [1205](https://github.com/zeta-chain/node/pull/1205) - allow setting liquidity cap for ZRC20
Expand Down
120 changes: 120 additions & 0 deletions cmd/zetae2e/config/clients.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package config

import (
"context"

"google.golang.org/grpc"

"github.com/btcsuite/btcd/rpcclient"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/config"
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
)

// getClientsFromConfig get clients from config
func getClientsFromConfig(ctx context.Context, conf config.Config, evmPrivKey string) (
*rpcclient.Client,
*ethclient.Client,
*bind.TransactOpts,
crosschaintypes.QueryClient,
fungibletypes.QueryClient,
authtypes.QueryClient,
banktypes.QueryClient,
observertypes.QueryClient,
*ethclient.Client,
*bind.TransactOpts,
error,
) {
btcRPCClient, err := getBtcClient(conf.RPCs.Bitcoin)
if err != nil {
return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, err
}
goerliClient, goerliAuth, err := getEVMClient(ctx, conf.RPCs.EVM, evmPrivKey)
if err != nil {
return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, err
}
cctxClient, fungibleClient, authClient, bankClient, observerClient, err := getZetaClients(conf.RPCs.ZetaCoreGRPC)
if err != nil {
return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, err
}
zevmClient, zevmAuth, err := getEVMClient(ctx, conf.RPCs.Zevm, evmPrivKey)
if err != nil {
return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, err
}
return btcRPCClient,
goerliClient,
goerliAuth,
cctxClient,
fungibleClient,
authClient,
bankClient,
observerClient,
zevmClient,
zevmAuth,
nil
}

// getBtcClient get btc client
func getBtcClient(rpc string) (*rpcclient.Client, error) {
connCfg := &rpcclient.ConnConfig{
Host: rpc,
User: "smoketest",
Pass: "123",
HTTPPostMode: true,
DisableTLS: true,
Params: "testnet3",
}
return rpcclient.New(connCfg, nil)
}

// getEVMClient get goerli client
func getEVMClient(ctx context.Context, rpc, privKey string) (*ethclient.Client, *bind.TransactOpts, error) {
evmClient, err := ethclient.Dial(rpc)
if err != nil {
return nil, nil, err
}

chainid, err := evmClient.ChainID(ctx)
if err != nil {
return nil, nil, err
}
deployerPrivkey, err := crypto.HexToECDSA(privKey)
if err != nil {
return nil, nil, err
}
evmAuth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid)
if err != nil {
return nil, nil, err
}

return evmClient, evmAuth, nil
}

// getZetaClients get zeta clients
func getZetaClients(rpc string) (
crosschaintypes.QueryClient,
fungibletypes.QueryClient,
authtypes.QueryClient,
banktypes.QueryClient,
observertypes.QueryClient,
error,
) {
grpcConn, err := grpc.Dial(rpc, grpc.WithInsecure())
if err != nil {
return nil, nil, nil, nil, nil, err
}

cctxClient := crosschaintypes.NewQueryClient(grpcConn)
fungibleClient := fungibletypes.NewQueryClient(grpcConn)
authClient := authtypes.NewQueryClient(grpcConn)
bankClient := banktypes.NewQueryClient(grpcConn)
observerClient := observertypes.NewQueryClient(grpcConn)

return cctxClient, fungibleClient, authClient, bankClient, observerClient, nil
}
Loading

0 comments on commit f6e868c

Please sign in to comment.