Skip to content

Commit 86aa4f8

Browse files
committed
Use grpc codec v2 during grpc invokes
1 parent fd7f246 commit 86aa4f8

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

relayer/chains/cosmos/grpc_query.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ import (
2121
"google.golang.org/grpc/codes"
2222
"google.golang.org/grpc/encoding"
2323
"google.golang.org/grpc/encoding/proto"
24+
"google.golang.org/grpc/mem"
2425
"google.golang.org/grpc/metadata"
2526
"google.golang.org/grpc/status"
2627
)
2728

2829
var _ gogogrpc.ClientConn = &CosmosProvider{}
2930

30-
var protoCodec = encoding.GetCodec(proto.Name)
31+
var protoCodec = encoding.GetCodecV2(proto.Name)
3132

3233
// Invoke implements the grpc ClientConn.Invoke method
3334
func (cc *CosmosProvider) Invoke(ctx context.Context, method string, req, reply interface{}, opts ...grpc.CallOption) (err error) {
@@ -65,7 +66,7 @@ func (cc *CosmosProvider) Invoke(ctx context.Context, method string, req, reply
6566
return err
6667
}
6768

68-
if err = protoCodec.Unmarshal(abciRes.Value, reply); err != nil {
69+
if err = protoCodec.Unmarshal([]mem.Buffer{mem.NewBuffer(&abciRes.Value, nil)}, reply); err != nil {
6970
return err
7071
}
7172

@@ -126,7 +127,7 @@ func (cc *CosmosProvider) RunGRPCQuery(ctx context.Context, method string, req i
126127

127128
abciReq := abci.RequestQuery{
128129
Path: method,
129-
Data: reqBz,
130+
Data: reqBz.Materialize(),
130131
Height: height,
131132
Prove: prove,
132133
}

relayer/chains/penumbra/grpc_query.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ import (
2121
"google.golang.org/grpc/codes"
2222
"google.golang.org/grpc/encoding"
2323
"google.golang.org/grpc/encoding/proto"
24+
"google.golang.org/grpc/mem"
2425
"google.golang.org/grpc/metadata"
2526
"google.golang.org/grpc/status"
2627
)
2728

2829
var _ gogogrpc.ClientConn = &PenumbraProvider{}
2930

30-
var protoCodec = encoding.GetCodec(proto.Name)
31+
var protoCodec = encoding.GetCodecV2(proto.Name)
3132

3233
// Invoke implements the grpc ClientConn.Invoke method
3334
func (cc *PenumbraProvider) Invoke(ctx context.Context, method string, req, reply interface{}, opts ...grpc.CallOption) (err error) {
@@ -65,7 +66,7 @@ func (cc *PenumbraProvider) Invoke(ctx context.Context, method string, req, repl
6566
return err
6667
}
6768

68-
if err = protoCodec.Unmarshal(abciRes.Value, reply); err != nil {
69+
if err = protoCodec.Unmarshal([]mem.Buffer{mem.NewBuffer(&abciRes.Value, nil)}, reply); err != nil {
6970
return err
7071
}
7172

@@ -126,7 +127,7 @@ func (cc *PenumbraProvider) RunGRPCQuery(ctx context.Context, method string, req
126127

127128
abciReq := abci.RequestQuery{
128129
Path: method,
129-
Data: reqBz,
130+
Data: reqBz.Materialize(),
130131
Height: height,
131132
Prove: prove,
132133
}

0 commit comments

Comments
 (0)