mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
Post 2.1.0.15 optimizations (#491)
* implement tStringCast() for tests * make grpc dependency direct * import p2p module once * fix p2p-ping after blackhole detection deprecation
This commit is contained in:
parent
0425b38fa2
commit
51eafd35d4
@ -13,7 +13,6 @@ import (
|
||||
"github.com/libp2p/go-libp2p"
|
||||
"github.com/libp2p/go-libp2p/core/host"
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
"github.com/libp2p/go-libp2p/p2p/net/swarm"
|
||||
"github.com/libp2p/go-libp2p/p2p/protocol/ping"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
madns "github.com/multiformats/go-multiaddr-dns"
|
||||
@ -181,22 +180,6 @@ func createClient() (host.Host, error) {
|
||||
// This makes it a client-only node that can connect to others but doesn't accept connections
|
||||
opts := []libp2p.Option{
|
||||
libp2p.NoListenAddrs, // Don't listen on any addresses - client only
|
||||
libp2p.SwarmOpts(
|
||||
swarm.WithUDPBlackHoleSuccessCounter(
|
||||
&swarm.BlackHoleSuccessCounter{
|
||||
N: 8000,
|
||||
MinSuccesses: 1,
|
||||
Name: "permissive-udp",
|
||||
},
|
||||
),
|
||||
swarm.WithIPv6BlackHoleSuccessCounter(
|
||||
&swarm.BlackHoleSuccessCounter{
|
||||
N: 8000,
|
||||
MinSuccesses: 1,
|
||||
Name: "permissive-ip6",
|
||||
},
|
||||
),
|
||||
),
|
||||
}
|
||||
|
||||
return libp2p.New(opts...)
|
||||
|
||||
@ -30,6 +30,11 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func tStringCast(s string) ma.Multiaddr {
|
||||
st, _ := ma.StringCast(s)
|
||||
return st
|
||||
}
|
||||
|
||||
func TestAddrsForDial(t *testing.T) {
|
||||
mockResolver := madns.MockResolver{IP: make(map[string][]net.IPAddr)}
|
||||
ipaddr, err := net.ResolveIPAddr("ip4", "1.2.3.4")
|
||||
|
||||
@ -24,6 +24,7 @@ replace source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub => ../go-
|
||||
|
||||
require (
|
||||
github.com/prometheus/client_golang v1.22.0
|
||||
google.golang.org/grpc v1.72.0
|
||||
source.quilibrium.com/quilibrium/monorepo/protobufs v0.0.0-00010101000000-000000000000
|
||||
source.quilibrium.com/quilibrium/monorepo/types v0.0.0-00010101000000-000000000000
|
||||
source.quilibrium.com/quilibrium/monorepo/utils v0.0.0-00010101000000-000000000000
|
||||
@ -69,7 +70,7 @@ require (
|
||||
golang.org/x/text v0.26.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||
google.golang.org/grpc v1.72.0 // indirect
|
||||
|
||||
google.golang.org/protobuf v1.36.6 // indirect
|
||||
lukechampine.com/blake3 v1.4.1 // indirect
|
||||
)
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"source.quilibrium.com/quilibrium/monorepo/types/hypergraph"
|
||||
"source.quilibrium.com/quilibrium/monorepo/types/tries"
|
||||
"source.quilibrium.com/quilibrium/monorepo/utils/p2p"
|
||||
up2p "source.quilibrium.com/quilibrium/monorepo/utils/p2p"
|
||||
// up2p "source.quilibrium.com/quilibrium/monorepo/utils/p2p"
|
||||
)
|
||||
|
||||
// Commit calculates the hierarchical vector commitments of each set and returns
|
||||
@ -292,7 +292,7 @@ func (hg *HypergraphCRDT) CommitShard(
|
||||
return nil, errors.Wrap(errors.New("invalid shard address"), "commit shard")
|
||||
}
|
||||
|
||||
l1 := up2p.GetBloomFilterIndices(shardAddress[:32], 256, 3)
|
||||
l1 := p2p.GetBloomFilterIndices(shardAddress[:32], 256, 3)
|
||||
shardKey := tries.ShardKey{
|
||||
L1: [3]byte(l1),
|
||||
L2: [32]byte(shardAddress[:32]),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user