Post 2.1.0.9 fixes (#474)

* implement Close() in MockPubSub

* add TODO context to newPubSubProxyClient constructor

* import types/tries package only once
This commit is contained in:
Black Swan 2025-11-19 08:02:18 +02:00 committed by GitHub
parent 215dd2ec99
commit 2b33fa2a74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 8 deletions

View File

@ -827,6 +827,10 @@ func (m *mockPubSub) GetNetworkInfo() *protobufs.NetworkInfoResponse {
return &protobufs.NetworkInfoResponse{}
}
func (m *mockPubSub) Close() error {
return nil
}
type mockTransaction struct{}
// Abort implements store.Transaction.

View File

@ -31,7 +31,6 @@ import (
"source.quilibrium.com/quilibrium/monorepo/protobufs"
application "source.quilibrium.com/quilibrium/monorepo/types/hypergraph"
"source.quilibrium.com/quilibrium/monorepo/types/tries"
crypto "source.quilibrium.com/quilibrium/monorepo/types/tries"
"source.quilibrium.com/quilibrium/monorepo/verenc"
)
@ -59,7 +58,7 @@ func TestHypergraphSyncServer(t *testing.T) {
data1 := enc.Encrypt(make([]byte, 20), pub)
verenc1 := data1[0].Compress()
vertices1 := make([]application.Vertex, numOperations)
dataTree1 := &crypto.VectorCommitmentTree{}
dataTree1 := &tries.VectorCommitmentTree{}
logger, _ := zap.NewDevelopment()
inclusionProver := bls48581.NewKZGInclusionProver(logger)
for _, d := range []application.Encrypted{verenc1} {
@ -273,7 +272,7 @@ func TestHypergraphSyncServer(t *testing.T) {
}
time.Sleep(10 * time.Second)
str.CloseSend()
leaves := crypto.CompareLeaves(
leaves := tries.CompareLeaves(
crdts[0].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree(),
crdts[1].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree(),
)
@ -298,7 +297,7 @@ func TestHypergraphSyncServer(t *testing.T) {
crdts[0].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree().Commit(false),
crdts[1].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree().Commit(false),
) {
leaves := crypto.CompareLeaves(
leaves := tries.CompareLeaves(
crdts[0].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree(),
crdts[1].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree(),
)
@ -331,7 +330,7 @@ func TestHypergraphPartialSync(t *testing.T) {
data1 := enc.Encrypt(make([]byte, 20), pub)
verenc1 := data1[0].Compress()
vertices1 := make([]application.Vertex, numOperations)
dataTree1 := &crypto.VectorCommitmentTree{}
dataTree1 := &tries.VectorCommitmentTree{}
logger, _ := zap.NewDevelopment()
inclusionProver := bls48581.NewKZGInclusionProver(logger)
domain := make([]byte, 32)
@ -628,7 +627,7 @@ func TestHypergraphPartialSync(t *testing.T) {
log.Fatalf("Client: failed to sync 1: %v", err)
}
str.CloseSend()
leaves := crypto.CompareLeaves(
leaves := tries.CompareLeaves(
crdts[0].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree(),
crdts[1].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree(),
)
@ -751,7 +750,7 @@ func TestHypergraphPartialSync(t *testing.T) {
crdts[0].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree().Commit(false),
crdts[1].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree().Commit(false),
) {
leaves := crypto.CompareLeaves(
leaves := tries.CompareLeaves(
crdts[0].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree(),
crdts[1].(*hgcrdt.HypergraphCRDT).GetVertexAddsSet(shardKey).GetTree(),
)

View File

@ -177,6 +177,7 @@ func (m *mockPubSub) DiscoverPeers(ctx context.Context) error { return nil
func (m *mockPubSub) GetNetwork() uint { return 0 }
func (m *mockPubSub) IsPeerConnected(peerId []byte) bool { return true }
func (m *mockPubSub) Reachability() *wrapperspb.BoolValue { return wrapperspb.Bool(true) }
func (m *mockPubSub) Close() error { return nil }
// Test helper functions
func createTestConfigs() (*config.P2PConfig, *config.EngineConfig, error) {
@ -571,7 +572,7 @@ func TestTLSXSignConnection(t *testing.T) {
defer conn.Close()
// Create the proxy client
client := rpc.NewPubSubProxyClient(conn, zap.NewNop())
client := rpc.NewPubSubProxyClient(context.TODO(), conn, zap.NewNop())
// Test that we can actually use the TLS connection
testBitmask := []byte("tls-test")