Skip to content

Commit

Permalink
update: use insecure package for new credentials instead of initiatin…
Browse files Browse the repository at this point in the history
…g new credentials with parameters
  • Loading branch information
mhrynenko committed May 23, 2024
1 parent f6f39d7 commit e56db7f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions internal/config/broadcaster.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package config

import (
"crypto/tls"
"fmt"
"time"

Expand All @@ -21,7 +20,7 @@ import (
"gitlab.com/distributed_lab/kit/comfig"
"gitlab.com/distributed_lab/kit/kv"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/keepalive"
)

Expand Down Expand Up @@ -73,14 +72,14 @@ func (b *broadcasterer) Broadcaster() Broadcaster {
panic(fmt.Errorf("broadcaster: invalid airdrop amount: %w", err))
}

// this hack is required to dial gRPC, please test it with remote RPC if you change this code
withInsecure := grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{
InsecureSkipVerify: true,
}))
cosmosRPC, err := grpc.Dial(cfg.CosmosRPC, withInsecure, grpc.WithKeepaliveParams(keepalive.ClientParameters{
Time: 10 * time.Second, // wait time before ping if no activity
Timeout: 20 * time.Second, // ping timeout
}))
cosmosRPC, err := grpc.Dial(
cfg.CosmosRPC,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithKeepaliveParams(keepalive.ClientParameters{
Time: 10 * time.Second, // wait time before ping if no activity
Timeout: 20 * time.Second, // ping timeout
}),
)
if err != nil {
panic(fmt.Errorf("broadcaster: failed to dial cosmos core rpc: %w", err))
}
Expand Down

0 comments on commit e56db7f

Please sign in to comment.