From fb50fb2a43904f6fd6ae7b25b2faf9237d57006f Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Wed, 24 Jan 2024 14:47:54 -0800 Subject: [PATCH] build(deps): fix CVE-2024-21484 - force jsrsasign >=11.0.0 resolutions 1. Also upgraded the Fabric ledger related dependencies across the board because this newer version has a higher probability of not having issues with the newer transitive dependency that we are forcing on it. Signed-off-by: Peter Somogyvari --- compute_changed_packages.yaml | 25 ++ .../package.json | 2 +- .../package.json | 2 +- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 2 +- .../cactus-example-tcs-huawei/package.json | 4 +- examples/test-run-transaction/package.json | 4 +- package.json | 1 + .../cactus-cmd-socketio-server/package.json | 2 +- .../package.json | 4 +- .../cactus-plugin-satp-hermes/package.json | 2 +- scratch1.yaml | 418 ++++++++++++++++++ .../asset-transfer-basic-utils/package.json | 4 +- .../drivers/fabric-driver/package-local.json | 8 +- .../core/drivers/fabric-driver/package.json | 8 +- .../iin-agent/package-local.json | 6 +- .../iin-agent/package.json | 6 +- .../fabric/fabric-cli/package-local.json | 6 +- weaver/samples/fabric/fabric-cli/package.json | 6 +- .../package-local.json | 6 +- .../interoperation-node-sdk/package.json | 6 +- yarn.lock | 119 +++-- 23 files changed, 543 insertions(+), 106 deletions(-) create mode 100644 compute_changed_packages.yaml create mode 100644 scratch1.yaml diff --git a/compute_changed_packages.yaml b/compute_changed_packages.yaml new file mode 100644 index 0000000000..6ff8aeff61 --- /dev/null +++ b/compute_changed_packages.yaml @@ -0,0 +1,25 @@ + compute_changed_packages: + outputs: + plugin-ledger-connector-besu-changed: ${{ steps.changes.outputs.plugin-ledger-connector-besu-changed }} + plugin-ledger-connector-corda-changed: ${{ steps.changes.outputs.plugin-ledger-connector-corda-changed }} + plugin-ledger-connector-fabric-changed: ${{ steps.changes.outputs.plugin-ledger-connector-fabric-changed }} + plugin-ledger-connector-quorum-changed: ${{ steps.changes.outputs.plugin-ledger-connector-quorum-changed }} + cmd-api-server-changed: ${{ steps.changes.outputs.cmd-api-server-changed }} + + + needs: + - build-dev + - compute_changed_packages + if: needs.compute_changed_packages.outputs.plugin-ledger-connector-iroha2-changed == 'true' + + + needs: + - build-dev + - compute_changed_packages + if: needs.compute_changed_packages.outputs.ghcr-corda-all-in-one-obligation-changed == 'true' + + + + needs: + - compute_changed_packages + if: needs.compute_changed_packages.outputs.ghcr-corda-all-in-one-obligation-changed == 'true' \ No newline at end of file diff --git a/examples/cactus-example-carbon-accounting-backend/package.json b/examples/cactus-example-carbon-accounting-backend/package.json index 552a363ed7..5d452df9dd 100644 --- a/examples/cactus-example-carbon-accounting-backend/package.json +++ b/examples/cactus-example-carbon-accounting-backend/package.json @@ -65,7 +65,7 @@ "@openzeppelin/contracts": "4.9.3", "@openzeppelin/contracts-upgradeable": "4.9.3", "async-exit-hook": "2.0.1", - "fabric-network": "2.2.19", + "fabric-network": "2.2.20", "fs-extra": "10.1.0", "openapi-types": "9.1.0", "typescript-optional": "2.0.1", diff --git a/examples/cactus-example-cbdc-bridging-backend/package.json b/examples/cactus-example-cbdc-bridging-backend/package.json index 3c022fea01..4375d801a5 100644 --- a/examples/cactus-example-cbdc-bridging-backend/package.json +++ b/examples/cactus-example-cbdc-bridging-backend/package.json @@ -73,7 +73,7 @@ "axios": "1.6.0", "crypto-js": "4.2.0", "dotenv": "^16.0.1", - "fabric-network": "2.2.19", + "fabric-network": "2.2.20", "fs-extra": "10.1.0", "knex": "2.5.1", "kubo-rpc-client": "3.0.1", diff --git a/examples/cactus-example-discounted-asset-trade/package.json b/examples/cactus-example-discounted-asset-trade/package.json index 9c48089582..b309b5fcbf 100644 --- a/examples/cactus-example-discounted-asset-trade/package.json +++ b/examples/cactus-example-discounted-asset-trade/package.json @@ -32,8 +32,8 @@ "ethereumjs-common": "1.5.2", "ethereumjs-tx": "2.1.2", "express": "4.18.2", - "fabric-ca-client": "2.2.19", - "fabric-network": "2.2.19", + "fabric-ca-client": "2.2.20", + "fabric-network": "2.2.20", "http-errors": "1.6.3", "indy-sdk": "1.16.0-dev-1655", "jsonwebtoken": "9.0.0", diff --git a/examples/cactus-example-electricity-trade/package.json b/examples/cactus-example-electricity-trade/package.json index 7403d94bc4..0af1070214 100644 --- a/examples/cactus-example-electricity-trade/package.json +++ b/examples/cactus-example-electricity-trade/package.json @@ -29,8 +29,8 @@ "ethereumjs-common": "1.5.2", "ethereumjs-tx": "2.1.2", "express": "4.18.2", - "fabric-ca-client": "2.2.19", - "fabric-network": "2.2.19", + "fabric-ca-client": "2.2.20", + "fabric-network": "2.2.20", "http-errors": "1.6.3", "js-yaml": "3.14.1", "jsonwebtoken": "9.0.0", diff --git a/examples/cactus-example-supply-chain-backend/package.json b/examples/cactus-example-supply-chain-backend/package.json index 9ccef504b8..15c0664c7b 100644 --- a/examples/cactus-example-supply-chain-backend/package.json +++ b/examples/cactus-example-supply-chain-backend/package.json @@ -70,7 +70,7 @@ "dotenv": "16.0.0", "express": "4.18.2", "express-jwt": "8.4.1", - "fabric-network": "2.2.19", + "fabric-network": "2.2.20", "jose": "4.9.2", "openapi-types": "9.1.0", "solc": "0.8.6", diff --git a/examples/cactus-example-tcs-huawei/package.json b/examples/cactus-example-tcs-huawei/package.json index 02e751bd83..fba022343d 100644 --- a/examples/cactus-example-tcs-huawei/package.json +++ b/examples/cactus-example-tcs-huawei/package.json @@ -24,8 +24,8 @@ "ethereumjs-common": "1.5.2", "ethereumjs-tx": "2.1.2", "express": "4.18.2", - "fabric-ca-client": "2.2.19", - "fabric-network": "2.2.19", + "fabric-ca-client": "2.2.20", + "fabric-network": "2.2.20", "http-errors": "1.6.3", "js-yaml": "3.14.1", "jsonwebtoken": "8.5.1", diff --git a/examples/test-run-transaction/package.json b/examples/test-run-transaction/package.json index 1e9872924d..517b0d7e03 100644 --- a/examples/test-run-transaction/package.json +++ b/examples/test-run-transaction/package.json @@ -22,8 +22,8 @@ "ethereumjs-common": "1.5.2", "ethereumjs-tx": "2.1.2", "express": "4.18.2", - "fabric-ca-client": "2.2.19", - "fabric-network": "2.2.19", + "fabric-ca-client": "2.2.20", + "fabric-network": "2.2.20", "http-errors": "1.6.3", "jsonwebtoken": "8.5.1", "log4js": "6.4.0", diff --git a/package.json b/package.json index 2d065b0907..b80eae6f3a 100644 --- a/package.json +++ b/package.json @@ -87,6 +87,7 @@ "glob-parent": ">=5.1.2", "http-cache-semantics": ">=4.1.1", "jsonwebtoken": ">=9.0.0", + "jsrsasign": ">=11.0.0", "lodash": ">=4.17.21", "minimist": ">=1.2.6", "nano": ">=10.0.0", diff --git a/packages/cactus-cmd-socketio-server/package.json b/packages/cactus-cmd-socketio-server/package.json index 3c83a86c78..623b17bfca 100644 --- a/packages/cactus-cmd-socketio-server/package.json +++ b/packages/cactus-cmd-socketio-server/package.json @@ -53,7 +53,7 @@ "ethereumjs-common": "1.5.2", "ethereumjs-tx": "2.1.2", "express": "4.18.2", - "fabric-network": "2.2.19", + "fabric-network": "2.2.20", "http-errors": "1.6.3", "js-yaml": "3.14.1", "jsonwebtoken": "9.0.0", diff --git a/packages/cactus-plugin-persistence-fabric/package.json b/packages/cactus-plugin-persistence-fabric/package.json index d26afea85f..8574cc3683 100644 --- a/packages/cactus-plugin-persistence-fabric/package.json +++ b/packages/cactus-plugin-persistence-fabric/package.json @@ -73,7 +73,7 @@ "@hyperledger/cactus-plugin-keychain-memory": "2.0.0-alpha.2", "@hyperledger/cactus-plugin-ledger-connector-fabric": "2.0.0-alpha.2", "axios": "1.6.0", - "fabric-protos": "2.2.19", + "fabric-protos": "2.2.20", "js-sha256": "0.9.0", "pg": "8.8.0", "safe-stable-stringify": "2.4.3", @@ -86,7 +86,7 @@ "@types/uuid": "8.3.4", "body-parser": "1.20.2", "express": "4.18.2", - "fabric-network": "2.2.19", + "fabric-network": "2.2.20", "uuid": "8.3.2" }, "engines": { diff --git a/packages/cactus-plugin-satp-hermes/package.json b/packages/cactus-plugin-satp-hermes/package.json index b6f54310c6..a17fe0a8fc 100644 --- a/packages/cactus-plugin-satp-hermes/package.json +++ b/packages/cactus-plugin-satp-hermes/package.json @@ -79,7 +79,7 @@ "@types/uuid": "9.0.6", "body-parser": "1.20.2", "express": "4.18.2", - "fabric-network": "2.2.19", + "fabric-network": "2.2.20", "kubo-rpc-client": "3.0.1", "typescript": "5.3.3" }, diff --git a/scratch1.yaml b/scratch1.yaml new file mode 100644 index 0000000000..b7083285d6 --- /dev/null +++ b/scratch1.yaml @@ -0,0 +1,418 @@ +# This is a basic workflow to help you get started with Actions + +name: Test Asset Exchange Besu + +env: + NODEJS_VERSION: v18.18.2 + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ main ] + pull_request: + branches: [ main ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + check_code_changed: + outputs: + status: ${{ steps.changes.outputs.weaver_code_changed }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.5.2 + + - uses: dorny/paths-filter@v2.11.1 + id: changes + with: + filters: | + weaver_code_changed: + - './weaver/**!(*.md|*.css|*.html|*.jpg|*.jpeg|*.png)' + # - '.github/workflows/test_weaver-asset-exchange-besu.yaml' + + asset-exchange-besu: + needs: check_code_changed + if: ${{ false && needs.check_code_changed.outputs.status == 'true' }} + # The type of runner that the job will run on + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + app_contract: ["AliceERC1155", "AliceERC20", "AliceERC721"] + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3.5.2 + + - name: Set up JDK 11 + uses: actions/setup-java@v3.11.0 + with: + java-version: '11' + distribution: 'adopt' + + - name: Use Node.js ${{ env.NODEJS_VERSION }} + uses: actions/setup-node@v3.6.0 + with: + node-version: ${{ env.NODEJS_VERSION }} + + - name: Use Protoc 3.15 + run: | + curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.6/protoc-3.15.6-linux-x86_64.zip + unzip protoc-3.15.6-linux-x86_64.zip -d protoc + + # PROTOS + - name: Build Solidity Protos + run: | + export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin" + make build + working-directory: weaver/common/protos-sol + + # BESU NETWORK + - name: Start Besu Network + run: | + sudo apt install -y tmux jq + wget https://hyperledger.jfrog.io/artifactory/besu-binaries/besu/22.7.0/besu-22.7.0.zip + unzip besu-22.7.0.zip + export PATH="${PWD}/besu-22.7.0/bin:$PATH" + wget https://artifacts.consensys.net/public/ethsigner/raw/names/ethsigner.zip/versions/22.1.3/ethsigner-22.1.3.zip + unzip ethsigner-22.1.3.zip + export PATH="${PWD}/ethsigner-22.1.3/bin:$PATH" + make start + sleep 100 + working-directory: weaver/tests/network-setups/besu + + # Deploy contracts + - name: Deploy contracts + run: | + make deploy-contracts + working-directory: weaver/samples/besu/simpleasset + + # BESU CLI + - name: Setup BESU CLI .npmrc + run: | + cp .npmrc.template .npmrc + sed -i "s//${{ secrets.GITHUB_TOKEN }}/g" .npmrc + cat .npmrc + working-directory: weaver/samples/besu/besu-cli + + - name: Setup BESU CLI init + run: | + make build + cp config.template.json tmp.json + cp config.template.json tmp.json + jq -r '.network1.tokenContract |= "../simpleasset/build/contracts/${{ matrix.app_contract }}.json"' tmp.json > config.json + cp config.json tmp.json + jq -r '.network2.tokenContract |= "../simpleasset/build/contracts/BobERC20.json"' tmp.json > config.json + rm tmp.json + working-directory: weaver/samples/besu/besu-cli + + - name: Asset Exchange Besu CLI Tests + run: | + export PATH="${PWD}/bin:$PATH" + COUNT=0 + TOTAL=10 + + # HTLC Params + timeout=1000 + hashBase64="ivHErp1x4bJDKuRo6L5bApO/DdoyD/dG0mAZrzLZEIs=" + preimage="secrettext" + + # issue tokens to account 1 + initAmount=10 + transferAmount=5 + tokenId=0 + # & lock 5 token for account 2 in network 1 + if [ ${{ matrix.app_contract }} == "AliceERC20" ]; then + besu-cli asset issue --network=network1 --account=1 --amount=${initAmount} --asset_type=ERC20 + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --amount=${transferAmount} --timeout=${timeout} --hash_base64=${hashBase64} 1> tmp.out + elif [ ${{ matrix.app_contract }} == "AliceERC1155" ]; then + besu-cli asset issue --network=network1 --account=1 --amount=${initAmount} --token_id=${tokenId} --token_data="" --asset_type=ERC1155 + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --amount=${transferAmount} --token_id=${tokenId} --timeout=${timeout} --asset_type=ERC1155 --hash_base64=${hashBase64} 1> tmp.out + else + initAmount=1 + transferAmount=1 + besu-cli asset issue --network=network1 --account=1 --token_id=${tokenId} --asset_type=ERC721 1> tmp.out + tokenId=$(cat tmp.out | grep "New ERC721 token minted with id " | sed -e 's/New ERC721 token minted with id //') + cat tmp.out + echo $tokenId + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --token_id=${tokenId} --asset_type=ERC721 --timeout=${timeout} --hash_base64=${hashBase64} 1> tmp.out + fi + + balanceRem=$((initAmount-transferAmount)) + cat tmp.out | grep "Account balance of the sender in Network network1: ${initAmount} " && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "Account balance of the sender in Network network1: ${balanceRem}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "Account balance of the recipient in Network network1: 0" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + tmp_string=$(cat tmp.out | grep "Lock contract ID:") + arrIN=(${tmp_string//:/ }) + LOCK_ID=${arrIN[3]} + + # Is Asset locked + besu-cli asset is-locked --network=network1 --lock_contract_id=$LOCK_ID 1> tmp.out + cat tmp.out | grep "in Network network1: true" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # Claim asset + besu-cli asset claim --network=network1 --recipient_account=2 --preimage=${preimage} --token_id=${tokenId} --lock_contract_id=$LOCK_ID 1> tmp.out + cat tmp.out | grep "Account balance of the recipient in Network network1 before claiming: 0" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "Account balance of the recipient in Network network1 after claiming: ${transferAmount}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ###### test unlock ####### + timeout=20 + initAmount=5 + recipientAmt=0 + transferAmount=2 + tokenId=1 + if [ ${{ matrix.app_contract }} == "AliceERC20" ]; then + recipientAmt=5 + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --amount=${transferAmount} --timeout=${timeout} --hash_base64=${hashBase64} 1> tmp.out + elif [ ${{ matrix.app_contract }} == "AliceERC1155" ]; then + besu-cli asset issue --network=network1 --account=1 --amount=${initAmount} --token_id=${tokenId} --token_data="" --asset_type=ERC1155 + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --amount=${transferAmount} --token_id=${tokenId} --timeout=${timeout} --asset_type=ERC1155 --hash_base64=${hashBase64} 1> tmp.out + else + initAmount=1 + transferAmount=1 + recipientAmt=1 + besu-cli asset issue --network=network1 --account=1 --token_id=${tokenId} --asset_type=ERC721 1> tmp.out + tokenId=$(cat tmp.out | grep "New ERC721 token minted with id " | sed -e 's/New ERC721 token minted with id //') + cat tmp.out + echo $tokenId + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --token_id=${tokenId} --asset_type=ERC721 --timeout=${timeout} --hash_base64=${hashBase64} 1> tmp.out + fi + + balanceRem=$((initAmount-transferAmount)) + cat tmp.out | grep "Account balance of the sender in Network network1: ${initAmount}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "Account balance of the sender in Network network1: ${balanceRem}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "Account balance of the recipient in Network network1: ${recipientAmt}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + tmp_string=$(cat tmp.out | grep "Lock contract ID:") + arrIN=(${tmp_string//:/ }) + LOCK_ID=${arrIN[3]} + + sleep $timeout + + besu-cli asset unlock --network=network1 --lock_contract_id=$LOCK_ID --sender_account=1 --token_id=${tokenId} 1> tmp.out + cat tmp.out | grep "before unlocking: ${balanceRem}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "after unlocking: ${initAmount}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + working-directory: weaver/samples/besu/besu-cli + + asset-exchange-besu-local: + needs: check_code_changed + # The type of runner that the job will run on + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + app_contract: + - AliceERC1155 + - AliceERC20 + - AliceERC721 + exclude: + - app_contract: ${{ needs.check_code_changed.outputs.status == 'true' && 'dummy' || 'AliceERC1155' }} + - app_contract: ${{ needs.check_code_changed.outputs.status == 'true' && 'dummy' || 'AliceERC20' }} + - app_contract: ${{ needs.check_code_changed.outputs.status == 'true' && 'dummy' || 'AliceERC721' }} + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Print needs.check_code_changed.outputs.status + run: echo needs.check_code_changed.outputs.status => ${{ needs.check_code_changed.outputs.status }} + + - name: Print needs.check_code_changed.outputs.status != true + run: echo needs.check_code_changed.outputs.status != true => ${{ needs.check_code_changed.outputs.status != 'true' }} + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3.5.2 + + - name: Set up JDK 11 + uses: actions/setup-java@v3.11.0 + with: + java-version: '11' + distribution: 'adopt' + + - name: Use Node.js ${{ env.NODEJS_VERSION }} + uses: actions/setup-node@v3.6.0 + with: + node-version: ${{ env.NODEJS_VERSION }} + + - name: Use Protoc 3.15 + run: | + curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.6/protoc-3.15.6-linux-x86_64.zip + unzip protoc-3.15.6-linux-x86_64.zip -d protoc + + # PROTOS + - name: Build JS Protos + run: | + export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin" + make build + working-directory: weaver/common/protos-js + + # PROTOS + - name: Build Solidity Protos + run: | + export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin" + make build + working-directory: weaver/common/protos-sol + + # BESU SDK + - name: Setup BESU SDK + run: make build-local + working-directory: weaver/sdks/besu/node + + # BESU NETWORK + - name: Start Besu Network + run: | + sudo apt install -y tmux jq + wget https://hyperledger.jfrog.io/artifactory/besu-binaries/besu/22.7.0/besu-22.7.0.zip + unzip besu-22.7.0.zip + export PATH="${PWD}/besu-22.7.0/bin:$PATH" + wget https://artifacts.consensys.net/public/ethsigner/raw/names/ethsigner.zip/versions/22.1.3/ethsigner-22.1.3.zip + unzip ethsigner-22.1.3.zip + export PATH="${PWD}/ethsigner-22.1.3/bin:$PATH" + make start + sleep 100 + working-directory: weaver/tests/network-setups/besu + + # Deploy contracts + - name: Deploy contracts + run: | + make deploy-contracts + working-directory: weaver/samples/besu/simpleasset + + # BESU CLI + - name: Setup BESU CLI init + run: | + make build-local + cp config.template.json tmp.json + cp config.template.json tmp.json + jq -r '.network1.tokenContract |= "../simpleasset/build/contracts/${{ matrix.app_contract }}.json"' tmp.json > config.json + cp config.json tmp.json + jq -r '.network2.tokenContract |= "../simpleasset/build/contracts/BobERC20.json"' tmp.json > config.json + rm tmp.json + working-directory: weaver/samples/besu/besu-cli + + - name: Asset Exchange Besu CLI Tests + run: | + export PATH="${PWD}/bin:$PATH" + COUNT=0 + TOTAL=10 + + # HTLC Params + timeout=1000 + hashBase64="ivHErp1x4bJDKuRo6L5bApO/DdoyD/dG0mAZrzLZEIs=" + preimage="secrettext" + + # issue tokens to account 1 + initAmount=10 + transferAmount=5 + tokenId=0 + # & lock 5 token for account 2 in network 1 + if [ ${{ matrix.app_contract }} == "AliceERC20" ]; then + besu-cli asset issue --network=network1 --account=1 --amount=${initAmount} --asset_type=ERC20 + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --amount=${transferAmount} --timeout=${timeout} --hash_base64=${hashBase64} 1> tmp.out + elif [ ${{ matrix.app_contract }} == "AliceERC1155" ]; then + besu-cli asset issue --network=network1 --account=1 --amount=${initAmount} --token_id=${tokenId} --token_data="" --asset_type=ERC1155 + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --amount=${transferAmount} --token_id=${tokenId} --timeout=${timeout} --asset_type=ERC1155 --hash_base64=${hashBase64} 1> tmp.out + else + initAmount=1 + transferAmount=1 + besu-cli asset issue --network=network1 --account=1 --token_id=${tokenId} --asset_type=ERC721 1> tmp.out + tokenId=$(cat tmp.out | grep "New ERC721 token minted with id " | sed -e 's/New ERC721 token minted with id //') + cat tmp.out + echo $tokenId + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --token_id=${tokenId} --asset_type=ERC721 --timeout=${timeout} --hash_base64=${hashBase64} 1> tmp.out + fi + + balanceRem=$((initAmount-transferAmount)) + cat tmp.out | grep "Account balance of the sender in Network network1: ${initAmount} " && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "Account balance of the sender in Network network1: ${balanceRem}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "Account balance of the recipient in Network network1: 0" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + tmp_string=$(cat tmp.out | grep "Lock contract ID:") + arrIN=(${tmp_string//:/ }) + LOCK_ID=${arrIN[3]} + + # Is Asset locked + besu-cli asset is-locked --network=network1 --lock_contract_id=$LOCK_ID 1> tmp.out + cat tmp.out | grep "in Network network1: true" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # Claim asset + besu-cli asset claim --network=network1 --recipient_account=2 --preimage=${preimage} --token_id=${tokenId} --lock_contract_id=$LOCK_ID 1> tmp.out + cat tmp.out | grep "Account balance of the recipient in Network network1 before claiming: 0" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "Account balance of the recipient in Network network1 after claiming: ${transferAmount}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ###### test unlock ####### + timeout=20 + initAmount=5 + recipientAmt=0 + transferAmount=2 + tokenId=1 + if [ ${{ matrix.app_contract }} == "AliceERC20" ]; then + recipientAmt=5 + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --amount=${transferAmount} --timeout=${timeout} --hash_base64=${hashBase64} 1> tmp.out + elif [ ${{ matrix.app_contract }} == "AliceERC1155" ]; then + besu-cli asset issue --network=network1 --account=1 --amount=${initAmount} --token_id=${tokenId} --token_data="" --asset_type=ERC1155 + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --amount=${transferAmount} --token_id=${tokenId} --timeout=${timeout} --asset_type=ERC1155 --hash_base64=${hashBase64} 1> tmp.out + else + initAmount=1 + transferAmount=1 + recipientAmt=1 + besu-cli asset issue --network=network1 --account=1 --token_id=${tokenId} --asset_type=ERC721 1> tmp.out + tokenId=$(cat tmp.out | grep "New ERC721 token minted with id " | sed -e 's/New ERC721 token minted with id //') + cat tmp.out + echo $tokenId + besu-cli asset lock --network=network1 --sender_account=1 --recipient_account=2 --token_id=${tokenId} --asset_type=ERC721 --timeout=${timeout} --hash_base64=${hashBase64} 1> tmp.out + fi + + balanceRem=$((initAmount-transferAmount)) + cat tmp.out | grep "Account balance of the sender in Network network1: ${initAmount}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "Account balance of the sender in Network network1: ${balanceRem}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "Account balance of the recipient in Network network1: ${recipientAmt}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + tmp_string=$(cat tmp.out | grep "Lock contract ID:") + arrIN=(${tmp_string//:/ }) + LOCK_ID=${arrIN[3]} + + sleep $timeout + + besu-cli asset unlock --network=network1 --lock_contract_id=$LOCK_ID --sender_account=1 --token_id=${tokenId} 1> tmp.out + cat tmp.out | grep "before unlocking: ${balanceRem}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | grep "after unlocking: ${initAmount}" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + working-directory: weaver/samples/besu/besu-cli + diff --git a/tools/docker/fabric-all-in-one/asset-transfer-basic-utils/package.json b/tools/docker/fabric-all-in-one/asset-transfer-basic-utils/package.json index 6a0e7d8442..4e51f9d641 100644 --- a/tools/docker/fabric-all-in-one/asset-transfer-basic-utils/package.json +++ b/tools/docker/fabric-all-in-one/asset-transfer-basic-utils/package.json @@ -10,7 +10,7 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "fabric-ca-client": "2.2.19", - "fabric-network": "2.2.19" + "fabric-ca-client": "2.2.20", + "fabric-network": "2.2.20" } } diff --git a/weaver/core/drivers/fabric-driver/package-local.json b/weaver/core/drivers/fabric-driver/package-local.json index 7d907996e1..87f2365a27 100644 --- a/weaver/core/drivers/fabric-driver/package-local.json +++ b/weaver/core/drivers/fabric-driver/package-local.json @@ -28,10 +28,10 @@ "dotenv": "8.6.0", "eslint-config-prettier": "8.9.0", "eslint-plugin-prettier": "5.0.0", - "fabric-ca-client": "2.2.19", - "fabric-common": "2.2.19", - "fabric-network": "2.2.19", - "fabric-protos": "2.2.19", + "fabric-ca-client": "2.2.20", + "fabric-common": "2.2.20", + "fabric-network": "2.2.20", + "fabric-protos": "2.2.20", "level": "8.0.0", "winston": "3.10.0" }, diff --git a/weaver/core/drivers/fabric-driver/package.json b/weaver/core/drivers/fabric-driver/package.json index d7116518e1..725c711ec8 100644 --- a/weaver/core/drivers/fabric-driver/package.json +++ b/weaver/core/drivers/fabric-driver/package.json @@ -28,10 +28,10 @@ "dotenv": "8.6.0", "eslint-config-prettier": "8.9.0", "eslint-plugin-prettier": "5.0.0", - "fabric-ca-client": "2.2.19", - "fabric-common": "2.2.19", - "fabric-network": "2.2.19", - "fabric-protos": "2.2.19", + "fabric-ca-client": "2.2.20", + "fabric-common": "2.2.20", + "fabric-network": "2.2.20", + "fabric-protos": "2.2.20", "level": "8.0.0", "winston": "3.10.0" }, diff --git a/weaver/core/identity-management/iin-agent/package-local.json b/weaver/core/identity-management/iin-agent/package-local.json index 0ddde8af15..4d0d8b00e4 100644 --- a/weaver/core/identity-management/iin-agent/package-local.json +++ b/weaver/core/identity-management/iin-agent/package-local.json @@ -28,9 +28,9 @@ "dotenv": "8.6.0", "eslint-config-prettier": "6.15.0", "eslint-plugin-prettier": "3.4.1", - "fabric-ca-client": "2.2.19", - "fabric-common": "2.2.19", - "fabric-network": "2.2.19", + "fabric-ca-client": "2.2.20", + "fabric-common": "2.2.20", + "fabric-network": "2.2.20", "uuid": "9.0.1" }, "devDependencies": { diff --git a/weaver/core/identity-management/iin-agent/package.json b/weaver/core/identity-management/iin-agent/package.json index ee4b66628a..45bf23cb4b 100644 --- a/weaver/core/identity-management/iin-agent/package.json +++ b/weaver/core/identity-management/iin-agent/package.json @@ -28,9 +28,9 @@ "dotenv": "8.6.0", "eslint-config-prettier": "6.15.0", "eslint-plugin-prettier": "5.0.0", - "fabric-ca-client": "2.2.19", - "fabric-common": "2.2.19", - "fabric-network": "2.2.19", + "fabric-ca-client": "2.2.20", + "fabric-common": "2.2.20", + "fabric-network": "2.2.20", "uuid": "9.0.1" }, "devDependencies": { diff --git a/weaver/samples/fabric/fabric-cli/package-local.json b/weaver/samples/fabric/fabric-cli/package-local.json index 6473eec9a7..5f6b509fce 100644 --- a/weaver/samples/fabric/fabric-cli/package-local.json +++ b/weaver/samples/fabric/fabric-cli/package-local.json @@ -48,9 +48,9 @@ "dotenv": "8.6.0", "elliptic": "6.5.4", "express": "4.18.2", - "fabric-ca-client": "2.2.19", - "fabric-common": "2.2.19", - "fabric-network": "2.2.19", + "fabric-ca-client": "2.2.20", + "fabric-common": "2.2.20", + "fabric-network": "2.2.20", "gluegun": "5.1.6", "grpc-tools": "1.12.4", "ini": "1.3.8", diff --git a/weaver/samples/fabric/fabric-cli/package.json b/weaver/samples/fabric/fabric-cli/package.json index f216bb3cbf..c817eaa476 100644 --- a/weaver/samples/fabric/fabric-cli/package.json +++ b/weaver/samples/fabric/fabric-cli/package.json @@ -48,9 +48,9 @@ "dotenv": "8.6.0", "elliptic": "6.5.4", "express": "4.18.2", - "fabric-ca-client": "2.2.19", - "fabric-common": "2.2.19", - "fabric-network": "2.2.19", + "fabric-ca-client": "2.2.20", + "fabric-common": "2.2.20", + "fabric-network": "2.2.20", "gluegun": "5.1.6", "grpc-tools": "1.12.4", "ini": "1.3.8", diff --git a/weaver/sdks/fabric/interoperation-node-sdk/package-local.json b/weaver/sdks/fabric/interoperation-node-sdk/package-local.json index 64057cfc16..03154d5b9a 100644 --- a/weaver/sdks/fabric/interoperation-node-sdk/package-local.json +++ b/weaver/sdks/fabric/interoperation-node-sdk/package-local.json @@ -42,9 +42,9 @@ "@grpc/proto-loader": "0.7.8", "@hyperledger/cacti-weaver-protos-js": "file:./protos-js", "elliptic": "6.5.4", - "fabric-common": "2.2.19", - "fabric-network": "2.2.19", - "fabric-protos": "2.2.19", + "fabric-common": "2.2.20", + "fabric-network": "2.2.20", + "fabric-protos": "2.2.20", "js-sha3": "0.8.0", "jsrsasign": "10.8.6", "log4js": "6.9.1", diff --git a/weaver/sdks/fabric/interoperation-node-sdk/package.json b/weaver/sdks/fabric/interoperation-node-sdk/package.json index dddfb68f53..277d32ac36 100644 --- a/weaver/sdks/fabric/interoperation-node-sdk/package.json +++ b/weaver/sdks/fabric/interoperation-node-sdk/package.json @@ -42,9 +42,9 @@ "@grpc/proto-loader": "0.7.8", "@hyperledger/cacti-weaver-protos-js": "2.0.0-alpha.2", "elliptic": "6.5.4", - "fabric-common": "2.2.19", - "fabric-network": "2.2.19", - "fabric-protos": "2.2.19", + "fabric-common": "2.2.20", + "fabric-network": "2.2.20", + "fabric-protos": "2.2.20", "js-sha3": "0.8.0", "jsrsasign": "11.0.0", "log4js": "6.9.1", diff --git a/yarn.lock b/yarn.lock index 0ebef699cc..2771cc1c3d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7166,10 +7166,10 @@ __metadata: dotenv: 8.6.0 eslint-config-prettier: 8.9.0 eslint-plugin-prettier: 5.0.0 - fabric-ca-client: 2.2.19 - fabric-common: 2.2.19 - fabric-network: 2.2.19 - fabric-protos: 2.2.19 + fabric-ca-client: 2.2.20 + fabric-common: 2.2.20 + fabric-network: 2.2.20 + fabric-protos: 2.2.20 level: 8.0.0 nodemon: 2.0.22 patch-package: 6.5.1 @@ -7201,9 +7201,9 @@ __metadata: eslint-config-prettier: 8.10.0 eslint-plugin-prettier: 5.0.0 express: 4.18.2 - fabric-ca-client: 2.2.19 - fabric-common: 2.2.19 - fabric-network: 2.2.19 + fabric-ca-client: 2.2.20 + fabric-common: 2.2.20 + fabric-network: 2.2.20 gluegun: 5.1.6 google-protobuf: 3.21.2 grpc-tools: 1.12.4 @@ -7242,9 +7242,9 @@ __metadata: dotenv: 8.6.0 eslint-config-prettier: 6.15.0 eslint-plugin-prettier: 5.0.0 - fabric-ca-client: 2.2.19 - fabric-common: 2.2.19 - fabric-network: 2.2.19 + fabric-ca-client: 2.2.20 + fabric-common: 2.2.20 + fabric-network: 2.2.20 jsrsasign: 11.0.0 mocha: 5.2.0 nodemon: 2.0.22 @@ -7322,9 +7322,9 @@ __metadata: eslint-config-prettier: 8.10.0 eslint-plugin-import: 2.28.1 eslint-plugin-prettier: 5.0.0 - fabric-common: 2.2.19 - fabric-network: 2.2.19 - fabric-protos: 2.2.19 + fabric-common: 2.2.20 + fabric-network: 2.2.20 + fabric-protos: 2.2.20 js-sha3: 0.8.0 jsrsasign: 11.0.0 log4js: 6.9.1 @@ -7459,7 +7459,7 @@ __metadata: ethereumjs-common: 1.5.2 ethereumjs-tx: 2.1.2 express: 4.18.2 - fabric-network: 2.2.19 + fabric-network: 2.2.20 http-errors: 1.6.3 http-terminator: 3.2.0 js-yaml: 3.14.1 @@ -7575,7 +7575,7 @@ __metadata: "@types/uuid": 8.3.4 async-exit-hook: 2.0.1 express-jwt: 8.4.1 - fabric-network: 2.2.19 + fabric-network: 2.2.20 fs-extra: 10.1.0 hardhat: 2.17.2 http-status-codes: 2.1.4 @@ -7685,7 +7685,7 @@ __metadata: crypto-js: 4.2.0 cucumber: ^5.0.3 dotenv: ^16.0.1 - fabric-network: 2.2.19 + fabric-network: 2.2.20 fs-extra: 10.1.0 hardhat: 2.17.2 http-status-codes: 2.1.4 @@ -7756,8 +7756,8 @@ __metadata: ethereumjs-common: 1.5.2 ethereumjs-tx: 2.1.2 express: 4.18.2 - fabric-ca-client: 2.2.19 - fabric-network: 2.2.19 + fabric-ca-client: 2.2.20 + fabric-network: 2.2.20 http-errors: 1.6.3 indy-sdk: 1.16.0-dev-1655 jsonwebtoken: 9.0.0 @@ -7800,8 +7800,8 @@ __metadata: ethereumjs-common: 1.5.2 ethereumjs-tx: 2.1.2 express: 4.18.2 - fabric-ca-client: 2.2.19 - fabric-network: 2.2.19 + fabric-ca-client: 2.2.20 + fabric-network: 2.2.20 http-errors: 1.6.3 js-yaml: 3.14.1 jsonwebtoken: 9.0.0 @@ -7841,7 +7841,7 @@ __metadata: dotenv: 16.0.0 express: 4.18.2 express-jwt: 8.4.1 - fabric-network: 2.2.19 + fabric-network: 2.2.20 jose: 4.9.2 openapi-types: 9.1.0 solc: 0.8.6 @@ -7946,8 +7946,8 @@ __metadata: ethereumjs-common: 1.5.2 ethereumjs-tx: 2.1.2 express: 4.18.2 - fabric-ca-client: 2.2.19 - fabric-network: 2.2.19 + fabric-ca-client: 2.2.20 + fabric-network: 2.2.20 http-errors: 1.6.3 js-yaml: 3.14.1 jsonwebtoken: 8.5.1 @@ -8724,8 +8724,8 @@ __metadata: axios: 1.6.0 body-parser: 1.20.2 express: 4.18.2 - fabric-network: 2.2.19 - fabric-protos: 2.2.19 + fabric-network: 2.2.20 + fabric-protos: 2.2.20 js-sha256: 0.9.0 pg: 8.8.0 safe-stable-stringify: 2.4.3 @@ -8757,7 +8757,7 @@ __metadata: body-parser: 1.20.2 crypto-js: 4.2.0 express: 4.18.2 - fabric-network: 2.2.19 + fabric-network: 2.2.20 fs-extra: 11.1.1 knex: 2.4.0 kubo-rpc-client: 3.0.1 @@ -26246,15 +26246,15 @@ __metadata: languageName: node linkType: hard -"fabric-ca-client@npm:2.2.19": - version: 2.2.19 - resolution: "fabric-ca-client@npm:2.2.19" +"fabric-ca-client@npm:2.2.20": + version: 2.2.20 + resolution: "fabric-ca-client@npm:2.2.20" dependencies: - fabric-common: 2.2.19 + fabric-common: 2.2.20 jsrsasign: ^10.5.25 url: ^0.11.0 winston: ^2.4.5 - checksum: fa957d2c0ad0e7642aff94a7f04d04fc28cc95bb6cf0e18c785362e0a48e34fdce6d5d94c61427887a89a9db9f3616c02f144f7197a49e2ff3fd1927521226b9 + checksum: 888fd3865975e053eeceab47f2c233152d985938c8d56db722424806bd38e36285ef5a44610ffbf9a1a88413224ccb0cd79e855ba5428b37cb2b1a2014e56edb languageName: node linkType: hard @@ -26270,14 +26270,14 @@ __metadata: languageName: node linkType: hard -"fabric-common@npm:2.2.19": - version: 2.2.19 - resolution: "fabric-common@npm:2.2.19" +"fabric-common@npm:2.2.20": + version: 2.2.20 + resolution: "fabric-common@npm:2.2.20" dependencies: callsite: ^1.0.0 elliptic: ^6.5.4 - fabric-protos: 2.2.19 - js-sha3: ^0.8.0 + fabric-protos: 2.2.20 + js-sha3: ^0.9.2 jsrsasign: ^10.5.25 long: ^5.2.3 nconf: ^0.12.0 @@ -26289,7 +26289,7 @@ __metadata: dependenciesMeta: pkcs11js: optional: true - checksum: 91c6dd404d9ea451d0825395902c4e8fa71a8de4ee0f34327cffe8c11ff0b3de6a79be0bc923572c465fa7a8b9918d785e808f927f8f7acfab6e6ac34b480383 + checksum: 5eb06683d514ef1efc418dd40c985fb91c03920a02b447c83cd3c6584b3f43e137ae65b585d477cdb06fb3b246f3eb766676cc59d3bf8646fb9eab39d11e188b languageName: node linkType: hard @@ -26315,15 +26315,15 @@ __metadata: languageName: node linkType: hard -"fabric-network@npm:2.2.19": - version: 2.2.19 - resolution: "fabric-network@npm:2.2.19" +"fabric-network@npm:2.2.20": + version: 2.2.20 + resolution: "fabric-network@npm:2.2.20" dependencies: - fabric-common: 2.2.19 - fabric-protos: 2.2.19 + fabric-common: 2.2.20 + fabric-protos: 2.2.20 long: ^5.2.3 - nano: ^9.0.5 - checksum: 0bbd9414587c72291b1f0d491e45030dacf38ff52132c0721a08e89aaf76c4d8dfe51e1abfe0150663e5595daae55bc289a8f7b6de5e30387db73bb0d7e2392f + nano: ^10.1.2 + checksum: 95bd304df883dd32f6aa445495358531b5ac2c716596aa87c9a9212c6b29f3741fb92f8f84895dfe43779600f23f736ab79c2d114ceb4e584d1ea2bf80c936f0 languageName: node linkType: hard @@ -26338,15 +26338,15 @@ __metadata: languageName: node linkType: hard -"fabric-protos@npm:2.2.19": - version: 2.2.19 - resolution: "fabric-protos@npm:2.2.19" +"fabric-protos@npm:2.2.20": + version: 2.2.20 + resolution: "fabric-protos@npm:2.2.20" dependencies: "@grpc/grpc-js": ~1.9.0 "@grpc/proto-loader": ^0.7.0 long: ^5.2.3 protobufjs: ^7.2.0 - checksum: 80e295d8041063eb8c5a723c88732923cfd18c6cd7520e189985f33a2c308bf2afc2dee76cf82a3bedf046958ae2f642462a20fe8c6505729f8cdecc04b37faf + checksum: 2961e7d6bcd7c583a79166d13ffb161536f9ee2a70f9bff497185f0247f2562558659e661e5200ec27ab38c95cc4ac418bac1f1a44be0be5c9f8e12b6456920a languageName: node linkType: hard @@ -33005,6 +33005,13 @@ __metadata: languageName: node linkType: hard +"js-sha3@npm:^0.9.2": + version: 0.9.3 + resolution: "js-sha3@npm:0.9.3" + checksum: cfab12cdb3aa9c0c8e8466761d89cb9770653880910b920682fa676dd102868a827709c857cb089bdc0d6120542137f92a7c1699ab428c0f4057c823aef24601 + languageName: node + linkType: hard + "js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": version: 4.0.0 resolution: "js-tokens@npm:4.0.0" @@ -33381,27 +33388,13 @@ __metadata: languageName: node linkType: hard -"jsrsasign@npm:11.0.0": +"jsrsasign@npm:>=11.0.0": version: 11.0.0 resolution: "jsrsasign@npm:11.0.0" checksum: 9bbcbb9d2609e279fb015eec259490053be0afd9a6a98743ce0bf42f825e8415b377bfb1aef1d988d3d9ece0bce34bec5bc64f71e99406d0743c37cbbb2f89a5 languageName: node linkType: hard -"jsrsasign@npm:^10.4.0": - version: 10.5.25 - resolution: "jsrsasign@npm:10.5.25" - checksum: e789cd6d5e6e236edebe91936279cdef886aafaab8d4ebc7d40b8ba0c7b7cd0d6d3c53fba26ea96eb33cc77a05368b369ef31fc9182662bce2344143ad50ea0f - languageName: node - linkType: hard - -"jsrsasign@npm:^10.5.25": - version: 10.5.26 - resolution: "jsrsasign@npm:10.5.26" - checksum: 1d717c7a0d2e4e745f4c819b0291a2f7a3c200001fce00c112fb9566d8f7bce108a86721a6eba804ca56f67885cfbf23167e592df1e568ca6f9855ca1f050682 - languageName: node - linkType: hard - "jsx-ast-utils@npm:^1.3.4": version: 1.4.1 resolution: "jsx-ast-utils@npm:1.4.1"