Skip to content

Commit

Permalink
FAB-938 Catch up e2e test to latest Peer protobuf
Browse files Browse the repository at this point in the history
Due to the changes in protobuf definitions around proposal response
and Transaction object, the end-to-end test that has the code to
build the Transaction object from ProposalResponse must be updated
to work with the latest Peer code.

Also removed unused old proto files.

Change-Id: Ib1ba0c0e504a4ce10d7c1069380c9b90640b0e38
Signed-off-by: Jim Zhang <jzhang@us.ibm.com>
  • Loading branch information
jimthematrix committed Nov 3, 2016
1 parent 3ca4e6f commit eb8eeac
Show file tree
Hide file tree
Showing 13 changed files with 183 additions and 852 deletions.
4 changes: 2 additions & 2 deletions lib/Member.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ var Member = class {
let peer = new Peer(request.endorserUrl);
return peer.sendProposal(proposal)
.then(
function(response) {
resolve(response);
function(data) {
resolve(data);
}
);
}
Expand Down
4 changes: 3 additions & 1 deletion lib/Peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ var Peer = class extends Remote {
} else {
if (response) {
logger.info('Received proposal response: code - %s', JSON.stringify(response.response.status));
resolve(response);
// return the original proposal payload along with the response, so that
// it can be used to construct the Transaction object
resolve([response, proposal.payload]);
} else {
logger.error('GRPC client failed to get a proper response from the peer.');
reject(new Error('GRPC client failed to get a proper response from the peer.'));
Expand Down
56 changes: 0 additions & 56 deletions lib/protos/api.proto

This file was deleted.

55 changes: 55 additions & 0 deletions lib/protos/chaincode_transaction.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

syntax = "proto3";

package protos;

import "fabric_proposal_response.proto";

// ChaincodeActionPayload is the message to be used for the TransactionAction's
// payload when the Header's type is set to CHAINCODE. It carries the
// chaincodeProposalPayload and an endorsed action to apply to the ledger.
message ChaincodeActionPayload {

// This field contains the bytes of the ChaincodeProposalPayload message from
// the original invocation (essentially the arguments) after the application
// of the visibility function. The main visibility modes are "full" (the
// entire ChaincodeProposalPayload message is included here), "hash" (only
// the hash of the ChaincodeProposalPayload message is included) or
// "nothing". This field will be used to check the consistency of
// ProposalResponsePayload.proposalHash. For the CHAINCODE type,
// ProposalResponsePayload.proposalHash is supposed to be H(ProposalHeader ||
// f(ChaincodeProposalPayload)) where f is the visibility function.
bytes chaincodeProposalPayload = 1;

// The list of actions to apply to the ledger
ChaincodeEndorsedAction action = 2;
}

// ChaincodeEndorsedAction carries information about the endorsement of a
// specific proposal
message ChaincodeEndorsedAction {

// This is the bytes of the ProposalResponsePayload message signed by the
// endorsers. Recall that for the CHAINCODE type, the
// ProposalResponsePayload's extenstion field carries a ChaincodeAction
bytes proposalResponsePayload = 1;

// The endorsement of the proposal, basically the endorser's signature over
// proposalResponsePayload
repeated Endorsement endorsements = 2;
}
2 changes: 1 addition & 1 deletion lib/protos/chaincodeevent.proto
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ message ChaincodeEvent {
string txID = 2;
string eventName = 3;
bytes payload = 4;
}
}
97 changes: 0 additions & 97 deletions lib/protos/devops.proto

This file was deleted.

95 changes: 0 additions & 95 deletions lib/protos/events.proto

This file was deleted.

Loading

0 comments on commit eb8eeac

Please sign in to comment.