From 1866adebb2e69a74b70bfb202eda900740f9c6aa Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Thu, 6 May 2021 15:31:17 +0100 Subject: [PATCH] FABGW-19: Secure CommitStatus service (#2570) - Receive a SignedCommitStatusRequest message. - Verify signature and check included identity has CHANNELREADERS permission. - Add integration tests for success and failure scenarios. Signed-off-by: Mark S. Lewis --- core/aclmgmt/defaultaclprovider.go | 5 + core/aclmgmt/resourceprovider.go | 3 + core/aclmgmt/resourceprovider_test.go | 37 ++- core/aclmgmt/resources/resources.go | 3 + go.mod | 2 +- go.sum | 4 +- integration/gateway/gateway_test.go | 106 ++++++- internal/peer/node/start.go | 1 + internal/pkg/gateway/api.go | 19 +- internal/pkg/gateway/api_test.go | 98 +++++-- internal/pkg/gateway/gateway.go | 8 +- internal/pkg/gateway/mocks/abbclient.go | 56 ++-- internal/pkg/gateway/mocks/abclient.go | 14 +- internal/pkg/gateway/mocks/aclchecker.go | 111 +++++++ internal/pkg/gateway/mocks/commitfinder.go | 7 +- internal/pkg/gateway/mocks/dialer.go | 8 +- internal/pkg/gateway/mocks/discovery.go | 28 +- internal/pkg/gateway/mocks/endorserclient.go | 7 +- .../fabric-protos-go/gateway/gateway.pb.go | 275 +++++++++++++++--- vendor/modules.txt | 2 +- 20 files changed, 645 insertions(+), 149 deletions(-) create mode 100644 internal/pkg/gateway/mocks/aclchecker.go diff --git a/core/aclmgmt/defaultaclprovider.go b/core/aclmgmt/defaultaclprovider.go index e06807544bf..ecce7b09b96 100644 --- a/core/aclmgmt/defaultaclprovider.go +++ b/core/aclmgmt/defaultaclprovider.go @@ -108,6 +108,9 @@ func newDefaultACLProvider(policyChecker policy.PolicyChecker) defaultACLProvide d.cResourcePolicyMap[resources.Event_Block] = CHANNELREADERS d.cResourcePolicyMap[resources.Event_FilteredBlock] = CHANNELREADERS + // Gateway resources + d.cResourcePolicyMap[resources.Gateway_CommitStatus] = CHANNELREADERS + return d } @@ -140,6 +143,8 @@ func (d *defaultACLProviderImpl) CheckACL(resName string, channelID string, idin return err } return d.policyChecker.CheckPolicyBySignedData(channelID, policy, sd) + case *protoutil.SignedData: + return d.policyChecker.CheckPolicyBySignedData(channelID, policy, []*protoutil.SignedData{typedData}) case []*protoutil.SignedData: return d.policyChecker.CheckPolicyBySignedData(channelID, policy, typedData) default: diff --git a/core/aclmgmt/resourceprovider.go b/core/aclmgmt/resourceprovider.go index 2dc9835d525..80d4c7c6453 100644 --- a/core/aclmgmt/resourceprovider.go +++ b/core/aclmgmt/resourceprovider.go @@ -126,6 +126,9 @@ func (rp *aclmgmtPolicyProviderImpl) CheckACL(polName string, idinfo interface{} return err } + case *protoutil.SignedData: + sd = []*protoutil.SignedData{idinfo} + default: return InvalidIdInfo(polName) } diff --git a/core/aclmgmt/resourceprovider_test.go b/core/aclmgmt/resourceprovider_test.go index 3e9e03db5e7..cf05442d737 100644 --- a/core/aclmgmt/resourceprovider_test.go +++ b/core/aclmgmt/resourceprovider_test.go @@ -57,17 +57,32 @@ type signerSerializer interface { //go:generate counterfeiter -o mocks/defaultaclprovider.go --fake-name DefaultACLProvider . defaultACLProvider func TestPolicyBase(t *testing.T) { - peval := &mockPolicyEvaluatorImpl{pmap: map[string]string{"res": "pol"}, peval: map[string]error{"pol": nil}} - pprov := newPolicyProvider(peval) - sProp, _ := protoutil.MockSignedEndorserProposalOrPanic("A", &peer.ChaincodeSpec{}, []byte("Alice"), []byte("msg1")) - err := pprov.CheckACL("pol", sProp) - require.NoError(t, err) - - signer := &mocks.SignerSerializer{} - env, err := protoutil.CreateSignedEnvelope(common.HeaderType_CONFIG, "myc", signer, &common.ConfigEnvelope{}, 0, 0) - require.NoError(t, err) - err = pprov.CheckACL("pol", env) - require.NoError(t, err) + evaluator := &mockPolicyEvaluatorImpl{pmap: map[string]string{"res": "pol"}, peval: map[string]error{"pol": nil}} + provider := newPolicyProvider(evaluator) + + t.Run("SignedProposal", func(t *testing.T) { + proposal, _ := protoutil.MockSignedEndorserProposalOrPanic("A", &peer.ChaincodeSpec{}, []byte("Alice"), []byte("msg1")) + err := provider.CheckACL("pol", proposal) + require.NoError(t, err) + }) + + t.Run("Envelope", func(t *testing.T) { + signer := &mocks.SignerSerializer{} + envelope, err := protoutil.CreateSignedEnvelope(common.HeaderType_CONFIG, "myc", signer, &common.ConfigEnvelope{}, 0, 0) + require.NoError(t, err) + err = provider.CheckACL("pol", envelope) + require.NoError(t, err) + }) + + t.Run("SignedData", func(t *testing.T) { + data := &protoutil.SignedData{ + Data: []byte("DATA"), + Identity: []byte("IDENTITY"), + Signature: []byte("SIGNATURE"), + } + err := provider.CheckACL("pol", data) + require.NoError(t, err) + }) } func TestPolicyBad(t *testing.T) { diff --git a/core/aclmgmt/resources/resources.go b/core/aclmgmt/resources/resources.go index 916f5ffc25e..4814c6e23f5 100644 --- a/core/aclmgmt/resources/resources.go +++ b/core/aclmgmt/resources/resources.go @@ -61,4 +61,7 @@ const ( // Events Event_Block = "event/Block" Event_FilteredBlock = "event/FilteredBlock" + + // Gateway resources + Gateway_CommitStatus = "gateway/CommitStatus" ) diff --git a/go.mod b/go.mod index 362a2e44669..77d41488d5e 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/hyperledger/fabric-chaincode-go v0.0.0-20201119163726-f8ef75b17719 github.com/hyperledger/fabric-config v0.1.0 github.com/hyperledger/fabric-lib-go v1.0.0 - github.com/hyperledger/fabric-protos-go v0.0.0-20210311171918-e08edaab0493 + github.com/hyperledger/fabric-protos-go v0.0.0-20210422135545-37e930696e2a github.com/kr/pretty v0.2.1 github.com/magiconair/properties v1.8.1 // indirect github.com/mattn/go-runewidth v0.0.4 // indirect diff --git a/go.sum b/go.sum index 90d4463a978..9ae433fc0b7 100644 --- a/go.sum +++ b/go.sum @@ -161,8 +161,8 @@ github.com/hyperledger/fabric-lib-go v1.0.0 h1:UL1w7c9LvHZUSkIvHTDGklxFv2kTeva1Q github.com/hyperledger/fabric-lib-go v1.0.0/go.mod h1:H362nMlunurmHwkYqR5uHL2UDWbQdbfz74n8kbCFsqc= github.com/hyperledger/fabric-protos-go v0.0.0-20190919234611-2a87503ac7c9/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= -github.com/hyperledger/fabric-protos-go v0.0.0-20210311171918-e08edaab0493 h1:jj4S9FWy0o0Re0XhMAPaL3d/ho3pqWcNH8duMcRxVNw= -github.com/hyperledger/fabric-protos-go v0.0.0-20210311171918-e08edaab0493/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20210422135545-37e930696e2a h1:sJwXhCxTQ7euBj+4w7pomn0CzOgdHkLlUOqtDgsI8IA= +github.com/hyperledger/fabric-protos-go v0.0.0-20210422135545-37e930696e2a/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= diff --git a/integration/gateway/gateway_test.go b/integration/gateway/gateway_test.go index 6b85c8116c1..5b47412e476 100644 --- a/integration/gateway/gateway_test.go +++ b/integration/gateway/gateway_test.go @@ -21,6 +21,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/tedsuo/ifrit" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) var _ = Describe("GatewayService", func() { @@ -170,15 +173,22 @@ var _ = Describe("GatewayService", func() { }) Describe("CommitStatus", func() { - It("should respond with status of submitted transaction", func() { - conn := network.PeerClientConn(org1Peer0) - defer conn.Close() - gatewayClient := gateway.NewGatewayClient(conn) - ctx, cancel := context.WithTimeout(context.Background(), network.EventuallyTimeout) - defer cancel() - - signingIdentity := network.PeerUserSigner(org1Peer0, "User1") - proposedTransaction, transactionID := NewProposedTransaction(signingIdentity, "testchannel", "gatewaycc", "respond", []byte("200"), []byte("conga message"), []byte("conga payload")) + var conn *grpc.ClientConn + var gatewayClient gateway.GatewayClient + var ctx context.Context + var cancel context.CancelFunc + var signingIdentity *nwo.SigningIdentity + var transactionID string + var identity []byte + + BeforeEach(func() { + conn = network.PeerClientConn(org1Peer0) + gatewayClient = gateway.NewGatewayClient(conn) + ctx, cancel = context.WithTimeout(context.Background(), network.EventuallyTimeout) + + signingIdentity = network.PeerUserSigner(org1Peer0, "User1") + var proposedTransaction *peer.SignedProposal + proposedTransaction, transactionID = NewProposedTransaction(signingIdentity, "testchannel", "gatewaycc", "respond", []byte("200"), []byte("conga message"), []byte("conga payload")) endorseRequest := &gateway.EndorseRequest{ TransactionId: transactionID, @@ -201,11 +211,34 @@ var _ = Describe("GatewayService", func() { _, err = gatewayClient.Submit(ctx, submitRequest) Expect(err).NotTo(HaveOccurred()) + identity, err = signingIdentity.Serialize() + Expect(err).NotTo(HaveOccurred()) + }) + + AfterEach(func() { + conn.Close() + cancel() + }) + + It("should respond with status of submitted transaction", func() { statusRequest := &gateway.CommitStatusRequest{ ChannelId: "testchannel", + Identity: identity, TransactionId: transactionID, } - actualStatus, err := gatewayClient.CommitStatus(ctx, statusRequest) + + statusRequestBytes, err := proto.Marshal(statusRequest) + Expect(err).NotTo(HaveOccurred()) + + signature, err := signingIdentity.Sign(statusRequestBytes) + Expect(err).NotTo(HaveOccurred()) + + signedStatusRequest := &gateway.SignedCommitStatusRequest{ + Request: statusRequestBytes, + Signature: signature, + } + + actualStatus, err := gatewayClient.CommitStatus(ctx, signedStatusRequest) Expect(err).NotTo(HaveOccurred()) expectedStatus := &gateway.CommitStatusResponse{ @@ -213,5 +246,58 @@ var _ = Describe("GatewayService", func() { } Expect(proto.Equal(actualStatus, expectedStatus)).To(BeTrue(), "Expected\n\t%#v\nto proto.Equal\n\t%#v", actualStatus, expectedStatus) }) + + It("should fail on unauthorized identity", func() { + badSigningIdentity := network.OrdererUserSigner(network.Orderer("orderer"), "Admin") + badIdentity, err := badSigningIdentity.Serialize() + Expect(err).NotTo(HaveOccurred()) + + statusRequest := &gateway.CommitStatusRequest{ + ChannelId: "testchannel", + Identity: badIdentity, + TransactionId: transactionID, + } + statusRequestBytes, err := proto.Marshal(statusRequest) + Expect(err).NotTo(HaveOccurred()) + + signature, err := badSigningIdentity.Sign(statusRequestBytes) + Expect(err).NotTo(HaveOccurred()) + + signedStatusRequest := &gateway.SignedCommitStatusRequest{ + Request: statusRequestBytes, + Signature: signature, + } + + _, err = gatewayClient.CommitStatus(ctx, signedStatusRequest) + Expect(err).To(HaveOccurred()) + + grpcErr, _ := status.FromError(err) + Expect(grpcErr.Code()).To(Equal(codes.PermissionDenied)) + }) + + It("should fail on bad signature", func() { + statusRequest := &gateway.CommitStatusRequest{ + ChannelId: "testchannel", + Identity: identity, + TransactionId: transactionID, + } + + statusRequestBytes, err := proto.Marshal(statusRequest) + Expect(err).NotTo(HaveOccurred()) + + signature, err := signingIdentity.Sign([]byte("WRONG")) + Expect(err).NotTo(HaveOccurred()) + + signedStatusRequest := &gateway.SignedCommitStatusRequest{ + Request: statusRequestBytes, + Signature: signature, + } + + _, err = gatewayClient.CommitStatus(ctx, signedStatusRequest) + Expect(err).To(HaveOccurred()) + + grpcErr, _ := status.FromError(err) + Expect(grpcErr.Code()).To(Equal(codes.PermissionDenied)) + }) }) }) diff --git a/internal/peer/node/start.go b/internal/peer/node/start.go index 7e884e01043..8829e69211f 100644 --- a/internal/peer/node/start.go +++ b/internal/peer/node/start.go @@ -834,6 +834,7 @@ func serve(args []string) error { Query: peerAdapter, Notifier: commit.NewNotifier(peerAdapter), }, + aclProvider, peerInstance.GossipService.SelfMembershipInfo().Endpoint, coreConfig.LocalMSPID, coreConfig.GatewayOptions, diff --git a/internal/pkg/gateway/api.go b/internal/pkg/gateway/api.go index 5954f4787ae..246c3bcbdc7 100644 --- a/internal/pkg/gateway/api.go +++ b/internal/pkg/gateway/api.go @@ -15,6 +15,7 @@ import ( "github.com/hyperledger/fabric-protos-go/common" gp "github.com/hyperledger/fabric-protos-go/gateway" "github.com/hyperledger/fabric-protos-go/peer" + "github.com/hyperledger/fabric/core/aclmgmt/resources" "github.com/hyperledger/fabric/protoutil" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -226,11 +227,25 @@ func (gs *Server) Submit(ctx context.Context, request *gp.SubmitRequest) (*gp.Su // // If the transaction commit status cannot be returned, for example if the specified channel does not exist, a // FailedPrecondition error will be returned. -func (gs *Server) CommitStatus(ctx context.Context, request *gp.CommitStatusRequest) (*gp.CommitStatusResponse, error) { - if request == nil { +func (gs *Server) CommitStatus(ctx context.Context, signedRequest *gp.SignedCommitStatusRequest) (*gp.CommitStatusResponse, error) { + if signedRequest == nil { return nil, status.Error(codes.InvalidArgument, "a commit status request is required") } + request := &gp.CommitStatusRequest{} + if err := proto.Unmarshal(signedRequest.Request, request); err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid status request") + } + + signedData := &protoutil.SignedData{ + Data: signedRequest.Request, + Identity: request.Identity, + Signature: signedRequest.Signature, + } + if err := gs.policy.CheckACL(resources.Gateway_CommitStatus, request.ChannelId, signedData); err != nil { + return nil, status.Error(codes.PermissionDenied, err.Error()) + } + txStatus, err := gs.commitFinder.TransactionStatus(ctx, request.ChannelId, request.TransactionId) if err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) diff --git a/internal/pkg/gateway/api_test.go b/internal/pkg/gateway/api_test.go index 3a80f607340..619d2248c07 100644 --- a/internal/pkg/gateway/api_test.go +++ b/internal/pkg/gateway/api_test.go @@ -62,6 +62,11 @@ type commitFinder interface { CommitFinder } +//go:generate counterfeiter -o mocks/aclchecker.go --fake-name ACLChecker . aclChecker +type aclChecker interface { + ACLChecker +} + type endorsementPlan map[string][]endorserState type networkMember struct { @@ -98,14 +103,16 @@ const ( type testDef struct { name string plan endorsementPlan + identity []byte localResponse string errString string errDetails []*pb.EndpointError endpointDefinition *endpointDef - postSetup func(def *preparedTest) + postSetup func(t *testing.T, def *preparedTest) expectedEndorsers []string finderStatus peer.TxValidationCode finderErr error + policyErr error expectedResponse proto.Message } @@ -117,6 +124,7 @@ type preparedTest struct { discovery *mocks.Discovery dialer *mocks.Dialer finder *mocks.CommitFinder + policy *mocks.ACLChecker } type contextKey string @@ -155,7 +163,7 @@ func TestEvaluate(t *testing.T) { plan: endorsementPlan{ "g1": {{endpoint: "localhost:7051"}}, }, - postSetup: func(def *preparedTest) { + postSetup: func(t *testing.T, def *preparedTest) { def.discovery.PeersForEndorsementReturns(nil, fmt.Errorf("mango-tango")) }, errString: "mango-tango", @@ -196,7 +204,7 @@ func TestEvaluate(t *testing.T) { plan: endorsementPlan{ "g1": {{endpoint: "peer2:9051"}}, }, - postSetup: func(def *preparedTest) { + postSetup: func(t *testing.T, def *preparedTest) { def.dialer.Calls(func(_ context.Context, target string, _ ...grpc.DialOption) (*grpc.ClientConn, error) { if target == "peer2:9051" { return nil, fmt.Errorf("endorser not answering") @@ -211,7 +219,7 @@ func TestEvaluate(t *testing.T) { plan: endorsementPlan{ "g1": {{endpoint: "peer2:9051"}}, }, - postSetup: func(def *preparedTest) { + postSetup: func(t *testing.T, def *preparedTest) { def.dialer.Calls(func(_ context.Context, target string, _ ...grpc.DialOption) (*grpc.ClientConn, error) { if target == "orderer:7050" { return nil, fmt.Errorf("orderer not answering") @@ -308,7 +316,7 @@ func TestEndorse(t *testing.T) { plan: endorsementPlan{ "g1": {{endpoint: "localhost:7051", height: 2}}, }, - postSetup: func(def *preparedTest) { + postSetup: func(t *testing.T, def *preparedTest) { def.discovery.PeersForEndorsementReturns(nil, fmt.Errorf("peach-melba")) }, errString: "peach-melba", @@ -410,7 +418,7 @@ func TestSubmit(t *testing.T) { plan: endorsementPlan{ "g1": {{endpoint: "localhost:7051"}}, }, - postSetup: func(def *preparedTest) { + postSetup: func(t *testing.T, def *preparedTest) { def.discovery.ConfigReturnsOnCall(1, nil, fmt.Errorf("jabberwocky")) }, errString: "jabberwocky", @@ -420,7 +428,7 @@ func TestSubmit(t *testing.T) { plan: endorsementPlan{ "g1": {{endpoint: "localhost:7051"}}, }, - postSetup: func(def *preparedTest) { + postSetup: func(t *testing.T, def *preparedTest) { def.discovery.ConfigReturns(&dp.ConfigResult{ Orderers: map[string]*dp.Endpoints{}, Msps: map[string]*msp.FabricMSPConfig{}, @@ -481,7 +489,7 @@ func TestSubmit(t *testing.T) { plan: endorsementPlan{ "g1": {{endpoint: "localhost:7051"}}, }, - postSetup: func(def *preparedTest) { + postSetup: func(t *testing.T, def *preparedTest) { def.server.registry.endpointFactory.connectOrderer = func(_ *grpc.ClientConn) ab.AtomicBroadcastClient { abc := &mocks.ABClient{} abbc := &mocks.ABBClient{} @@ -497,7 +505,7 @@ func TestSubmit(t *testing.T) { plan: endorsementPlan{ "g1": {{endpoint: "localhost:7051"}}, }, - postSetup: func(def *preparedTest) { + postSetup: func(t *testing.T, def *preparedTest) { def.server.registry.endpointFactory.connectOrderer = func(_ *grpc.ClientConn) ab.AtomicBroadcastClient { abc := &mocks.ABClient{} abbc := &mocks.ABBClient{} @@ -568,11 +576,9 @@ func TestCommitStatus(t *testing.T) { }, { name: "passes channel name to finder", - postSetup: func(test *preparedTest) { + postSetup: func(t *testing.T, test *preparedTest) { test.finder.TransactionStatusCalls(func(ctx context.Context, channelName string, transactionID string) (peer.TxValidationCode, error) { - if channelName != testChannel { - return 0, errors.Errorf("channel name: %s", channelName) - } + require.Equal(t, testChannel, channelName) return peer.TxValidationCode_MVCC_READ_CONFLICT, nil }) }, @@ -582,11 +588,9 @@ func TestCommitStatus(t *testing.T) { }, { name: "passes transaction ID to finder", - postSetup: func(test *preparedTest) { + postSetup: func(t *testing.T, test *preparedTest) { test.finder.TransactionStatusCalls(func(ctx context.Context, channelName string, transactionID string) (peer.TxValidationCode, error) { - if transactionID != "TX_ID" { - return 0, errors.Errorf("transaction ID: %s", transactionID) - } + require.Equal(t, "TX_ID", transactionID) return peer.TxValidationCode_MVCC_READ_CONFLICT, nil }) }, @@ -594,13 +598,59 @@ func TestCommitStatus(t *testing.T) { Result: peer.TxValidationCode_MVCC_READ_CONFLICT, }, }, + { + name: "failed policy or signature check", + policyErr: errors.New("POLICY_ERROR"), + errString: "rpc error: code = PermissionDenied desc = POLICY_ERROR", + }, + { + name: "passes channel name to policy checker", + postSetup: func(t *testing.T, test *preparedTest) { + test.policy.CheckACLCalls(func(policyName string, channelName string, data interface{}) error { + require.Equal(t, testChannel, channelName) + return nil + }) + }, + finderStatus: peer.TxValidationCode_MVCC_READ_CONFLICT, + expectedResponse: &pb.CommitStatusResponse{ + Result: peer.TxValidationCode_MVCC_READ_CONFLICT, + }, + }, + { + name: "passes identity to policy checker", + identity: []byte("IDENTITY"), + postSetup: func(t *testing.T, test *preparedTest) { + test.policy.CheckACLCalls(func(policyName string, channelName string, data interface{}) error { + require.IsType(t, &protoutil.SignedData{}, data) + signedData := data.(*protoutil.SignedData) + require.Equal(t, []byte("IDENTITY"), signedData.Identity) + return nil + }) + }, + finderStatus: peer.TxValidationCode_MVCC_READ_CONFLICT, + expectedResponse: &pb.CommitStatusResponse{ + Result: peer.TxValidationCode_MVCC_READ_CONFLICT, + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { test := prepareTest(t, &tt) - // skeleton test code - to be completed when CommitStatus is implemented - response, err := test.server.CommitStatus(test.ctx, &pb.CommitStatusRequest{ChannelId: testChannel, TransactionId: "TX_ID"}) + request := &pb.CommitStatusRequest{ + ChannelId: testChannel, + Identity: tt.identity, + TransactionId: "TX_ID", + } + requestBytes, err := proto.Marshal(request) + require.NoError(t, err) + + signedRequest := &pb.SignedCommitStatusRequest{ + Request: requestBytes, + Signature: []byte{}, + } + + response, err := test.server.CommitStatus(test.ctx, signedRequest) if tt.errString != "" { checkError(t, err, tt.errString, tt.errDetails) @@ -617,7 +667,7 @@ func TestCommitStatus(t *testing.T) { } func TestNilArgs(t *testing.T) { - server := CreateServer(&mocks.EndorserClient{}, &mocks.Discovery{}, &mocks.CommitFinder{}, "localhost:7051", "msp1", config.GetOptions(viper.New())) + server := CreateServer(&mocks.EndorserClient{}, &mocks.Discovery{}, &mocks.CommitFinder{}, &mocks.ACLChecker{}, "localhost:7051", "msp1", config.GetOptions(viper.New())) ctx := context.Background() _, err := server.Evaluate(ctx, nil) @@ -669,6 +719,9 @@ func prepareTest(t *testing.T, tt *testDef) *preparedTest { mockFinder := &mocks.CommitFinder{} mockFinder.TransactionStatusReturns(tt.finderStatus, tt.finderErr) + mockPolicy := &mocks.ACLChecker{} + mockPolicy.CheckACLReturns(tt.policyErr) + validProposal := createProposal(t, testChannel, testChaincode) validSignedProposal, err := protoutil.GetSignedProposal(validProposal, mockSigner) require.NoError(t, err) @@ -703,7 +756,7 @@ func prepareTest(t *testing.T, tt *testDef) *preparedTest { EndorsementTimeout: endorsementTimeout, } - server := CreateServer(localEndorser, disc, mockFinder, "localhost:7051", "msp1", options) + server := CreateServer(localEndorser, disc, mockFinder, mockPolicy, "localhost:7051", "msp1", options) dialer := &mocks.Dialer{} dialer.Returns(nil, nil) @@ -720,9 +773,10 @@ func prepareTest(t *testing.T, tt *testDef) *preparedTest { discovery: disc, dialer: dialer, finder: mockFinder, + policy: mockPolicy, } if tt.postSetup != nil { - tt.postSetup(pt) + tt.postSetup(t, pt) } return pt } diff --git a/internal/pkg/gateway/gateway.go b/internal/pkg/gateway/gateway.go index d591e10996c..86ccc2dd30b 100644 --- a/internal/pkg/gateway/gateway.go +++ b/internal/pkg/gateway/gateway.go @@ -20,6 +20,7 @@ var logger = flogging.MustGetLogger("gateway") type Server struct { registry *registry commitFinder CommitFinder + policy ACLChecker options config.Options } @@ -35,8 +36,12 @@ type CommitFinder interface { TransactionStatus(ctx context.Context, channelName string, transactionID string) (peer.TxValidationCode, error) } +type ACLChecker interface { + CheckACL(policyName string, channelName string, data interface{}) error +} + // CreateServer creates an embedded instance of the Gateway. -func CreateServer(localEndorser peer.EndorserClient, discovery Discovery, finder CommitFinder, localEndpoint, localMSPID string, options config.Options) *Server { +func CreateServer(localEndorser peer.EndorserClient, discovery Discovery, finder CommitFinder, policy ACLChecker, localEndpoint, localMSPID string, options config.Options) *Server { gwServer := &Server{ registry: ®istry{ localEndorser: &endorser{client: localEndorser, endpointConfig: &endpointConfig{address: localEndpoint, mspid: localMSPID}}, @@ -49,6 +54,7 @@ func CreateServer(localEndorser peer.EndorserClient, discovery Discovery, finder channelsInitialized: map[string]bool{}, }, commitFinder: finder, + policy: policy, options: options, } diff --git a/internal/pkg/gateway/mocks/abbclient.go b/internal/pkg/gateway/mocks/abbclient.go index 7a8b2109488..7a5222d5a43 100644 --- a/internal/pkg/gateway/mocks/abbclient.go +++ b/internal/pkg/gateway/mocks/abbclient.go @@ -107,15 +107,16 @@ func (fake *ABBClient) CloseSend() error { ret, specificReturn := fake.closeSendReturnsOnCall[len(fake.closeSendArgsForCall)] fake.closeSendArgsForCall = append(fake.closeSendArgsForCall, struct { }{}) + stub := fake.CloseSendStub + fakeReturns := fake.closeSendReturns fake.recordInvocation("CloseSend", []interface{}{}) fake.closeSendMutex.Unlock() - if fake.CloseSendStub != nil { - return fake.CloseSendStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1 } - fakeReturns := fake.closeSendReturns return fakeReturns.result1 } @@ -159,15 +160,16 @@ func (fake *ABBClient) Context() context.Context { ret, specificReturn := fake.contextReturnsOnCall[len(fake.contextArgsForCall)] fake.contextArgsForCall = append(fake.contextArgsForCall, struct { }{}) + stub := fake.ContextStub + fakeReturns := fake.contextReturns fake.recordInvocation("Context", []interface{}{}) fake.contextMutex.Unlock() - if fake.ContextStub != nil { - return fake.ContextStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1 } - fakeReturns := fake.contextReturns return fakeReturns.result1 } @@ -211,15 +213,16 @@ func (fake *ABBClient) Header() (metadata.MD, error) { ret, specificReturn := fake.headerReturnsOnCall[len(fake.headerArgsForCall)] fake.headerArgsForCall = append(fake.headerArgsForCall, struct { }{}) + stub := fake.HeaderStub + fakeReturns := fake.headerReturns fake.recordInvocation("Header", []interface{}{}) fake.headerMutex.Unlock() - if fake.HeaderStub != nil { - return fake.HeaderStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.headerReturns return fakeReturns.result1, fakeReturns.result2 } @@ -266,15 +269,16 @@ func (fake *ABBClient) Recv() (*orderer.BroadcastResponse, error) { ret, specificReturn := fake.recvReturnsOnCall[len(fake.recvArgsForCall)] fake.recvArgsForCall = append(fake.recvArgsForCall, struct { }{}) + stub := fake.RecvStub + fakeReturns := fake.recvReturns fake.recordInvocation("Recv", []interface{}{}) fake.recvMutex.Unlock() - if fake.RecvStub != nil { - return fake.RecvStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.recvReturns return fakeReturns.result1, fakeReturns.result2 } @@ -322,15 +326,16 @@ func (fake *ABBClient) RecvMsg(arg1 interface{}) error { fake.recvMsgArgsForCall = append(fake.recvMsgArgsForCall, struct { arg1 interface{} }{arg1}) + stub := fake.RecvMsgStub + fakeReturns := fake.recvMsgReturns fake.recordInvocation("RecvMsg", []interface{}{arg1}) fake.recvMsgMutex.Unlock() - if fake.RecvMsgStub != nil { - return fake.RecvMsgStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1 } - fakeReturns := fake.recvMsgReturns return fakeReturns.result1 } @@ -382,15 +387,16 @@ func (fake *ABBClient) Send(arg1 *common.Envelope) error { fake.sendArgsForCall = append(fake.sendArgsForCall, struct { arg1 *common.Envelope }{arg1}) + stub := fake.SendStub + fakeReturns := fake.sendReturns fake.recordInvocation("Send", []interface{}{arg1}) fake.sendMutex.Unlock() - if fake.SendStub != nil { - return fake.SendStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1 } - fakeReturns := fake.sendReturns return fakeReturns.result1 } @@ -442,15 +448,16 @@ func (fake *ABBClient) SendMsg(arg1 interface{}) error { fake.sendMsgArgsForCall = append(fake.sendMsgArgsForCall, struct { arg1 interface{} }{arg1}) + stub := fake.SendMsgStub + fakeReturns := fake.sendMsgReturns fake.recordInvocation("SendMsg", []interface{}{arg1}) fake.sendMsgMutex.Unlock() - if fake.SendMsgStub != nil { - return fake.SendMsgStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1 } - fakeReturns := fake.sendMsgReturns return fakeReturns.result1 } @@ -501,15 +508,16 @@ func (fake *ABBClient) Trailer() metadata.MD { ret, specificReturn := fake.trailerReturnsOnCall[len(fake.trailerArgsForCall)] fake.trailerArgsForCall = append(fake.trailerArgsForCall, struct { }{}) + stub := fake.TrailerStub + fakeReturns := fake.trailerReturns fake.recordInvocation("Trailer", []interface{}{}) fake.trailerMutex.Unlock() - if fake.TrailerStub != nil { - return fake.TrailerStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1 } - fakeReturns := fake.trailerReturns return fakeReturns.result1 } diff --git a/internal/pkg/gateway/mocks/abclient.go b/internal/pkg/gateway/mocks/abclient.go index 4ea5ba66af9..09624741d2a 100644 --- a/internal/pkg/gateway/mocks/abclient.go +++ b/internal/pkg/gateway/mocks/abclient.go @@ -49,15 +49,16 @@ func (fake *ABClient) Broadcast(arg1 context.Context, arg2 ...grpc.CallOption) ( arg1 context.Context arg2 []grpc.CallOption }{arg1, arg2}) + stub := fake.BroadcastStub + fakeReturns := fake.broadcastReturns fake.recordInvocation("Broadcast", []interface{}{arg1, arg2}) fake.broadcastMutex.Unlock() - if fake.BroadcastStub != nil { - return fake.BroadcastStub(arg1, arg2...) + if stub != nil { + return stub(arg1, arg2...) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.broadcastReturns return fakeReturns.result1, fakeReturns.result2 } @@ -113,15 +114,16 @@ func (fake *ABClient) Deliver(arg1 context.Context, arg2 ...grpc.CallOption) (or arg1 context.Context arg2 []grpc.CallOption }{arg1, arg2}) + stub := fake.DeliverStub + fakeReturns := fake.deliverReturns fake.recordInvocation("Deliver", []interface{}{arg1, arg2}) fake.deliverMutex.Unlock() - if fake.DeliverStub != nil { - return fake.DeliverStub(arg1, arg2...) + if stub != nil { + return stub(arg1, arg2...) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.deliverReturns return fakeReturns.result1, fakeReturns.result2 } diff --git a/internal/pkg/gateway/mocks/aclchecker.go b/internal/pkg/gateway/mocks/aclchecker.go new file mode 100644 index 00000000000..26edba54100 --- /dev/null +++ b/internal/pkg/gateway/mocks/aclchecker.go @@ -0,0 +1,111 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package mocks + +import ( + "sync" +) + +type ACLChecker struct { + CheckACLStub func(string, string, interface{}) error + checkACLMutex sync.RWMutex + checkACLArgsForCall []struct { + arg1 string + arg2 string + arg3 interface{} + } + checkACLReturns struct { + result1 error + } + checkACLReturnsOnCall map[int]struct { + result1 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *ACLChecker) CheckACL(arg1 string, arg2 string, arg3 interface{}) error { + fake.checkACLMutex.Lock() + ret, specificReturn := fake.checkACLReturnsOnCall[len(fake.checkACLArgsForCall)] + fake.checkACLArgsForCall = append(fake.checkACLArgsForCall, struct { + arg1 string + arg2 string + arg3 interface{} + }{arg1, arg2, arg3}) + stub := fake.CheckACLStub + fakeReturns := fake.checkACLReturns + fake.recordInvocation("CheckACL", []interface{}{arg1, arg2, arg3}) + fake.checkACLMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *ACLChecker) CheckACLCallCount() int { + fake.checkACLMutex.RLock() + defer fake.checkACLMutex.RUnlock() + return len(fake.checkACLArgsForCall) +} + +func (fake *ACLChecker) CheckACLCalls(stub func(string, string, interface{}) error) { + fake.checkACLMutex.Lock() + defer fake.checkACLMutex.Unlock() + fake.CheckACLStub = stub +} + +func (fake *ACLChecker) CheckACLArgsForCall(i int) (string, string, interface{}) { + fake.checkACLMutex.RLock() + defer fake.checkACLMutex.RUnlock() + argsForCall := fake.checkACLArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 +} + +func (fake *ACLChecker) CheckACLReturns(result1 error) { + fake.checkACLMutex.Lock() + defer fake.checkACLMutex.Unlock() + fake.CheckACLStub = nil + fake.checkACLReturns = struct { + result1 error + }{result1} +} + +func (fake *ACLChecker) CheckACLReturnsOnCall(i int, result1 error) { + fake.checkACLMutex.Lock() + defer fake.checkACLMutex.Unlock() + fake.CheckACLStub = nil + if fake.checkACLReturnsOnCall == nil { + fake.checkACLReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.checkACLReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *ACLChecker) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.checkACLMutex.RLock() + defer fake.checkACLMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *ACLChecker) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} diff --git a/internal/pkg/gateway/mocks/commitfinder.go b/internal/pkg/gateway/mocks/commitfinder.go index 43466abbfb7..546cc322e62 100644 --- a/internal/pkg/gateway/mocks/commitfinder.go +++ b/internal/pkg/gateway/mocks/commitfinder.go @@ -36,15 +36,16 @@ func (fake *CommitFinder) TransactionStatus(arg1 context.Context, arg2 string, a arg2 string arg3 string }{arg1, arg2, arg3}) + stub := fake.TransactionStatusStub + fakeReturns := fake.transactionStatusReturns fake.recordInvocation("TransactionStatus", []interface{}{arg1, arg2, arg3}) fake.transactionStatusMutex.Unlock() - if fake.TransactionStatusStub != nil { - return fake.TransactionStatusStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.transactionStatusReturns return fakeReturns.result1, fakeReturns.result2 } diff --git a/internal/pkg/gateway/mocks/dialer.go b/internal/pkg/gateway/mocks/dialer.go index 0cea2a58819..bda7357283e 100644 --- a/internal/pkg/gateway/mocks/dialer.go +++ b/internal/pkg/gateway/mocks/dialer.go @@ -36,15 +36,17 @@ func (fake *Dialer) Spy(arg1 context.Context, arg2 string, arg3 ...grpc.DialOpti arg2 string arg3 []grpc.DialOption }{arg1, arg2, arg3}) + stub := fake.Stub + returns := fake.returns fake.recordInvocation("dialer", []interface{}{arg1, arg2, arg3}) fake.mutex.Unlock() - if fake.Stub != nil { - return fake.Stub(arg1, arg2, arg3...) + if stub != nil { + return stub(arg1, arg2, arg3...) } if specificReturn { return ret.result1, ret.result2 } - return fake.returns.result1, fake.returns.result2 + return returns.result1, returns.result2 } func (fake *Dialer) CallCount() int { diff --git a/internal/pkg/gateway/mocks/discovery.go b/internal/pkg/gateway/mocks/discovery.go index 803ee62ddcb..841facfe243 100644 --- a/internal/pkg/gateway/mocks/discovery.go +++ b/internal/pkg/gateway/mocks/discovery.go @@ -69,15 +69,16 @@ func (fake *Discovery) Config(arg1 string) (*discovery.ConfigResult, error) { fake.configArgsForCall = append(fake.configArgsForCall, struct { arg1 string }{arg1}) + stub := fake.ConfigStub + fakeReturns := fake.configReturns fake.recordInvocation("Config", []interface{}{arg1}) fake.configMutex.Unlock() - if fake.ConfigStub != nil { - return fake.ConfigStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.configReturns return fakeReturns.result1, fakeReturns.result2 } @@ -131,15 +132,16 @@ func (fake *Discovery) IdentityInfo() api.PeerIdentitySet { ret, specificReturn := fake.identityInfoReturnsOnCall[len(fake.identityInfoArgsForCall)] fake.identityInfoArgsForCall = append(fake.identityInfoArgsForCall, struct { }{}) + stub := fake.IdentityInfoStub + fakeReturns := fake.identityInfoReturns fake.recordInvocation("IdentityInfo", []interface{}{}) fake.identityInfoMutex.Unlock() - if fake.IdentityInfoStub != nil { - return fake.IdentityInfoStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1 } - fakeReturns := fake.identityInfoReturns return fakeReturns.result1 } @@ -185,15 +187,16 @@ func (fake *Discovery) PeersForEndorsement(arg1 common.ChannelID, arg2 *discover arg1 common.ChannelID arg2 *discovery.ChaincodeInterest }{arg1, arg2}) + stub := fake.PeersForEndorsementStub + fakeReturns := fake.peersForEndorsementReturns fake.recordInvocation("PeersForEndorsement", []interface{}{arg1, arg2}) fake.peersForEndorsementMutex.Unlock() - if fake.PeersForEndorsementStub != nil { - return fake.PeersForEndorsementStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.peersForEndorsementReturns return fakeReturns.result1, fakeReturns.result2 } @@ -248,15 +251,16 @@ func (fake *Discovery) PeersOfChannel(arg1 common.ChannelID) discoverya.Members fake.peersOfChannelArgsForCall = append(fake.peersOfChannelArgsForCall, struct { arg1 common.ChannelID }{arg1}) + stub := fake.PeersOfChannelStub + fakeReturns := fake.peersOfChannelReturns fake.recordInvocation("PeersOfChannel", []interface{}{arg1}) fake.peersOfChannelMutex.Unlock() - if fake.PeersOfChannelStub != nil { - return fake.PeersOfChannelStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1 } - fakeReturns := fake.peersOfChannelReturns return fakeReturns.result1 } diff --git a/internal/pkg/gateway/mocks/endorserclient.go b/internal/pkg/gateway/mocks/endorserclient.go index dfc7374abec..f363a343508 100644 --- a/internal/pkg/gateway/mocks/endorserclient.go +++ b/internal/pkg/gateway/mocks/endorserclient.go @@ -37,15 +37,16 @@ func (fake *EndorserClient) ProcessProposal(arg1 context.Context, arg2 *peer.Sig arg2 *peer.SignedProposal arg3 []grpc.CallOption }{arg1, arg2, arg3}) + stub := fake.ProcessProposalStub + fakeReturns := fake.processProposalReturns fake.recordInvocation("ProcessProposal", []interface{}{arg1, arg2, arg3}) fake.processProposalMutex.Unlock() - if fake.ProcessProposalStub != nil { - return fake.ProcessProposalStub(arg1, arg2, arg3...) + if stub != nil { + return stub(arg1, arg2, arg3...) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.processProposalReturns return fakeReturns.result1, fakeReturns.result2 } diff --git a/vendor/github.com/hyperledger/fabric-protos-go/gateway/gateway.pb.go b/vendor/github.com/hyperledger/fabric-protos-go/gateway/gateway.pb.go index 2cacc566558..ecac0a1795d 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go/gateway/gateway.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go/gateway/gateway.pb.go @@ -229,13 +229,66 @@ func (m *SubmitResponse) XXX_DiscardUnknown() { var xxx_messageInfo_SubmitResponse proto.InternalMessageInfo +// SignedCommitStatusRequest contains a serialized CommitStatusRequest message, and a digital signature for the +// serialized request message. +type SignedCommitStatusRequest struct { + // Serialized CommitStatusRequest message + Request []byte `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"` + // Signature for request message. + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SignedCommitStatusRequest) Reset() { *m = SignedCommitStatusRequest{} } +func (m *SignedCommitStatusRequest) String() string { return proto.CompactTextString(m) } +func (*SignedCommitStatusRequest) ProtoMessage() {} +func (*SignedCommitStatusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_285396c8df15061f, []int{4} +} + +func (m *SignedCommitStatusRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SignedCommitStatusRequest.Unmarshal(m, b) +} +func (m *SignedCommitStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SignedCommitStatusRequest.Marshal(b, m, deterministic) +} +func (m *SignedCommitStatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignedCommitStatusRequest.Merge(m, src) +} +func (m *SignedCommitStatusRequest) XXX_Size() int { + return xxx_messageInfo_SignedCommitStatusRequest.Size(m) +} +func (m *SignedCommitStatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SignedCommitStatusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SignedCommitStatusRequest proto.InternalMessageInfo + +func (m *SignedCommitStatusRequest) GetRequest() []byte { + if m != nil { + return m.Request + } + return nil +} + +func (m *SignedCommitStatusRequest) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + // CommitStatusRequest contains the details required to check whether a transaction has been // successfully committed. type CommitStatusRequest struct { // Identifier of the transaction to check. TransactionId string `protobuf:"bytes,1,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` // Identifier of the channel this request is bound for. - ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // Client requestor identity. + Identity []byte `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -245,7 +298,7 @@ func (m *CommitStatusRequest) Reset() { *m = CommitStatusRequest{} } func (m *CommitStatusRequest) String() string { return proto.CompactTextString(m) } func (*CommitStatusRequest) ProtoMessage() {} func (*CommitStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_285396c8df15061f, []int{4} + return fileDescriptor_285396c8df15061f, []int{5} } func (m *CommitStatusRequest) XXX_Unmarshal(b []byte) error { @@ -280,6 +333,13 @@ func (m *CommitStatusRequest) GetChannelId() string { return "" } +func (m *CommitStatusRequest) GetIdentity() []byte { + if m != nil { + return m.Identity + } + return nil +} + // CommitStatusResponse returns the result of committing a transaction. type CommitStatusResponse struct { // The result of the transaction commit, as defined in peer/transaction.proto @@ -293,7 +353,7 @@ func (m *CommitStatusResponse) Reset() { *m = CommitStatusResponse{} } func (m *CommitStatusResponse) String() string { return proto.CompactTextString(m) } func (*CommitStatusResponse) ProtoMessage() {} func (*CommitStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_285396c8df15061f, []int{5} + return fileDescriptor_285396c8df15061f, []int{6} } func (m *CommitStatusResponse) XXX_Unmarshal(b []byte) error { @@ -338,7 +398,7 @@ func (m *EvaluateRequest) Reset() { *m = EvaluateRequest{} } func (m *EvaluateRequest) String() string { return proto.CompactTextString(m) } func (*EvaluateRequest) ProtoMessage() {} func (*EvaluateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_285396c8df15061f, []int{6} + return fileDescriptor_285396c8df15061f, []int{7} } func (m *EvaluateRequest) XXX_Unmarshal(b []byte) error { @@ -394,7 +454,7 @@ func (m *EvaluateResponse) Reset() { *m = EvaluateResponse{} } func (m *EvaluateResponse) String() string { return proto.CompactTextString(m) } func (*EvaluateResponse) ProtoMessage() {} func (*EvaluateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_285396c8df15061f, []int{7} + return fileDescriptor_285396c8df15061f, []int{8} } func (m *EvaluateResponse) XXX_Unmarshal(b []byte) error { @@ -444,7 +504,7 @@ func (m *EndpointError) Reset() { *m = EndpointError{} } func (m *EndpointError) String() string { return proto.CompactTextString(m) } func (*EndpointError) ProtoMessage() {} func (*EndpointError) Descriptor() ([]byte, []int) { - return fileDescriptor_285396c8df15061f, []int{8} + return fileDescriptor_285396c8df15061f, []int{9} } func (m *EndpointError) XXX_Unmarshal(b []byte) error { @@ -486,57 +546,176 @@ func (m *EndpointError) GetMessage() string { return "" } +// ProposedTransaction contains the details required for offline signing prior to evaluating or endorsing +// a transaction. +type ProposedTransaction struct { + // Identifier of the proposed transaction. + TransactionId string `protobuf:"bytes,1,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` + // The signed proposal. + Proposal *peer.SignedProposal `protobuf:"bytes,2,opt,name=proposal,proto3" json:"proposal,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProposedTransaction) Reset() { *m = ProposedTransaction{} } +func (m *ProposedTransaction) String() string { return proto.CompactTextString(m) } +func (*ProposedTransaction) ProtoMessage() {} +func (*ProposedTransaction) Descriptor() ([]byte, []int) { + return fileDescriptor_285396c8df15061f, []int{10} +} + +func (m *ProposedTransaction) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProposedTransaction.Unmarshal(m, b) +} +func (m *ProposedTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProposedTransaction.Marshal(b, m, deterministic) +} +func (m *ProposedTransaction) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProposedTransaction.Merge(m, src) +} +func (m *ProposedTransaction) XXX_Size() int { + return xxx_messageInfo_ProposedTransaction.Size(m) +} +func (m *ProposedTransaction) XXX_DiscardUnknown() { + xxx_messageInfo_ProposedTransaction.DiscardUnknown(m) +} + +var xxx_messageInfo_ProposedTransaction proto.InternalMessageInfo + +func (m *ProposedTransaction) GetTransactionId() string { + if m != nil { + return m.TransactionId + } + return "" +} + +func (m *ProposedTransaction) GetProposal() *peer.SignedProposal { + if m != nil { + return m.Proposal + } + return nil +} + +// PreparedTransaction contains the details required for offline signing prior to submitting a transaction. +type PreparedTransaction struct { + // Identifier of the prepared transaction. + TransactionId string `protobuf:"bytes,1,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` + // The transaction envelope. + Envelope *common.Envelope `protobuf:"bytes,2,opt,name=envelope,proto3" json:"envelope,omitempty"` + // The response that is returned by the transaction function during endorsement, as defined + // in peer/proposal_response.proto + Result *peer.Response `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PreparedTransaction) Reset() { *m = PreparedTransaction{} } +func (m *PreparedTransaction) String() string { return proto.CompactTextString(m) } +func (*PreparedTransaction) ProtoMessage() {} +func (*PreparedTransaction) Descriptor() ([]byte, []int) { + return fileDescriptor_285396c8df15061f, []int{11} +} + +func (m *PreparedTransaction) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PreparedTransaction.Unmarshal(m, b) +} +func (m *PreparedTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PreparedTransaction.Marshal(b, m, deterministic) +} +func (m *PreparedTransaction) XXX_Merge(src proto.Message) { + xxx_messageInfo_PreparedTransaction.Merge(m, src) +} +func (m *PreparedTransaction) XXX_Size() int { + return xxx_messageInfo_PreparedTransaction.Size(m) +} +func (m *PreparedTransaction) XXX_DiscardUnknown() { + xxx_messageInfo_PreparedTransaction.DiscardUnknown(m) +} + +var xxx_messageInfo_PreparedTransaction proto.InternalMessageInfo + +func (m *PreparedTransaction) GetTransactionId() string { + if m != nil { + return m.TransactionId + } + return "" +} + +func (m *PreparedTransaction) GetEnvelope() *common.Envelope { + if m != nil { + return m.Envelope + } + return nil +} + +func (m *PreparedTransaction) GetResult() *peer.Response { + if m != nil { + return m.Result + } + return nil +} + func init() { proto.RegisterType((*EndorseRequest)(nil), "gateway.EndorseRequest") proto.RegisterType((*EndorseResponse)(nil), "gateway.EndorseResponse") proto.RegisterType((*SubmitRequest)(nil), "gateway.SubmitRequest") proto.RegisterType((*SubmitResponse)(nil), "gateway.SubmitResponse") + proto.RegisterType((*SignedCommitStatusRequest)(nil), "gateway.SignedCommitStatusRequest") proto.RegisterType((*CommitStatusRequest)(nil), "gateway.CommitStatusRequest") proto.RegisterType((*CommitStatusResponse)(nil), "gateway.CommitStatusResponse") proto.RegisterType((*EvaluateRequest)(nil), "gateway.EvaluateRequest") proto.RegisterType((*EvaluateResponse)(nil), "gateway.EvaluateResponse") proto.RegisterType((*EndpointError)(nil), "gateway.EndpointError") + proto.RegisterType((*ProposedTransaction)(nil), "gateway.ProposedTransaction") + proto.RegisterType((*PreparedTransaction)(nil), "gateway.PreparedTransaction") } func init() { proto.RegisterFile("gateway/gateway.proto", fileDescriptor_285396c8df15061f) } var fileDescriptor_285396c8df15061f = []byte{ - // 545 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xc1, 0x6b, 0xdb, 0x3e, - 0x14, 0xc6, 0x29, 0xbf, 0xe4, 0x97, 0xd7, 0x26, 0x0b, 0x4a, 0x9b, 0x66, 0xa6, 0x85, 0x62, 0x28, - 0xe4, 0xd2, 0x78, 0x64, 0xa7, 0x41, 0x61, 0xd0, 0x10, 0xb6, 0xb0, 0x4b, 0x48, 0xca, 0x0e, 0xdd, - 0x21, 0x28, 0x91, 0xe6, 0x18, 0x6c, 0x49, 0x93, 0xe4, 0x6e, 0xbd, 0xed, 0x4f, 0xd8, 0x79, 0xb7, - 0xed, 0x2f, 0x1d, 0xb6, 0xa4, 0xc4, 0x5e, 0xdb, 0x43, 0xa1, 0x87, 0x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dc, 0x52, 0x3f, 0xc0, 0x41, 0xd9, 0x0d, 0xe8, - 0x64, 0x9b, 0xf8, 0x80, 0x03, 0xfd, 0xd3, 0x47, 0xa2, 0xb6, 0xd8, 0x5b, 0xf8, 0xdf, 0xcd, 0x1a, - 0x95, 0xd4, 0x56, 0x2d, 0xe2, 0xbf, 0x7c, 0x20, 0x62, 0x0a, 0x5c, 0x6d, 0xe0, 0x9c, 0xcb, 0x68, - 0xb8, 0xb9, 0x13, 0x54, 0x26, 0x94, 0x44, 0x54, 0x0e, 0x3f, 0xe3, 0x95, 0x8c, 0xd7, 0x6e, 0x41, - 0x96, 0x79, 0x75, 0x60, 0x07, 0x37, 0xcb, 0xe1, 0x99, 0x77, 0x13, 0x46, 0xb1, 0xde, 0x64, 0xab, - 0xfc, 0xc2, 0x85, 0x25, 0x76, 0x68, 0xd8, 0x17, 0x86, 0x7d, 0x11, 0x71, 0xf7, 0x4e, 0xaf, 0xea, - 0x05, 0xf4, 0xfa, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x7f, 0x72, 0xba, 0xc1, 0x05, 0x00, - 0x00, + // 639 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4d, 0x6b, 0xdb, 0x40, + 0x10, 0x45, 0x09, 0xf5, 0xc7, 0xc4, 0x71, 0xc3, 0x3a, 0x1f, 0x8e, 0x48, 0x20, 0x08, 0x02, 0x39, + 0x34, 0x76, 0x71, 0x4f, 0x85, 0x40, 0x21, 0xc1, 0xb4, 0xbe, 0xb9, 0x72, 0xe8, 0x21, 0x97, 0xb0, + 0xf6, 0x6e, 0x65, 0x81, 0xb4, 0xab, 0xee, 0xae, 0x92, 0xe6, 0xd6, 0x1f, 0x51, 0x7a, 0xe8, 0xad, + 0xfd, 0xa5, 0x45, 0xda, 0x5d, 0x59, 0xaa, 0xed, 0x92, 0x40, 0x0e, 0x3d,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f4, + 0xe6, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x96, 0x83, 0x28, 0x51, 0x41, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -567,7 +746,7 @@ type GatewayClient interface { // The CommitStatus service will indicate whether a prepared transaction previously submitted to // the Submit sevice has been committed. It will wait for the commit to occur if it hasn’t already // committed. - CommitStatus(ctx context.Context, in *CommitStatusRequest, opts ...grpc.CallOption) (*CommitStatusResponse, error) + CommitStatus(ctx context.Context, in *SignedCommitStatusRequest, opts ...grpc.CallOption) (*CommitStatusResponse, error) // The Evaluate service passes a proposed transaction to the gateway in order to invoke the // transaction function and return the result to the client. No ledger updates are made. // The gateway will select an appropriate peer to query based on block height and load. @@ -600,7 +779,7 @@ func (c *gatewayClient) Submit(ctx context.Context, in *SubmitRequest, opts ...g return out, nil } -func (c *gatewayClient) CommitStatus(ctx context.Context, in *CommitStatusRequest, opts ...grpc.CallOption) (*CommitStatusResponse, error) { +func (c *gatewayClient) CommitStatus(ctx context.Context, in *SignedCommitStatusRequest, opts ...grpc.CallOption) (*CommitStatusResponse, error) { out := new(CommitStatusResponse) err := c.cc.Invoke(ctx, "/gateway.Gateway/CommitStatus", in, out, opts...) if err != nil { @@ -636,7 +815,7 @@ type GatewayServer interface { // The CommitStatus service will indicate whether a prepared transaction previously submitted to // the Submit sevice has been committed. It will wait for the commit to occur if it hasn’t already // committed. - CommitStatus(context.Context, *CommitStatusRequest) (*CommitStatusResponse, error) + CommitStatus(context.Context, *SignedCommitStatusRequest) (*CommitStatusResponse, error) // The Evaluate service passes a proposed transaction to the gateway in order to invoke the // transaction function and return the result to the client. No ledger updates are made. // The gateway will select an appropriate peer to query based on block height and load. @@ -653,7 +832,7 @@ func (*UnimplementedGatewayServer) Endorse(ctx context.Context, req *EndorseRequ func (*UnimplementedGatewayServer) Submit(ctx context.Context, req *SubmitRequest) (*SubmitResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Submit not implemented") } -func (*UnimplementedGatewayServer) CommitStatus(ctx context.Context, req *CommitStatusRequest) (*CommitStatusResponse, error) { +func (*UnimplementedGatewayServer) CommitStatus(ctx context.Context, req *SignedCommitStatusRequest) (*CommitStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CommitStatus not implemented") } func (*UnimplementedGatewayServer) Evaluate(ctx context.Context, req *EvaluateRequest) (*EvaluateResponse, error) { @@ -701,7 +880,7 @@ func _Gateway_Submit_Handler(srv interface{}, ctx context.Context, dec func(inte } func _Gateway_CommitStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CommitStatusRequest) + in := new(SignedCommitStatusRequest) if err := dec(in); err != nil { return nil, err } @@ -713,7 +892,7 @@ func _Gateway_CommitStatus_Handler(srv interface{}, ctx context.Context, dec fun FullMethod: "/gateway.Gateway/CommitStatus", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(GatewayServer).CommitStatus(ctx, req.(*CommitStatusRequest)) + return srv.(GatewayServer).CommitStatus(ctx, req.(*SignedCommitStatusRequest)) } return interceptor(ctx, in, info, handler) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 566edf12900..070f95bfd05 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -195,7 +195,7 @@ github.com/hyperledger/fabric-config/protolator/protoext/peerext # github.com/hyperledger/fabric-lib-go v1.0.0 ## explicit github.com/hyperledger/fabric-lib-go/healthz -# github.com/hyperledger/fabric-protos-go v0.0.0-20210311171918-e08edaab0493 +# github.com/hyperledger/fabric-protos-go v0.0.0-20210422135545-37e930696e2a ## explicit github.com/hyperledger/fabric-protos-go/common github.com/hyperledger/fabric-protos-go/discovery