Skip to content

Commit

Permalink
feat: bls remote signer (#745)
Browse files Browse the repository at this point in the history
Co-authored-by: pschork <354473+pschork@users.noreply.github.com>
  • Loading branch information
shrimalmadhur and pschork authored Nov 16, 2024
1 parent d939331 commit c70f576
Show file tree
Hide file tree
Showing 18 changed files with 278 additions and 139 deletions.
2 changes: 1 addition & 1 deletion api/clients/disperser_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func (c *disperserClient) initOnceGrpcConnection() error {
c.initOnce.Do(func() {
addr := fmt.Sprintf("%v:%v", c.config.Hostname, c.config.Port)
dialOptions := getGrpcDialOptions(c.config.UseSecureGrpcFlag)
conn, err := grpc.Dial(addr, dialOptions...)
conn, err := grpc.NewClient(addr, dialOptions...)
if err != nil {
initErr = err
return
Expand Down
2 changes: 1 addition & 1 deletion api/clients/disperser_client_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (c *disperserClientV2) initOnceGrpcConnection() error {
c.initOnce.Do(func() {
addr := fmt.Sprintf("%v:%v", c.config.Hostname, c.config.Port)
dialOptions := getGrpcDialOptions(c.config.UseSecureGrpcFlag)
conn, err := grpc.Dial(addr, dialOptions...)
conn, err := grpc.NewClient(addr, dialOptions...)
if err != nil {
initErr = err
return
Expand Down
4 changes: 2 additions & 2 deletions api/clients/node_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (c client) GetBlobHeader(
batchHeaderHash [32]byte,
blobIndex uint32,
) (*core.BlobHeader, *merkletree.Proof, error) {
conn, err := grpc.Dial(
conn, err := grpc.NewClient(
core.OperatorSocket(socket).GetRetrievalSocket(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
Expand Down Expand Up @@ -85,7 +85,7 @@ func (c client) GetChunks(
quorumID core.QuorumID,
chunksChan chan RetrievedChunks,
) {
conn, err := grpc.Dial(
conn, err := grpc.NewClient(
core.OperatorSocket(opInfo.Socket).GetRetrievalSocket(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
Expand Down
2 changes: 1 addition & 1 deletion api/clients/node_client_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (c *nodeClientV2) initOnceGrpcConnection() error {
c.initOnce.Do(func() {
addr := fmt.Sprintf("%v:%v", c.config.Hostname, c.config.Port)
dialOptions := getGrpcDialOptions(c.config.UseSecureGrpcFlag)
conn, err := grpc.Dial(addr, dialOptions...)
conn, err := grpc.NewClient(addr, dialOptions...)
if err != nil {
initErr = err
return
Expand Down
2 changes: 1 addition & 1 deletion api/clients/relay_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (c *relayClient) initOnceGrpcConnection(key corev2.RelayKey) error {
return
}
dialOptions := getGrpcDialOptions(c.config.UseSecureGrpcFlag)
conn, err := grpc.Dial(socket, dialOptions...)
conn, err := grpc.NewClient(socket, dialOptions...)
if err != nil {
initErr = err
return
Expand Down
2 changes: 1 addition & 1 deletion disperser/batcher/grpc/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (c *dispatcher) sendAllChunks(ctx context.Context, state *core.IndexedOpera
func (c *dispatcher) sendChunks(ctx context.Context, blobs []*core.EncodedBlobMessage, batchHeader *core.BatchHeader, op *core.IndexedOperatorInfo) (*core.Signature, error) {
// TODO Add secure Grpc

conn, err := grpc.Dial(
conn, err := grpc.NewClient(
core.OperatorSocket(op.Socket).GetDispersalSocket(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
Expand Down
2 changes: 1 addition & 1 deletion disperser/common/semver/semver.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func ScanOperators(operators map[core.OperatorID]*core.IndexedOperatorInfo, oper

// query operator host info endpoint if available
func GetSemverInfo(ctx context.Context, socket string, userRetrievalClient bool, operatorId core.OperatorID, logger logging.Logger, timeout time.Duration) string {
conn, err := grpc.Dial(socket, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.NewClient(socket, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return "unreachable"
}
Expand Down
14 changes: 7 additions & 7 deletions disperser/dataapi/grpc_service_availability_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ func NewEigenDAServiceHealthCheck(grpcConnection GRPCConn, disperserHostName, ch
// Create Pre-configured connections to the services
// Saves from having to create new connection on each request

disperserConn, err := grpcConnection.Dial(disperserHostName, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{InsecureSkipVerify: true})), grpc.WithBlock())
disperserConn, err := grpcConnection.Dial(disperserHostName, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{InsecureSkipVerify: true})))

if err != nil {
return nil
}

churnerConn, err := grpcConnection.Dial(churnerHostName, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{InsecureSkipVerify: true})), grpc.WithBlock())
churnerConn, err := grpcConnection.Dial(churnerHostName, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{InsecureSkipVerify: true})))

if err != nil {
return nil
Expand All @@ -100,12 +100,12 @@ func NewEigenDAServiceHealthCheck(grpcConnection GRPCConn, disperserHostName, ch

// Create Connection to the service
func (rc *GRPCDialerSkipTLS) Dial(serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
// Create client options with timeout
opts = append(opts, grpc.WithConnectParams(grpc.ConnectParams{
MinConnectTimeout: 10 * time.Second,
}))

// TODO: make this a configurable option
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel() // Ensure the context is cancelled to free resources

return grpc.DialContext(ctx, serviceName, opts...)
return grpc.NewClient(serviceName, opts...)
}

// CheckServiceHealth matches the HealthCheckService interface
Expand Down
2 changes: 1 addition & 1 deletion disperser/encoder/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewEncoderClient(addr string, timeout time.Duration) (disperser.EncoderClie
}

func (c client) EncodeBlob(ctx context.Context, data []byte, encodingParams encoding.EncodingParams) (*encoding.BlobCommitments, *core.ChunksData, error) {
conn, err := grpc.Dial(
conn, err := grpc.NewClient(
c.addr,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*1024)), // 1 GiB
Expand Down
2 changes: 1 addition & 1 deletion disperser/encoder/client_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewEncoderClientV2(addr string) (disperser.EncoderClientV2, error) {

func (c *clientV2) EncodeBlob(ctx context.Context, blobKey corev2.BlobKey, encodingParams encoding.EncodingParams) (*encoding.FragmentInfo, error) {
// Establish connection
conn, err := grpc.Dial(
conn, err := grpc.NewClient(
c.addr,
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
Expand Down
64 changes: 32 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ go 1.21
toolchain go1.21.1

require (
github.com/Layr-Labs/cerberus-api v0.0.0-20241112163132-950ce31ba1ee
github.com/Layr-Labs/eigensdk-go v0.1.7-0.20240507215523-7e4891d5099a
github.com/aws/aws-sdk-go-v2 v1.26.1
github.com/aws/aws-sdk-go-v2/credentials v1.17.11
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.12
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.6
github.com/consensys/gnark-crypto v0.12.1
github.com/ethereum/go-ethereum v1.14.0
github.com/ethereum/go-ethereum v1.14.8
github.com/fxamacker/cbor/v2 v2.5.0
github.com/gin-contrib/logger v0.2.6
github.com/gin-gonic/gin v1.9.1
Expand All @@ -30,22 +31,22 @@ require (
github.com/swaggo/swag v1.16.2
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/urfave/cli v1.22.14
github.com/urfave/cli/v2 v2.27.1
github.com/urfave/cli/v2 v2.27.4
github.com/wealdtech/go-merkletree/v2 v2.6.0
go.uber.org/automaxprocs v1.5.2
go.uber.org/goleak v1.3.0
go.uber.org/mock v0.4.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/sync v0.7.0
google.golang.org/grpc v1.63.2
golang.org/x/sync v0.8.0
google.golang.org/grpc v1.64.1
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
Expand All @@ -66,30 +67,30 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/bytedance/sonic v1.9.2 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.0 // indirect
github.com/cockroachdb/pebble v1.1.2 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/containerd/continuity v0.4.2 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/docker/cli v25.0.3+incompatible // indirect
github.com/docker/docker v25.0.5+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/fjl/memsize v0.0.2 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gammazero/deque v0.2.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
Expand All @@ -103,9 +104,9 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-bexpr v0.1.10 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand Down Expand Up @@ -155,33 +156,32 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/arch v0.4.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

require (
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.11
github.com/aws/aws-sdk-go-v2/feature/dynamodb/expression v1.7.12
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.13
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.0
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.0
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
Expand All @@ -197,9 +197,9 @@ require (
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/holiman/uint256 v1.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
Expand All @@ -216,12 +216,12 @@ require (
github.com/swaggo/gin-swagger v1.6.0
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
golang.org/x/crypto v0.23.0
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/tools v0.20.0 // indirect
google.golang.org/protobuf v1.33.0
golang.org/x/crypto v0.26.0
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading

0 comments on commit c70f576

Please sign in to comment.