Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace DHT with private peer discovery #3041

Merged
merged 25 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ab5ac3d
import go-tss lib that removes DHT
brewmaster012 Oct 23, 2024
84a4b29
replace DHT with authenticated discovery
brewmaster012 Oct 25, 2024
331a424
use JSON serialization; add metric
robbwu Oct 25, 2024
21d9d7b
add new telemetry: 8123/connectedpeers; fix deadlock
robbwu Oct 25, 2024
102ccc1
use squashed go-tss commit
brewmaster012 Oct 25, 2024
7e439f2
clean up interface
brewmaster012 Oct 25, 2024
e927e2a
address review comments
brewmaster012 Oct 25, 2024
e772dd6
remove whiteliste peers
brewmaster012 Oct 25, 2024
46c1b60
fmt
brewmaster012 Oct 25, 2024
193dae7
remove rendezvous
brewmaster012 Oct 25, 2024
4394f95
use merged go-tss connection gater
brewmaster012 Oct 28, 2024
743d7cc
use latest go-tss from PR#34
brewmaster012 Oct 29, 2024
a910235
use merged #34 in go-tss lib
brewmaster012 Oct 31, 2024
0e817c3
merged origin/develop
brewmaster012 Oct 31, 2024
26f14d3
add ping RTT to telemetry
brewmaster012 Oct 31, 2024
29eece3
changelog
brewmaster012 Nov 1, 2024
1c9e3ad
make linter happy
brewmaster012 Nov 2, 2024
0e5cf02
pingrtt
brewmaster012 Nov 2, 2024
2aeb341
finer resolution on pingrtt time (milliseconds => nanoseconds)
brewmaster012 Nov 2, 2024
ee9ddd4
Merge remote-tracking branch 'origin/develop' into dht-removal
brewmaster012 Nov 4, 2024
ab06660
removed comments
brewmaster012 Nov 4, 2024
b79af05
Merge remote-tracking branch 'origin/develop' into dht-removal
brewmaster012 Nov 4, 2024
737dafd
Merge remote-tracking branch 'origin/develop' into dht-removal
brewmaster012 Nov 6, 2024
6d5eaa9
bump go-tss to the merged commit in master branch
brewmaster012 Nov 6, 2024
e5b77df
revert back to the go-tss commit
brewmaster012 Nov 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
## Unreleased

### Features

* [2984](https://github.com/zeta-chain/node/pull/2984) - add Whitelist message ability to whitelist SPL tokens on Solana
* [3091](https://github.com/zeta-chain/node/pull/3091) - improve build reproducability. `make release{,-build-only}` checksums should now be stable.

### Tests
* [3075](https://github.com/zeta-chain/node/pull/3075) - ton: withdraw concurrent, deposit & revert.

### Refactor

### Tests

### Fixes
* [3041](https://github.com/zeta-chain/node/pull/3041) - replace libp2p public DHT with private gossip peer discovery and connection gater for inbound connections


## v21.0.0

### Features
Expand Down Expand Up @@ -150,7 +157,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 @@ -232,7 +239,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 @@ -644,7 +651,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 @@ -684,7 +691,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
230 changes: 0 additions & 230 deletions cmd/zetaclientd/p2p_diagnostics.go

This file was deleted.

43 changes: 36 additions & 7 deletions cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ 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"
Expand Down Expand Up @@ -181,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 Down Expand Up @@ -235,6 +230,40 @@ func start(_ *cobra.Command, _ []string) error {
signalChannel <- syscall.SIGTERM
})

go func() {
brewmaster012 marked this conversation as resolved.
Show resolved Hide resolved
for {
time.Sleep(30 * time.Second)
brewmaster012 marked this conversation as resolved.
Show resolved Hide resolved
ps := server.GetKnownPeers()
brewmaster012 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading