Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Commit

Permalink
Update master 4 (#1161)
Browse files Browse the repository at this point in the history
* fix spinner on channel for contracts not started

Signed-off-by: heatherlp <heatherpollard0@gmail.com>

(cherry picked from commit a3f6aef)
Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>

* Updated README (#1139)

Signed-off-by: Jake Turner <jaketurner25@live.com>

(cherry picked from commit 39d4ea1)
Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>

* Fix tests in travis (#1140)

Fix broken tests
Move to new way of testing
Disabled coverage as that isn't working with new way of testing
Disabled npm audit
Disabled sysTests

Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>

(cherry picked from commit 5a80e7d)
Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>

* Fix travis build (#1149)

Use version 1.35.1 for unit tests
Updated rewritePackageJson to edit engine
Put code coverage back in
moved npm package to before unit test

Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>

(cherry picked from commit aa4b702)
Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>

* Attributes (#1145)

Signed-off-by: Jake Turner <jaketurner25@live.com>

(cherry picked from commit a673598)
Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>

* URL Change (Closes issue #1067) (#1151)

Signed-off-by: Akshat Shah <akshatshah@akshats-mbp.hursley.uk.ibm.com>

(cherry picked from commit 08a193b)
Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>

* Update Debug (#1130)

kill the chaincode container if running
move instantiate and upgrade to when play is pressed
update readme

closes #1118

Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>

(cherry picked from commit 959121c)
Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>

* Updated 1.0.5 changelog (#1158)

Signed-off-by: Jake Turner <jaketurner25@live.com>

(cherry picked from commit 17fdda2)
Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>

* Update to latest version from master

Signed-off-by: Caroline Fletcher <caroline.fletcher@uk.ibm.com>
  • Loading branch information
cazfletch committed Jul 17, 2019
1 parent 324718c commit ca8c925
Show file tree
Hide file tree
Showing 87 changed files with 3,253 additions and 1,461 deletions.
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ before_install:

npm install npm@latest -g;
fi
- nvm install --lts
install: |
./.travis/install.sh
Expand All @@ -20,15 +21,9 @@ jobs:
- script: ./.travis/script.sh
os: osx
env: TASK=unit
language: node_js
node_js:
- "lts/*"
- script: ./.travis/script.sh
os: linux
env: TASK=unit
- script: ./.travis/script.sh
os: linux
env: TASK=systestsNode
- script: ./.travis/script.sh
os: linux
env: TASK=cucumber
Expand Down
20 changes: 12 additions & 8 deletions .travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,29 @@ set -o pipefail

cd ./client

npm --version

node --version

npm install --no-optional
npm install --ignore-scripts

npm audit
# npm audit

npm run compile

if [ "${TASK}" == "unit" ]; then
npm rebuild grpc --target=4.2.5 --runtime=electron --dist-url=https://atom.io/download/electron
npm rebuild grpc --target=3.0.0 --runtime=electron --dist-url=https://atom.io/download/electron

if [ $TRAVIS_OS_NAME == "linux" ]; then
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
rm -rf ./node_modules/grpc/src/node/extension_binary/node-v69-linux-x64-glibc
mv ./node_modules/grpc/src/node/extension_binary/electron-v4.2-linux-x64-glibc ./node_modules/grpc/src/node/extension_binary/node-v69-linux-x64-glibc
rm -rf ./node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc
mv ./node_modules/grpc/src/node/extension_binary/electron-v3.0-linux-x64-glibc ./node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc
elif [ $TRAVIS_OS_NAME == "windows" ]; then
rm -rf ./node_modules/grpc/src/node/extension_binary/node-v69-win32-x64-unknown
mv ./node_modules/grpc/src/node/extension_binary/electron-v4.2-win32-x64-unknown ./node_modules/grpc/src/node/extension_binary/node-v69-win32-x64-unknown
rm -rf ./node_modules/grpc/src/node/extension_binary/node-v64-win32-x64-unknown
mv ./node_modules/grpc/src/node/extension_binary/electron-v3.0-win32-x64-unknown ./node_modules/grpc/src/node/extension_binary/node-v64-win32-x64-unknown
else
rm -rf ./node_modules/grpc/src/node/extension_binary/node-v69-darwin-x64-unknown
mv ./node_modules/grpc/src/node/extension_binary/electron-v4.2-darwin-x64-unknown ./node_modules/grpc/src/node/extension_binary/node-v69-darwin-x64-unknown
rm -rf ./node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown
mv ./node_modules/grpc/src/node/extension_binary/electron-v3.0-darwin-x64-unknown ./node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown
fi
fi
8 changes: 8 additions & 0 deletions .travis/rewritePackageJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ if (process.argv.includes('publish')) {
throw new Error('Activation events should be * when checked in');
}

if (packageJson.engines.vscode !== '^1.36.0') {
throw new Error('Engine vscode should be ^1.36 when checked in');
}

packageJson.activationEvents = [];

packageJson.actualActivationEvents.onView.forEach((event) => {
Expand All @@ -41,6 +45,10 @@ if (process.argv.includes('publish')) {
packageJson.actualActivationEvents.other.forEach((event) => {
packageJson.activationEvents.push(event);
});

packageJson.engines = {
vscode: '1.35.1'
};
}


Expand Down
3 changes: 2 additions & 1 deletion .travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ else
if [ $TRAVIS_OS_NAME == "windows" ]; then
export CODE_DOWNLOAD_URL="https://vscode-update.azurewebsites.net/1.32.0/win32-x64-archive/stable"
fi
npm test

npm run package
npm test
fi
33 changes: 27 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Please visit the [Visual Studio Code Marketplace](https://marketplace.visualstud

You will need the following installed in order to use the extension:
- Windows 10, Linux, or Mac OS are currently the supported operating systems.
- [VS Code version 1.32 or greater](https://code.visualstudio.com)
- [VS Code version 1.36.0 or greater](https://code.visualstudio.com)
- [Node v8.x or greater and npm v5.x or greater](https://nodejs.org/en/download/)
- [Docker version v17.06.2-ce or greater](https://www.docker.com/get-docker)
- [Docker Compose v1.14.0 or greater](https://docs.docker.com/compose/install/)
Expand Down Expand Up @@ -83,12 +83,19 @@ To debug your smart contract follow these steps:
1. Ensure you are connected to the `local_fabric` runtime and that the `local_fabric` peer is in development mode. Development mode is indicated by an infinity symbol on a peer, under `Nodes` in the `Local Fabric Ops` panel. To toggle development mode, right-click the peer and select `Toggle Development Mode`. By toggling development mode, transactions will now have a large timeout value.
2. Open your smart contract project in your workspace.
3. Open the debug view in Visual Studio Code using the left-hand navigation bar.
4. Select the `Debug Smart Contract` configuration by using the dropdown in the upper-left and click the **play** button on the debug toolbar.
5. Select `Instantiate Smart Contract` from the blockchain icon on the debug toolbar. This action will package, install and instantiate a debug version of the selected smart contract. If there is a version of the selected smart contract already instantiated, select `Upgrade Smart Contract`.
6. Add breakpoints to the smart contract by clicking on the relevant line numbers in your smart contract files.
7. To submit or evaluate a transaction, click the blockchain icon on the debug toolbar. Alternatively, in the `Fabric Gateways` panel, you can right click on transactions to submit or evaluate them. Execution will be paused on any breakpoints you've defined.
4. Select the `Debug Smart Contract` configuration by using the dropdown in the upper-left and click the **play** button on the debug toolbar. The extension will automatically instantiate or upgrade the smart contract as appropriate. If you want to test out a function that is called on instantiate or upgrade add the following to the launch configuration, where `name` is the name of the smart contract and `version` is different to the previous version used. Alternatively if you are using JavaScript or TypeScript then you can update the `version` in the package.json file.

To make iterative changes to your smart contract while debugging, after making your changes click the **restart** button. You can also stop the debugging session, make futher changes and start debugging again, without needing to upgrade your smart contract. Please note, as this stores the smart contract in local memory, for many changes to large smart contracts, you may need to reinstantiate the smart contract. If you restart the `local_fabric` runtime after stopping a debugging session, you must select `Upgrade Smart Contract` by clicking the blockchain icon on the debug toolbar. This will install a new `vscode-debug-XXXXXXX` version of your smart contract, which then allows you to continue submitting and debugging transactions.
```
"env": {
"CORE_CHAINCODE_ID_NAME": <name>:<version>
}
```

5. Add breakpoints to the smart contract by clicking on the relevant line numbers in your smart contract files.
6. To submit or evaluate a transaction, click the blockchain icon on the debug toolbar. Alternatively, in the `Fabric Gateways` panel, you can right click on transactions to submit or evaluate them. Execution will be paused on any breakpoints you've defined.

#### Making changes to your contract while debugging
To make iterative changes to your smart contract while debugging, after making your changes click the **restart** button. You can also stop the debugging session, make further changes and start debugging again, without needing to upgrade your smart contract.

### Add a gateway for connecting to your own Hyperledger Fabric instance
To connect to our own Hyperledger Fabric instance, it must be running [Hyperledger Fabric v1.4.1](https://hyperledger-fabric.readthedocs.io/en/release-1.4/install.html) or later.
Expand All @@ -105,6 +112,20 @@ The `Add Identity to Wallet` command will ask for a name, MSPID and a method to

For wallets associated with other remote Fabric gateways, the `Add Wallet`,`Edit Wallet` ,`Export Wallet` and `Remove Wallet` commands are available in the `Fabric Wallets` panel for wallet management.

### Creating an identity with attributes
Identities can be registered and enrolled with attributes from the `local_fabric` certificate authority.

The `Create Identity (register and enroll)` command will ask for an identity name and whether the identity should have any attributes added.
Selecting `Yes` will ask for the identity's attributes that should be provided in the following format:

```
[{"name": "attr1", "value": "attr1value", "ecert": true}, {"name": "attr2", "value": "attr2value", "ecert": true}]
```

The key `ecert` must be set to true in order for a smart contract to be able to read the value of the attribute using ['getAttributeValue'](https://fabric-shim.github.io/release-1.4/fabric-shim.ClientIdentity.html#getAttributeValue).

Hovering over an identity in the `Fabric Wallets` panel will show any attributes associated with the identity.

## Useful Commands
The IBM Blockchain Platform extension provides an explorer and commands accessible from the Command Palette, for developing smart contracts quickly:
<!---Table of commands with columns: 'command' and 'description'
Expand Down
2 changes: 1 addition & 1 deletion client/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@
}
}
]
}
}
6 changes: 4 additions & 2 deletions client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# IBM Blockchain Platform Extension Change Log

## 1.0.5: July 11th 2019
## 1.0.5: July 17th 2019

* gRPC fix [#1124](https://github.com/IBM-Blockchain/blockchain-vscode-extension/issues/1124)
* Removed scope from package name [#1117](https://github.com/IBM-Blockchain/blockchain-vscode-extension/pull/1117)

* Add attributes to an identity created with local fabric CA [#1113](https://github.com/IBM-Blockchain/blockchain-vscode-extension/issues/1113)
* Changed home page GitHub issues link [#1067](https://github.com/IBM-Blockchain/blockchain-vscode-extension/issues/1067)
* Fixed debug bug and improved behaviour [#1118](https://github.com/IBM-Blockchain/blockchain-vscode-extension/issues/1118)

## 1.0.4: July 4th 2019

Expand Down
33 changes: 27 additions & 6 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For a step-by-step guide on getting started with the extension's features, acces

You will need the following installed in order to use the extension:
- Windows 10, Linux, or Mac OS are currently the supported operating systems.
- [VS Code version 1.32 or greater](https://code.visualstudio.com)
- [VS Code version 1.36.0 or greater](https://code.visualstudio.com)
- [Node v8.x or greater and npm v5.x or greater](https://nodejs.org/en/download/)
- [Docker version v17.06.2-ce or greater](https://www.docker.com/get-docker)
- [Docker Compose v1.14.0 or greater](https://docs.docker.com/compose/install/)
Expand Down Expand Up @@ -79,12 +79,19 @@ To debug your smart contract follow these steps:
1. Ensure you are connected to the `local_fabric` runtime and that the `local_fabric` peer is in development mode. Development mode is indicated by an infinity symbol on a peer, under `Nodes` in the `Local Fabric Ops` panel. To toggle development mode, right-click the peer and select `Toggle Development Mode`. By toggling development mode, transactions will now have a large timeout value.
2. Open your smart contract project in your workspace.
3. Open the debug view in Visual Studio Code using the left-hand navigation bar.
4. Select the `Debug Smart Contract` configuration by using the dropdown in the upper-left and click the **play** button on the debug toolbar.
5. Select `Instantiate Smart Contract` from the blockchain icon on the debug toolbar. This action will package, install and instantiate a debug version of the selected smart contract. If there is a version of the selected smart contract already instantiated, select `Upgrade Smart Contract`.
6. Add breakpoints to the smart contract by clicking on the relevant line numbers in your smart contract files.
7. To submit or evaluate a transaction, click the blockchain icon on the debug toolbar. Alternatively, in the `Fabric Gateways` panel, you can right click on transactions to submit or evaluate them. Execution will be paused on any breakpoints you've defined.
4. Select the `Debug Smart Contract` configuration by using the dropdown in the upper-left and click the **play** button on the debug toolbar. The extension will automatically instantiate or upgrade the smart contract as appropriate. If you want to test out a function that is called on instantiate or upgrade add the following to the launch configuration, where `name` is the name of the smart contract and `version` is different to the previous version used. Alternatively if you are using JavaScript or TypeScript then you can update the `version` in the package.json file.

To make iterative changes to your smart contract while debugging, after making your changes click the **restart** button. You can also stop the debugging session, make futher changes and start debugging again, without needing to upgrade your smart contract. Please note, as this stores the smart contract in local memory, for many changes to large smart contracts, you may need to reinstantiate the smart contract. If you restart the `local_fabric` runtime after stopping a debugging session, you must select `Upgrade Smart Contract` by clicking the blockchain icon on the debug toolbar. This will install a new `vscode-debug-XXXXXXX` version of your smart contract, which then allows you to continue submitting and debugging transactions.
```
"env": {
"CORE_CHAINCODE_ID_NAME": <name>:<version>
}
```

5. Add breakpoints to the smart contract by clicking on the relevant line numbers in your smart contract files.
6. To submit or evaluate a transaction, click the blockchain icon on the debug toolbar. Alternatively, in the `Fabric Gateways` panel, you can right click on transactions to submit or evaluate them. Execution will be paused on any breakpoints you've defined.

#### Making changes to your contract while debugging
To make iterative changes to your smart contract while debugging, after making your changes click the **restart** button. You can also stop the debugging session, make further changes and start debugging again, without needing to upgrade your smart contract.

### Add a gateway for connecting to your own Hyperledger Fabric instance
To connect to our own Hyperledger Fabric instance, it must be running [Hyperledger Fabric v1.4.1](https://hyperledger-fabric.readthedocs.io/en/release-1.4/install.html) or later.
Expand All @@ -101,6 +108,20 @@ The `Add Identity to Wallet` command will ask for a name, MSPID and a method to

For wallets associated with other remote Fabric gateways, the `Add Wallet`,`Edit Wallet` ,`Export Wallet` and `Remove Wallet` commands are available in the `Fabric Wallets` panel for wallet management.

### Creating an identity with attributes
Identities can be registered and enrolled with attributes from the `local_fabric` certificate authority.

The `Create Identity (register and enroll)` command will ask for an identity name and whether the identity should have any attributes added.
Selecting `Yes` will ask for the identity's attributes that should be provided in the following format:

```
[{"name": "attr1", "value": "attr1value", "ecert": true}, {"name": "attr2", "value": "attr2value", "ecert": true}]
```

The key `ecert` must be set to true in order for a smart contract to be able to read the value of the attribute using ['getAttributeValue'](https://fabric-shim.github.io/release-1.4/fabric-shim.ClientIdentity.html#getAttributeValue).

Hovering over an identity in the `Fabric Wallets` panel will show any attributes associated with the identity.

## Useful Commands
The IBM Blockchain Platform extension provides an explorer and commands accessible from the Command Palette, for developing smart contracts quickly:
<!---Table of commands with columns: 'command' and 'description'
Expand Down
2 changes: 1 addition & 1 deletion client/coverconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"text-summary"
],
"verbose": false
}
}
Loading

0 comments on commit ca8c925

Please sign in to comment.