Skip to content

Commit

Permalink
Use fabric-protos-go-apiv2 in Go client (#452)
Browse files Browse the repository at this point in the history
Uses the v2 protocol buffer API and avoids direct usage of the deprecated v1 API.

Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
  • Loading branch information
bestbeforetoday authored Jun 15, 2022
1 parent 49b3141 commit fbfcc70
Show file tree
Hide file tree
Showing 37 changed files with 133 additions and 165 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ require (
github.com/cucumber/godog v0.12.5
github.com/cucumber/messages-go/v16 v16.0.1
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/hyperledger/fabric-protos-go v0.0.0-20220315113721-7dc293e117f7
github.com/hyperledger/fabric-protos-go-apiv2 v0.0.0-20220615102044-467be1c7b2e7
github.com/miekg/pkcs11 v1.1.1
github.com/stretchr/testify v1.7.1
google.golang.org/grpc v1.46.2
Expand All @@ -18,6 +17,7 @@ require (
github.com/cucumber/gherkin-go/v19 v19.0.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gofrs/uuid v4.2.0+incompatible // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-memdb v1.3.3 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hyperledger/fabric-protos-go v0.0.0-20220315113721-7dc293e117f7 h1:YV+siZuYQZwENjRH00t7ZS0CTlywt8Qog/SzL/jf6kE=
github.com/hyperledger/fabric-protos-go v0.0.0-20220315113721-7dc293e117f7/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0=
github.com/hyperledger/fabric-protos-go-apiv2 v0.0.0-20220615102044-467be1c7b2e7 h1:loYDK6Vrf7z3fff6YBVKFkFeCGCoKr8O2ed02CESBUQ=
github.com/hyperledger/fabric-protos-go-apiv2 v0.0.0-20220615102044-467be1c7b2e7/go.mod h1:smwq1q6eKByqQAp0SYdVvE1MvDoneF373j11XwWajgA=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
Expand Down
8 changes: 4 additions & 4 deletions pkg/client/blockevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"context"
"fmt"

"github.com/hyperledger/fabric-gateway/pkg/internal/util"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/common"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
)

type baseBlockEventsRequest struct {
Expand All @@ -24,7 +24,7 @@ type baseBlockEventsRequest struct {

// Bytes of the serialized block events request.
func (events *baseBlockEventsRequest) Bytes() ([]byte, error) {
requestBytes, err := util.Marshal(events.request)
requestBytes, err := proto.Marshal(events.request)
if err != nil {
return nil, fmt.Errorf("failed to marshall Envelope protobuf: %w", err)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/client/blockevents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (

"github.com/golang/mock/gomock"
"github.com/hyperledger/fabric-gateway/pkg/internal/test"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/msp"
"github.com/hyperledger/fabric-protos-go/orderer"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/common"
"github.com/hyperledger/fabric-protos-go-apiv2/msp"
"github.com/hyperledger/fabric-protos-go-apiv2/orderer"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand Down
14 changes: 7 additions & 7 deletions pkg/client/blockeventsbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ package client
import (
"math"

"github.com/hyperledger/fabric-gateway/pkg/internal/util"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/orderer"
"github.com/hyperledger/fabric-protos-go-apiv2/common"
"github.com/hyperledger/fabric-protos-go-apiv2/orderer"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/timestamppb"
)

Expand Down Expand Up @@ -53,7 +53,7 @@ func (builder *baseBlockEventsBuilder) payloadBytes() ([]byte, error) {
Data: data,
}

return util.Marshal(payload)
return proto.Marshal(payload)
}

func (builder *baseBlockEventsBuilder) channelHeaderBytes() ([]byte, error) {
Expand All @@ -64,7 +64,7 @@ func (builder *baseBlockEventsBuilder) channelHeaderBytes() ([]byte, error) {
Epoch: 0,
}

return util.Marshal(channelHeader)
return proto.Marshal(channelHeader)
}

func (builder *baseBlockEventsBuilder) signatureHeaderBytes() ([]byte, error) {
Expand All @@ -77,7 +77,7 @@ func (builder *baseBlockEventsBuilder) signatureHeaderBytes() ([]byte, error) {
Creator: creator,
}

return util.Marshal(signatureHeader)
return proto.Marshal(signatureHeader)
}

func (builder *baseBlockEventsBuilder) dataBytes() ([]byte, error) {
Expand All @@ -86,7 +86,7 @@ func (builder *baseBlockEventsBuilder) dataBytes() ([]byte, error) {
Stop: seekLargestBlockNumber(),
}

return util.Marshal(data)
return proto.Marshal(data)
}

type filteredBlockEventsBuilder struct {
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/blockeventsfiltered_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (

"github.com/golang/mock/gomock"
"github.com/hyperledger/fabric-gateway/pkg/internal/test"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/orderer"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/common"
"github.com/hyperledger/fabric-protos-go-apiv2/orderer"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand Down
8 changes: 4 additions & 4 deletions pkg/client/blockeventswithprivatedata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (

"github.com/golang/mock/gomock"
"github.com/hyperledger/fabric-gateway/pkg/internal/test"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/ledger/rwset"
"github.com/hyperledger/fabric-protos-go/orderer"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/common"
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/rwset"
"github.com/hyperledger/fabric-protos-go-apiv2/orderer"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/chaincodeevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"context"
"fmt"

"github.com/hyperledger/fabric-gateway/pkg/internal/util"
"github.com/hyperledger/fabric-protos-go/gateway"
"github.com/hyperledger/fabric-protos-go-apiv2/gateway"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
)

// ChaincodeEventsRequest delivers events emitted by transaction functions in a specific chaincode.
Expand All @@ -24,7 +24,7 @@ type ChaincodeEventsRequest struct {

// Bytes of the serialized chaincode events request.
func (events *ChaincodeEventsRequest) Bytes() ([]byte, error) {
requestBytes, err := util.Marshal(events.signedRequest)
requestBytes, err := proto.Marshal(events.signedRequest)
if err != nil {
return nil, fmt.Errorf("failed to marshall SignedChaincodeEventsRequest protobuf: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/chaincodeevents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (

"github.com/golang/mock/gomock"
"github.com/hyperledger/fabric-gateway/pkg/internal/test"
"github.com/hyperledger/fabric-protos-go/gateway"
"github.com/hyperledger/fabric-protos-go/orderer"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/gateway"
"github.com/hyperledger/fabric-protos-go-apiv2/orderer"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/chaincodeeventsbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package client
import (
"fmt"

"github.com/hyperledger/fabric-gateway/pkg/internal/util"
"github.com/hyperledger/fabric-protos-go/gateway"
"github.com/hyperledger/fabric-protos-go-apiv2/gateway"
"google.golang.org/protobuf/proto"
)

type chaincodeEventsBuilder struct {
Expand Down Expand Up @@ -38,7 +38,7 @@ func (builder *chaincodeEventsBuilder) newSignedChaincodeEventsRequestProto() (*
return nil, err
}

requestBytes, err := util.Marshal(request)
requestBytes, err := proto.Marshal(request)
if err != nil {
return nil, fmt.Errorf("failed to serialize chaincode events request: %w", err)
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ package client
import (
"context"

"github.com/hyperledger/fabric-gateway/pkg/internal/util"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/gateway"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/common"
"github.com/hyperledger/fabric-protos-go-apiv2/gateway"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
)

type gatewayClient struct {
Expand Down Expand Up @@ -73,7 +73,7 @@ func (client *gatewayClient) CommitStatusWithContext(ctx context.Context, in *ga

func getTransactionIDFromSignedCommitStatusRequest(in *gateway.SignedCommitStatusRequest) string {
request := &gateway.CommitStatusRequest{}
err := util.Unmarshal(in.GetRequest(), request)
err := proto.Unmarshal(in.GetRequest(), request)
if err != nil {
return "?"
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/client/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"context"
"fmt"

"github.com/hyperledger/fabric-gateway/pkg/internal/util"
"github.com/hyperledger/fabric-protos-go/gateway"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/gateway"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
)

// Commit provides access to a committed transaction.
Expand All @@ -40,7 +40,7 @@ func newCommit(

// Bytes of the serialized commit.
func (commit *Commit) Bytes() ([]byte, error) {
requestBytes, err := util.Marshal(commit.signedRequest)
requestBytes, err := proto.Marshal(commit.signedRequest)
if err != nil {
return nil, fmt.Errorf("failed to marshall SignedCommitStatusRequest protobuf: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package client
import (
"fmt"

"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/grpc/status"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/client/evaluate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

"github.com/golang/mock/gomock"
"github.com/hyperledger/fabric-gateway/pkg/internal/test"
"github.com/hyperledger/fabric-protos-go/gateway"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/gateway"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/eventsbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPDX-License-Identifier: Apache-2.0
package client

import (
"github.com/hyperledger/fabric-protos-go/orderer"
"github.com/hyperledger/fabric-protos-go-apiv2/orderer"
)

type eventsBuilder struct {
Expand Down
30 changes: 15 additions & 15 deletions pkg/client/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (

"github.com/hyperledger/fabric-gateway/pkg/hash"
"github.com/hyperledger/fabric-gateway/pkg/identity"
"github.com/hyperledger/fabric-gateway/pkg/internal/util"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/gateway"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/common"
"github.com/hyperledger/fabric-protos-go-apiv2/gateway"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
)

// Gateway representing the connection of a specific client identity to a Fabric Gateway.
Expand Down Expand Up @@ -181,22 +181,22 @@ func (gw *Gateway) NewSignedProposal(bytes []byte, signature []byte) (*Proposal,
// NewProposal recreates a proposal from serialized data.
func (gw *Gateway) NewProposal(bytes []byte) (*Proposal, error) {
proposedTransaction := &gateway.ProposedTransaction{}
if err := util.Unmarshal(bytes, proposedTransaction); err != nil {
if err := proto.Unmarshal(bytes, proposedTransaction); err != nil {
return nil, fmt.Errorf("failed to deserialize proposed transaction: %w", err)
}

proposal := &peer.Proposal{}
if err := util.Unmarshal(proposedTransaction.GetProposal().GetProposalBytes(), proposal); err != nil {
if err := proto.Unmarshal(proposedTransaction.GetProposal().GetProposalBytes(), proposal); err != nil {
return nil, fmt.Errorf("failed to deserialize proposal: %w", err)
}

header := &common.Header{}
if err := util.Unmarshal(proposal.GetHeader(), header); err != nil {
if err := proto.Unmarshal(proposal.GetHeader(), header); err != nil {
return nil, fmt.Errorf("failed to deserialize header: %w", err)
}

channelHeader := &common.ChannelHeader{}
if err := util.Unmarshal(header.GetChannelHeader(), channelHeader); err != nil {
if err := proto.Unmarshal(header.GetChannelHeader(), channelHeader); err != nil {
return nil, fmt.Errorf("failed to deserialize channel header: %w", err)
}

Expand Down Expand Up @@ -227,7 +227,7 @@ func (gw *Gateway) NewSignedTransaction(bytes []byte, signature []byte) (*Transa
func (gw *Gateway) NewTransaction(bytes []byte) (*Transaction, error) {

preparedTransaction := &gateway.PreparedTransaction{}
if err := util.Unmarshal(bytes, preparedTransaction); err != nil {
if err := proto.Unmarshal(bytes, preparedTransaction); err != nil {
return nil, fmt.Errorf("failed to deserialize prepared transaction: %w", err)
}

Expand All @@ -253,12 +253,12 @@ func (gw *Gateway) NewSignedCommit(bytes []byte, signature []byte) (*Commit, err
// NewCommit recreates a commit from serialized data.
func (gw *Gateway) NewCommit(bytes []byte) (*Commit, error) {
signedRequest := &gateway.SignedCommitStatusRequest{}
if err := util.Unmarshal(bytes, signedRequest); err != nil {
if err := proto.Unmarshal(bytes, signedRequest); err != nil {
return nil, fmt.Errorf("failed to deserialize signed commit status request: %w", err)
}

request := &gateway.CommitStatusRequest{}
if err := util.Unmarshal(signedRequest.Request, request); err != nil {
if err := proto.Unmarshal(signedRequest.Request, request); err != nil {
return nil, fmt.Errorf("failed to deserialize commit status request: %w", err)
}

Expand All @@ -282,7 +282,7 @@ func (gw *Gateway) NewSignedChaincodeEventsRequest(bytes []byte, signature []byt
// NewChaincodeEventsRequest recreates a request to read chaincode events from serialized data.
func (gw *Gateway) NewChaincodeEventsRequest(bytes []byte) (*ChaincodeEventsRequest, error) {
request := &gateway.SignedChaincodeEventsRequest{}
if err := util.Unmarshal(bytes, request); err != nil {
if err := proto.Unmarshal(bytes, request); err != nil {
return nil, fmt.Errorf("failed to deserialize signed chaincode events request: %w", err)
}

Expand All @@ -309,7 +309,7 @@ func (gw *Gateway) NewSignedBlockEventsRequest(bytes []byte, signature []byte) (
// NewBlockEventsRequest recreates a request to read block events from serialized data.
func (gw *Gateway) NewBlockEventsRequest(bytes []byte) (*BlockEventsRequest, error) {
request := &common.Envelope{}
if err := util.Unmarshal(bytes, request); err != nil {
if err := proto.Unmarshal(bytes, request); err != nil {
return nil, fmt.Errorf("failed to deserialize block events request envelope: %w", err)
}

Expand Down Expand Up @@ -338,7 +338,7 @@ func (gw *Gateway) NewSignedFilteredBlockEventsRequest(bytes []byte, signature [
// NewFilteredBlockEventsRequest recreates a request to read filtered block events from serialized data.
func (gw *Gateway) NewFilteredBlockEventsRequest(bytes []byte) (*FilteredBlockEventsRequest, error) {
request := &common.Envelope{}
if err := util.Unmarshal(bytes, request); err != nil {
if err := proto.Unmarshal(bytes, request); err != nil {
return nil, fmt.Errorf("failed to deserialize block events request envelope: %w", err)
}

Expand Down Expand Up @@ -367,7 +367,7 @@ func (gw *Gateway) NewSignedBlockAndPrivateDataEventsRequest(bytes []byte, signa
// NewBlockAndPrivateDataEventsRequest recreates a request to read block and private data events from serialized data.
func (gw *Gateway) NewBlockAndPrivateDataEventsRequest(bytes []byte) (*BlockAndPrivateDataEventsRequest, error) {
request := &common.Envelope{}
if err := util.Unmarshal(bytes, request); err != nil {
if err := proto.Unmarshal(bytes, request); err != nil {
return nil, fmt.Errorf("failed to deserialize block events request envelope: %w", err)
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/client/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (

"github.com/golang/mock/gomock"
"github.com/hyperledger/fabric-gateway/pkg/identity"
"github.com/hyperledger/fabric-protos-go/gateway"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/gateway"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
)

//go:generate mockgen -destination ./gateway_mock_test.go -package ${GOPACKAGE} github.com/hyperledger/fabric-protos-go/gateway GatewayClient,Gateway_ChaincodeEventsClient
//go:generate mockgen -destination ./deliver_mock_test.go -package ${GOPACKAGE} github.com/hyperledger/fabric-protos-go/peer DeliverClient,Deliver_DeliverClient,Deliver_DeliverFilteredClient,Deliver_DeliverWithPrivateDataClient
//go:generate mockgen -destination ./gateway_mock_test.go -package ${GOPACKAGE} github.com/hyperledger/fabric-protos-go-apiv2/gateway GatewayClient,Gateway_ChaincodeEventsClient
//go:generate mockgen -destination ./deliver_mock_test.go -package ${GOPACKAGE} github.com/hyperledger/fabric-protos-go-apiv2/peer DeliverClient,Deliver_DeliverClient,Deliver_DeliverFilteredClient,Deliver_DeliverWithPrivateDataClient

// WithGatewayClient uses the supplied client for the Gateway. Allows a stub implementation to be used for testing.
func WithGatewayClient(client gateway.GatewayClient) ConnectOption {
Expand Down
Loading

0 comments on commit fbfcc70

Please sign in to comment.