Skip to content

Commit

Permalink
NodeSDK - updates to protos
Browse files Browse the repository at this point in the history
Pull in latest fabric protos and minor updates to
the end-to-end test to check results of all endorsers

Updated docker-compose.yml to add 2nd peer to support
the tests

Change-Id: Idb93725a4b72efa842dda35b56d4a820f57d53e8
Signed-off-by: Bret Harrison <[email protected]>
Signed-off-by: Jim Zhang <[email protected]>
  • Loading branch information
jimthematrix committed Dec 8, 2016
1 parent 8846301 commit 1949d11
Show file tree
Hide file tree
Showing 8 changed files with 315 additions and 213 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ This project publishes two separate npm packages:
In the project root folder:
* `npm install` to install dependencies
* `gulp cop` to copy common dependent modules from the `hfc` folder to the `hfc-cop` folder
* `gulp watch` to set up watch that updates hfc-cop's shared dependencies from hfc/lib and updates installed hfc and hfc-cop modules in node_modules
* `gulp doc` to generate API docs
* `gulp watch` to set up watch that updates hfc-cop's shared dependencies from hfc/lib and updates installed hfc and hfc-cop modules in node_modules. This command does not return, so you should keep it running in a separate command window as you work on the code and test in another command window
* optionally, `gulp doc` to generate API docs if you want to review the doc content
* `npm test` to run the headless tests that do not require any additional set up

The following tests require setting up a local blockchain network as the target. Because v1.0 is still in active development, you still need the vagrant environment to build the necessary Docker images needed to run the network. Follow the steps below to set it up.
* You will need the COP server (new implementation of the member service) to run the tests. Because the COP project's build script does not yet produce a docker image, you'd need to run the COP server as a native process inside vagrant
* git clone the repository hyperledger/fabric-cop alongside your hyperledger/fabric project in your $GOPATH/src/github.com location
* `cd fabric/devenv`
* Open the file `Vagrantfile` and insert the following statement below the existing `config.vm.network` statements:
* ` config.vm.network :forwarded_port, guest: 7056, host: 7056 # Openchain gRPC services`
Expand All @@ -41,11 +43,16 @@ The following tests require setting up a local blockchain network as the target.
* run `make images` to build the docker images
* copy [docker-compose.yml](https://raw.githubusercontent.com/hyperledger/fabric-sdk-node/master/test/fixtures/docker-compose.yml) file in home directory (/home/vagrant) and copy the following content into the file
* run `docker-compose up --force-recreate` to launch the network
* You also need to start your COP server to allow the SDK to enroll users:
* change directory to they fabric-cop project, follow the instructions in [the fabric-cop README](https://github.com/hyperledger/fabric-cop) to build the COP binary
* launch the server with the following command from the fabric-cop directory:
* `bin/cop server start -address "" -ca testdata/ec.pem -ca-key testdata/ec-key.pem -config testdata/testconfig.json`

* Back in your native host (MacOS, or Windows, or Ubuntu, etc), run the following tests:
* Clear out your previous keyvalue store if needed (rm -fr /tmp/KeyValStore*)
* Run `gulp test` to run the entire test bucket and generate coverage reports (both in console output and HTMLs)
* Test user management with a member services, run `node test/unit/ca-tests.js`
* Test happy path from end to end, run `node test/unit/end-2-end.js`
* Test happy path from end to end, run `node test/unit/end-to-end.js`
* Test transaction proposals, run `node test/unit/endorser-tests.js`
* Test sending endorsed transactions for consensus, run `node test/unit/orderer-tests.js`

Expand Down
2 changes: 1 addition & 1 deletion hfc/lib/Member.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ var Member = class {
let chainHeader = new _commonProto.ChainHeader();
chainHeader.setType(_commonProto.HeaderType.ENDORSER_TRANSACTION);
chainHeader.setTxID(tx_id.toString());
chainHeader.setChainID(Buffer.from(chain_id));
chainHeader.setChainID(chain_id);
if(chaincode_id) {
let chaincodeID = new _ccProto.ChaincodeID();
chaincodeID.setName(chaincode_id);
Expand Down
3 changes: 2 additions & 1 deletion hfc/lib/protos/common/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ enum Status {
BAD_REQUEST = 400;
FORBIDDEN = 403;
NOT_FOUND = 404;
REQUEST_ENTITY_TOO_LARGE = 413;
INTERNAL_SERVER_ERROR = 500;
SERVICE_UNAVAILABLE = 503;
}
Expand Down Expand Up @@ -57,7 +58,7 @@ message ChainHeader {
google.protobuf.Timestamp timestamp = 3;

// Identifier of the chain this message is bound for
bytes chainID = 4;
string chainID = 4;

// An unique identifier that is used end-to-end.
// - set by higher layers such as end user or SDK
Expand Down
2 changes: 1 addition & 1 deletion hfc/lib/protos/orderer/ab.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ message SeekInfo {
StartType Start = 1;
uint64 SpecifiedNumber = 2; // Only used when start = SPECIFIED
uint64 WindowSize = 3; // The window size is the maximum number of blocks that will be sent without Acknowledgement, the base of the window moves to the most recently received acknowledgment
bytes ChainID = 4; // The chain to seek within
string ChainID = 4; // The chain to seek within
}

message Acknowledgement {
Expand Down
2 changes: 1 addition & 1 deletion hfc/lib/protos/peer/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ message Event {
Register register = 1;

//producer events
Block2 block = 2;
common.Block block = 2;
ChaincodeEvent chaincodeEvent = 3;
Rejection rejection = 4;

Expand Down
42 changes: 21 additions & 21 deletions test/fixtures/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ vp0:
ports:
- 7051:7051

# vp1:
# image: hyperledger/fabric-peer
# environment:
# - CORE_PEER_ADDRESSAUTODETECT=true
# - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# - CORE_LOGGING_LEVEL=DEBUG
# - CORE_PEER_NETWORKID=${CORE_PEER_NETWORKID}
# - CORE_NEXT=true
# - CORE_PEER_ENDORSER_ENABLED=true
# - CORE_PEER_ID=vp1
# - CORE_PEER_PROFILE_ENABLED=true
# - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050
# - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051
# volumes:
# - /var/run/:/host/var/run/
# command: peer node start
# links:
# - orderer
# - vp0
# ports:
# - 7056:7051
vp1:
image: hyperledger/fabric-peer
environment:
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_NETWORKID=${CORE_PEER_NETWORKID}
- CORE_NEXT=true
- CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_ID=vp1
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050
- CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051
volumes:
- /var/run/:/host/var/run/
command: peer node start
links:
- orderer
- vp0
ports:
- 7056:7051
Loading

0 comments on commit 1949d11

Please sign in to comment.