Skip to content

Commit

Permalink
chore: prepare zetaclient v22.1.0 (#3152)
Browse files Browse the repository at this point in the history
* feat: whitelist connection gater (#3028)

* bump go tss to remove dht

* add whitelist fields

* disable whitelist for localnet

* bump go-tss

* resolve whitelisted peers wip

* dont disable whitelist in e2e tests

* cleanup whitelist fields from config and fix e2e tests

* bump go-tss

* cleanup

* bump go tss

* use node accounts to get whitelisted peers

* bump go tss

* changelog

* fix unit test

* bump go tss

* remove usage of pointers in node accounts

* fix unit test

* revert back to using keygen for whitelist peers

---------

Co-authored-by: Alex Gartner <[email protected]>

* fix: replace DHT with private peer discovery (#3041)

* import go-tss lib that removes DHT

* replace DHT with authenticated discovery

* use JSON serialization; add metric

* add new telemetry: 8123/connectedpeers; fix deadlock

in a few other 8123 handlers

* use squashed go-tss commit

* clean up interface

* address review comments

* remove whiteliste peers

* fmt

* remove rendezvous

* use merged go-tss connection gater

* use latest go-tss from PR#34

* use merged #34 in go-tss lib

* add ping RTT to telemetry

* changelog

* make linter happy

* pingrtt

* finer resolution on pingrtt time (milliseconds => nanoseconds)

* removed comments

* bump go-tss to the merged commit in master branch

* revert back to the go-tss commit

until the PR commit is merged.

---------

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

* skip depositor fee calculation on irrelevant txs

* update changelog

---------

Co-authored-by: skosito <[email protected]>
Co-authored-by: brewmaster012 <[email protected]>
Co-authored-by: pwu <[email protected]>
Co-authored-by: Charlie Chen <[email protected]>
  • Loading branch information
5 people authored Nov 14, 2024
1 parent f92effb commit 52fc6d0
Show file tree
Hide file tree
Showing 13 changed files with 263 additions and 345 deletions.
32 changes: 28 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# CHANGELOG

## v22.1.0

## Features

- [3028](https://github.com/zeta-chain/node/pull/3028) - whitelist connection gater

## Fixes

- [3041](https://github.com/zeta-chain/node/pull/3041) - replace DHT with private peer discovery
- [3162](https://github.com/zeta-chain/node/pull/3162) - skip depositor fee calculation on irrelevant transactions

## v22.0.2

## Fixes

- [3144](https://github.com/zeta-chain/node/pull/3145) - out of gas on ZetaClient during `onRevert`

## v22.0.1

## Fixes

- [3140](https://github.com/zeta-chain/node/pull/3140) - allow BTC revert with dust amount

## v22.0.0

## Refactor
Expand Down Expand Up @@ -28,6 +51,7 @@
* [2979](https://github.com/zeta-chain/node/pull/2979) - add fungible keeper ability to lock/unlock ZRC20 tokens
* [3012](https://github.com/zeta-chain/node/pull/3012) - integrate authenticated calls erc20 smart contract functionality into protocol
* [3025](https://github.com/zeta-chain/node/pull/3025) - standard memo for Bitcoin inbound
* [3028](https://github.com/zeta-chain/node/pull/3028) - whitelist connection gater

### Refactor

Expand Down Expand Up @@ -141,7 +165,7 @@
* [2518](https://github.com/zeta-chain/node/pull/2518) - add support for Solana address in zetacore
* [2483](https://github.com/zeta-chain/node/pull/2483) - add priorityFee (gasTipCap) gas to the state
* [2567](https://github.com/zeta-chain/node/pull/2567) - add sign latency metric to zetaclient (zetaclient_sign_latency)
* [2524](https://github.com/zeta-chain/node/pull/2524) - add inscription envelop parsing
* [2524](https://github.com/zeta-chain/node/pull/2524) - add inscription envelop parsing
* [2560](https://github.com/zeta-chain/node/pull/2560) - add support for Solana SOL token withdraw
* [2533](https://github.com/zeta-chain/node/pull/2533) - parse memo from both OP_RETURN and inscription
* [2765](https://github.com/zeta-chain/node/pull/2765) - bitcoin depositor fee improvement
Expand Down Expand Up @@ -223,7 +247,7 @@

### CI

* [2388](https://github.com/zeta-chain/node/pull/2388) - added GitHub attestations of binaries produced in the release workflow.
* [2388](https://github.com/zeta-chain/node/pull/2388) - added GitHub attestations of binaries produced in the release workflow.
* [2285](https://github.com/zeta-chain/node/pull/2285) - added nightly EVM performance testing pipeline, modified localnet testing docker image to utilize debian:bookworm, removed build-jet runners where applicable, removed deprecated/removed upgrade path testing pipeline
* [2268](https://github.com/zeta-chain/node/pull/2268) - updated the publish-release pipeline to utilize the Github Actions Ubuntu 20.04 Runners
* [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
Expand Down Expand Up @@ -635,7 +659,7 @@ Getting the correct TSS address for Bitcoin now requires providing the Bitcoin c

### Tests

* Add unit tests for adding votes to a ballot
* Add unit tests for adding votes to a ballot

### CI

Expand Down Expand Up @@ -675,7 +699,7 @@ Getting the correct TSS address for Bitcoin now requires providing the Bitcoin c
### Refactoring

* [1226](https://github.com/zeta-chain/node/pull/1226) - call `onCrossChainCall` when depositing to a contract
* [1238](https://github.com/zeta-chain/node/pull/1238) - change default mempool version in config
* [1238](https://github.com/zeta-chain/node/pull/1238) - change default mempool version in config
* [1279](https://github.com/zeta-chain/node/pull/1279) - remove duplicate funtion name IsEthereum
* [1289](https://github.com/zeta-chain/node/pull/1289) - skip gas stability pool funding when gasLimit is equal gasUsed

Expand Down
229 changes: 0 additions & 229 deletions cmd/zetaclientd/p2p_diagnostics.go

This file was deleted.

58 changes: 50 additions & 8 deletions cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ import (
"os/signal"
"path/filepath"
"strings"
"sync"
"syscall"
"time"

"github.com/cometbft/cometbft/crypto/secp256k1"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/p2p/protocol/ping"
maddr "github.com/multiformats/go-multiaddr"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"gitlab.com/thorchain/tss/go-tss/conversion"

"github.com/zeta-chain/node/pkg/authz"
"github.com/zeta-chain/node/pkg/chains"
Expand Down Expand Up @@ -179,13 +183,6 @@ func start(_ *cobra.Command, _ []string) error {
log.Error().Err(err).Msg("peer address error")
}
initPreParams(cfg.PreParamsPath)
if cfg.P2PDiagnostic {
err := RunDiagnostics(startLogger, peers, hotkeyPk, cfg)
if err != nil {
startLogger.Error().Err(err).Msg("RunDiagnostics error")
return err
}
}

m, err := metrics.NewMetrics()
if err != nil {
Expand All @@ -204,8 +201,19 @@ func start(_ *cobra.Command, _ []string) error {
}

telemetryServer.SetIPAddress(cfg.PublicIP)

keygen := appContext.GetKeygen()
whitelistedPeers := []peer.ID{}
for _, pk := range keygen.GranteePubkeys {
pid, err := conversion.Bech32PubkeyToPeerID(pk)
if err != nil {
return err
}
whitelistedPeers = append(whitelistedPeers, pid)
}

// Create TSS server
server, err := mc.SetupTSSServer(peers, priKey, preParams, appContext.Config(), tssKeyPass, true)
server, err := mc.SetupTSSServer(peers, priKey, preParams, appContext.Config(), tssKeyPass, true, whitelistedPeers)
if err != nil {
return fmt.Errorf("SetupTSSServer error: %w", err)
}
Expand All @@ -222,6 +230,40 @@ func start(_ *cobra.Command, _ []string) error {
signalChannel <- syscall.SIGTERM
})

go func() {
for {
time.Sleep(30 * time.Second)
ps := server.GetKnownPeers()
metrics.NumConnectedPeers.Set(float64(len(ps)))
telemetryServer.SetConnectedPeers(ps)
}
}()
go func() {
host := server.GetP2PHost()
pingRTT := make(map[peer.ID]int64)
for {
var wg sync.WaitGroup
for _, p := range whitelistedPeers {
wg.Add(1)
go func(p peer.ID) {
defer wg.Done()
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
result := <-ping.Ping(ctx, host, p)
if result.Error != nil {
masterLogger.Error().Err(result.Error).Msg("ping error")
pingRTT[p] = -1 // RTT -1 indicate ping error
return
}
pingRTT[p] = result.RTT.Nanoseconds()
}(p)
}
wg.Wait()
telemetryServer.SetPingRTT(pingRTT)
time.Sleep(30 * time.Second)
}
}()

// Generate a new TSS if keygen is set and add it into the tss server
// If TSS has already been generated, and keygen was successful ; we use the existing TSS
err = GenerateTSS(ctx, masterLogger, zetacoreClient, server)
Expand Down
Loading

0 comments on commit 52fc6d0

Please sign in to comment.